Reputation: 154
I have created a function to transform data. It returns me a list of two dataframe
:
df1$v1 df1$v2 // df2$v1 df2$v2
dflist <- c(df1, df2)
I need to subset variables inside of each dataframe
separately in a shiny app as reactive value.
I tried to subset them with
dflist[[1]]["v1"]
But it's not subset as the 1st variable of the 1st dataframe
of the list but as a data.frame
class(dflist[[1]]["v1"])
returns me dataframe
, and I want the class of my variable instead.
Any ideas?
Upvotes: 2
Views: 1279
Reputation: 887961
We need to do [[
dflist[[1]][["v1"]]
or use a ,
dflist[[1]][,"v1"]
because
dflist[[1]]["v1"]
is still a data.frame
of single column
Upvotes: 5