You can use the as.list
function.
For example:
df <- read.table(text = "TAXA Taxa.1 Taxa.2 Taxa.3 Taxa.4 Taxa.5 Taxa.6 Taxa.7 Taxa.8
09/04/2013 32.7188 8.8350 13.0662 9.0114 8.7003 8.9924 76.7003 9.2542
10/04/2013 376.7003 8.8170 67.0762 8.9842 8.9924 9.0395 8.9924 9.2247
11/04/2013 67.9924 8.8589 13.0656 9.0357 14.3199 8.9912 667.3199 9.2815", header = TRUE)
str(df)
'data.frame': 3 obs. of 9 variables:
$ TAXA : Factor w/ 3 levels "09/04/2013","10/04/2013",..: 1 2 3
$ Taxa.1: num 32.7 376.7 68
$ Taxa.2: num 8.84 8.82 8.86
$ Taxa.3: num 13.1 67.1 13.1
$ Taxa.4: num 9.01 8.98 9.04
$ Taxa.5: num 8.7 8.99 14.32
$ Taxa.6: num 8.99 9.04 8.99
$ Taxa.7: num 76.7 8.99 667.32
$ Taxa.8: num 9.25 9.22 9.28
Transforming to list:
lista <- as.list(df)
str(lista)
List of 9
$ TAXA : Factor w/ 3 levels "09/04/2013","10/04/2013",..: 1 2 3
$ Taxa.1: num [1:3] 32.7 376.7 68
$ Taxa.2: num [1:3] 8.84 8.82 8.86
$ Taxa.3: num [1:3] 13.1 67.1 13.1
$ Taxa.4: num [1:3] 9.01 8.98 9.04
$ Taxa.5: num [1:3] 8.7 8.99 14.32
$ Taxa.6: num [1:3] 8.99 9.04 8.99
$ Taxa.7: num [1:3] 76.7 8.99 667.32
$ Taxa.8: num [1:3] 9.25 9.22 9.28
In general, in R
, when you want to convert an object to another you will use a function of type as.objeto
.
Remember, however, that data.frame
is already a list, with only over attributes. So by doing as.list
you're just removing these attributes (like row.names
).
is.list(df)
TRUE