[R] create a r list from dataframe using the first column as list names

Rasmus Liland jen@r@@mu@ @end|ng |rom gm@||@com
Fri Apr 10 18:14:32 CEST 2020


On 2020-04-09 18:00 +0000, aiguo li wrote:
| That is awesome!  Thanks.

Dear AiGuo,

I thought: why make this overly 
complicated, when this is also 
possible:

  a <- matrix(LETTERS[1:16], nrow=4)
  X <- split(x=a[,-1], f=a[,1])
  lapply(X=X, FUN=as.factor)

Best,
Rasmus



More information about the R-help mailing list