It would have been nice if you had at least posted what the structure of
myList is. Assuming that this is the list of your data frames, then the
following might work:
lapply(myList, function(x) fitdistr(x$isi,
densfun='gamma',start=list(scale=1, shape=2)))
On Sun, Mar 7, 2010 at 7:30 PM, Dgnn <sharkbrainpdx@gmail.com> wrote:
>
> I have split my original dataframe to generate a list of dataframes each of
> which has 3 columns of factors and a 4th column of numeric data.
> I would like to use lapply to apply the fitdistr() function to only the 4th
> column (x$isi) of the dataframes in the list.
>
> Is there a way to do this or am I misusing lapply?
>
> As a second solution I tried splitting only the numeric data column to
> yield
> a list of vectors and then using
> lapply(myList, fitdistr, densfun='gamma',start=list(scale=1,
shape=2))
> returns the error:
> Error in optim(x = c(305, 290, 283, 363, 331, 293, 304, 312, 286, 339, :
> non-finite finite-difference value [2]
> In addition: Warning message:
> In dgamma(x, shape, scale, log) : NaNs produced
>
> However, if I use fitdistr(myList[[i]]) on each element of the list, there
> are no errors.
>
> Thanks in advance for any comments.
>
> -jason
> --
> View this message in context:
> http://n4.nabble.com/lapply-and-list-indexing-basics-tp1584006p1584006.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
[[alternative HTML version deleted]]