I am wanting to us a specific value of a data.table. The column names and amount of columns are always changing, so I cannot use :
df$column_5[2]
Or :
df[2,5]
To get value I need.
I would like to do something similar to the following:
x <- 5
df[2,x]
But I get an error saying:
df[2,x] Error in
[.data.table(df, 2, x) : j (the 2nd argument inside [...]) is a single symbol but column name 'x' is not found. Perhaps you intended DT[, ..x]. This difference to data.frame is deliberate and explained in FAQ 1.1."
Do you have any solutions to this issue?
data.table(i.e. not a dataframe)! Do you want a data.table-operation or a dataframe-operation? - jogodf[2, x, with = FALSE]- Mako212data.tablelibrary, it changes how brackets behave with objects of classdata.table. If you want to take advantage of R's standarddata.frameevaluation of brackets, you need to specifywith = F- Mako212