title: R issue : performing lm and then a boxcox to find a proper lambda value
body: <p>I have a dataset of climate data in a data.frame (columns are measuring stations, and rows indicate time of measurement), and I'm trying to find the proper lambda values in a Yeo-Johnson transform to limit skewness impact on a principal component analysis.</p>
  
  <p>Obviously, the first step is to get log likelihoods to find the best lambda : I use the following, where i is the index of a column :</p>
  
  <pre><code>getYeoJohsnonLambda &lt;- function(myClimateData,cols,lambda_min, lambda_max,eps)
  ...
  lambda &lt;- seq(lambda_min,lambda_max,eps)
  for(i in cols)
      {
      formula &lt;- as.formula(paste("myClimateData$",colnames(myClimateData)[i],"~1"))
      currentModel &lt;- lm(formula,myClimateData)
      print(currentModel)
      myboxCox &lt;- boxCox(currentModel, lambda = lambda ,family="yjPower", plotit = FALSE)
      ...
      }
  </code></pre>
  
  <p>When I am trying to call it for a climateData time series which could be, for example :</p>
  
  <pre><code>`climateData &lt;-data.frame(c(8.2,6.83,5.46,4.1,3.73,3.36,3,3,3,3,3.7),c(0,0.66,1.33,2,2,2,2,2,2,2,1.6))`
  </code></pre>
  
  <p>I get this error : <code>Error in is.data.frame(data) : object 'myClimateData' not found</code></p>
  
  <p>This is weird, as lm seems to find it and return a correct fit, and myClimateData should be found as it is one of the arguments of the function, right ?</p>