[R] lapply and list indexing basics (after realizing I wasn't previously subscribed...sorry)

2010-03-07 Thread Simon Knapp
library(MASS) dat <- data.frame( col1=as.factor(sample(1:4, 100, T)), col2=as.factor(sample(1:4, 100, T)), col3=as.factor(sample(1:4, 100, T)), isi=rnorm(100) ) dat <- split(dat, as.factor(sample(1:3, 100, T))) lapply(dat, function(x, densfun) fitdistr(x$isi, densfun), 'normal')

[R] lapply and list indexing basics (after realizing I wasn't previously subscribed...sorry)

2010-03-07 Thread Dgnn
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