[R] access/row access/col access

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Fri Jan 13 18:16:30 CET 2012


Like Sarah said, what you say below makes very little sense, but as a total shot in the dark, is this what you mean?

lapply(1:nrow(df), function(i) x[i,] )

Michael

On Jan 13, 2012, at 11:15 AM, Sarah Goslee <sarah.goslee at gmail.com> wrote:

> I have to admit, I have very little idea what you are trying to do. Can you
> provide an example?
> 
> In general, the i-th column of a data frame can be accessed with
> 
> mydataframe[, i]
> 
> but that doesn't help with whatever you want to do with apply().
> 
> Sarah
> 
> On Fri, Jan 13, 2012 at 10:45 AM, statquant2 <statquant at gmail.com> wrote:
>> Hello,
>> I have a data.frame and I want to transfor it in a list of rows or columns.
>> I can do apply(myDataFrame,MARGIN=1,FUN=???)
>> 
>> I remember that there is a function which mean return or access column ...
>> something like "::" or "]," or "[,"
>> I can't remember can somebody refresh my memory?
>> 
> -- 
> Sarah Goslee
> http://www.functionaldiversity.org
> 
> ______________________________________________
> 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.



More information about the R-help mailing list