[R] Random number
Peter Ehlers
ehlers at ucalgary.ca
Sun Oct 11 22:49:27 CEST 2009
Ashta wrote:
> Hi All,
> I have the matrix called 'X' with 200 rows and 12 variables. I want to
> create 2 new variables (V1 and V2) based on random number generator
>
> p1<-rnorm(200. mean=0, std=1)
> p2<-rnorm(200. mean=0, std=1)
> x <- cbind(x, v1=ifelse(x[,'p1'] > 0.4, 1, 0), v2=ifelse(x[,'p2'] > 0.6, 0,
> 1))
>
> I found the following error message
> *Error: unexpected symbol in "p1<-rnorm(200. mean"
>
> Any help?
>
You need to increase the size of the font you're working with.
It seems that your eyes can't distinguish a '.' from a ','!
-Peter Ehlers
> *
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list