Program R Red X's

6 views
Skip to first unread message

Sarah Morris

unread,
May 13, 2021, 4:17:07 PMMay 13
to distance-sampling
Hello everyone, 

 I am brand new to Program R. I am trying to learn to perform data analysis for my thesis. I'm looking through different websites to get a feel for the program and practice some codes. However, every time I've done a simple command like x <- (0.5, 0.6), the program highlights the comma with a red x saying "unexpected token "," ". Can anybody explain why that is?

Eric Rexstad

unread,
May 14, 2021, 3:39:36 AMMay 14
to Sarah Morris, distance-sampling

Good morning Sarah

Indeed the instruction you provide is something that R does not understand.  Essentially everything done in R involves using functions (commands).  You have not provided a function on the right-hand side of your assignment, causing the error.  My guess is that you want to create a vector containing those two values.  That would be accomplished using the 'c()' function

x <- c(0.5, 0.6)

I suggest you spend a bit of time learning a bit about the fundamentals of R.  Lots of free resources online for this, such as

https://www.guru99.com/r-data-types-operator.html

After becoming familiar with general syntax, you could pay a visit to Chapter 7 of our online training materials to learn the basics of performing distance sampling analyses using R:

https://workshops.distancesampling.org/online-course/syllabus/Chapter7/

On 13/05/2021 21:17, Sarah Morris wrote:
Hello everyone, 

 I am brand new to Program R. I am trying to learn to perform data analysis for my thesis. I'm looking through different websites to get a feel for the program and practice some codes. However, every time I've done a simple command like x <- (0.5, 0.6), the program highlights the comma with a red x saying "unexpected token "," ". Can anybody explain why that is?
--
You received this message because you are subscribed to the Google Groups "distance-sampling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to distance-sampl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/distance-sampling/4ad4f754-095d-42fd-8b60-caf3ca112f5en%40googlegroups.com.
-- 
Eric Rexstad
Centre for Ecological and Environmental Modelling
University of St Andrews
St Andrews is a charity registered in Scotland SC013532
Reply all
Reply to author
Forward
0 new messages