Hi, Can anyone tell me what's wrong with the function below (I'm new to R) generator <- function(n, seed) { .Random.seed <<- seed data.1 <- rnorm(n)-1 data.2 <- rnorm(n)+2 data.3 <- runif(n) <= 0.6 data <- data.1*data.3 + data.2*(1-data.3) data } seed <- c(61,40,6,40,55,2,44,30,20,56,41,1) dat.mixed <- sort(generator(100,seed)) Error in rnorm(n) : .Random.seed[1] is NOT a valid RNG kind (code) rm(generator) This function is called dat.mixed.R and is from the R package called haerdle_1.0-1.tar.gz and contains functions from Wolfgang Haerdle's book called "Smoothing Techniques with Implementation in S", Springer-Verlag, 1991. Also, why is this package not listed in the CRAN. I got haerdle_1.0-1.tar.gz from ftp://ftp-stat.uni-klu.ac.at/pub/R/contrib and it installed okay (after I had removed the Makefile in haerdle/src/). Thanks for your help, Paul Stansell -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 14 Jun 2001, Paul Stansell wrote:> > Hi, > > Can anyone tell me what's wrong with the function below (I'm new to R) > > > generator <- function(n, seed) > { > .Random.seed <<- seed > data.1 <- rnorm(n)-1 > data.2 <- rnorm(n)+2 > data.3 <- runif(n) <= 0.6 > data <- data.1*data.3 + data.2*(1-data.3) > data > } > seed <- c(61,40,6,40,55,2,44,30,20,56,41,1) > dat.mixed <- sort(generator(100,seed)) > Error in rnorm(n) : .Random.seed[1] is NOT a valid RNG kind (code) > rm(generator)Because that's not how seeds are done in R. R != S. Try ?random and see for yourself.> This function is called dat.mixed.R and is from the R package called > haerdle_1.0-1.tar.gz and contains functions from Wolfgang Haerdle's book > called "Smoothing Techniques with Implementation in S", Springer-Verlag, > 1991. > > Also, why is this package not listed in the CRAN. > I got haerdle_1.0-1.tar.gz from > ftp://ftp-stat.uni-klu.ac.at/pub/R/contrib and it installed okay > (after I had removed the Makefile in haerdle/src/).Because that is not a CRAN site. As the original submitter of that package to statlib, I did not port it to R as there are much better alternatives available already. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 14 Jun 2001, Prof Brian Ripley wrote:> On Thu, 14 Jun 2001, Paul Stansell wrote: > > > > > Hi, > > > > Can anyone tell me what''s wrong with the function below (I''m new to R) > > > > > > generator <- function(n, seed) > > { > > .Random.seed <<- seed > > data.1 <- rnorm(n)-1 > > data.2 <- rnorm(n)+2 > > data.3 <- runif(n) <= 0.6 > > data <- data.1*data.3 + data.2*(1-data.3) > > data > > } > > seed <- c(61,40,6,40,55,2,44,30,20,56,41,1) > > dat.mixed <- sort(generator(100,seed)) > > Error in rnorm(n) : .Random.seed[1] is NOT a valid RNG kind (code) > > rm(generator) > > Because that''s not how seeds are done in R. R != S. Try ?random and > see for yourself. > > > This function is called dat.mixed.R and is from the R package called > > haerdle_1.0-1.tar.gz and contains functions from Wolfgang Haerdle''s book > > called "Smoothing Techniques with Implementation in S", Springer-Verlag, > > 1991. > > > > Also, why is this package not listed in the CRAN. > > I got haerdle_1.0-1.tar.gz from > > ftp://ftp-stat.uni-klu.ac.at/pub/R/contrib and it installed okay > > (after I had removed the Makefile in haerdle/src/). > > Because that is not a CRAN site. As the original submitter of that > package to statlib, I did not port it to R as there are much better > alternatives available already.I agree. I have moved it to ftp-stat.uni../pub/R/contrib/old because I didn''t touch it for over 3 years now (it was one of my first experiments with porting S+ packages 5 years ago, but it didn''t work perfectly at any time) Albrecht // Albrecht Gebhardt Tel.: (++43 463) 2700/3118 // Institut fuer Mathematik Fax : (++43 463) 2700/3198 // Universitaet Klagenfurt mailto:albrecht.gebhardt at uni-klu.ac.at // Universitaetsstr. 65 http://www-stat.uni-klu.ac.at/~agebhard // A-9020 Klagenfurt, Austria -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._