Hi, I have a problem in relation with a packahe I made. It runs on my machine (Windows, where I made the package), and it runs in a Mac machine, but it does not run in another Mac machine with the same R version. The part of the code is giving problems: singleCosinor <- function(t, y, period=24) { x1 <- cos(2 * pi * t / period) x2 <- sin(2 * pi * t / period) single <- lm (y ~ x1 + x2) return(single) } The error: Error en eval(expr, envir, enclos) : objeto 'y' no encontrado Can it be in relation with scoping?. Thanks in advance. Eva [[alternative HTML version deleted]]
Eva, What do you get when you type ls() on the machine that the code does not run? It could be that "y" is not in that particular workspace. HTH, Jorge.- On Thu, Nov 1, 2012 at 7:25 PM, Eva Prieto Castro <> wrote:> Hi, > > I have a problem in relation with a packahe I made. It runs on my machine > (Windows, where I made the package), and it runs in a Mac machine, but it > does not run in another Mac machine with the same R version. > > The part of the code is giving problems: > > singleCosinor <- function(t, y, period=24) { > x1 <- cos(2 * pi * t / period) > x2 <- sin(2 * pi * t / period) > single <- lm (y ~ x1 + x2) > return(single) > } > > The error: > > Error en eval(expr, envir, enclos) : objeto 'y' no encontrado > > Can it be in relation with scoping?. > > Thanks in advance. > > Eva > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@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. > >[[alternative HTML version deleted]]
Yes, it is most likely due to scoping. It is safest to create a data frame with all the data in it, then pass that to the data argument of lm. On Thu, Nov 1, 2012 at 2:25 AM, Eva Prieto Castro <evapcastro at yahoo.es> wrote:> Hi, > > I have a problem in relation with a packahe I made. It runs on my machine (Windows, where I made the package), and it runs in a Mac machine, but it does not run in another Mac machine with the same R version. > > The part of the code is giving problems: > > singleCosinor <- function(t, y, period=24) { > x1 <- cos(2 * pi * t / period) > x2 <- sin(2 * pi * t / period) > single <- lm (y ~ x1 + x2) > return(single) > } > > The error: > > Error en eval(expr, envir, enclos) : objeto 'y' no encontrado > > Can it be in relation with scoping?. > > Thanks in advance. > > Eva > > [[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. >-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com