[R] how to force a table to be square?

William Dunlap wdunlap at tibco.com
Thu Jul 22 18:57:23 CEST 2010


> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Wu Gong
> Sent: Thursday, July 22, 2010 9:44 AM
> To: r-help at r-project.org
> Subject: Re: [R] how to force a table to be square?
> 
> 
> Hi William,
> 
> I'm curious about that you used d[] <- lapply(d, factor...
> Could you please tell me if there are any differences between 
> d[] and d?

lappy(dataFrame, ...) returns a "list", not a "data.frame"
so d<-lapply(d, factor) would result in d being a list.
d[]<-newValue pushes the new values into the existing structure
of d, generally leaving the attributes (e.g., class) alone.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> Thank you.
> 
> -----
> A R learner.
> -- 
> View this message in context: 
> http://r.789695.n4.nabble.com/how-to-force-a-table-to-be-squar
e-tp2298707p2298965.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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