I have a problem with data tables in R. I have a vector col_Names which contains the names of some columns of the datatable dataset.
I want to compute the log of the columns in col_Names and to substitute the result to the original ones... If I know the names of these columns and if they are a few, say for example
col_Names = c("col1","col2")
I could use this code:
dataset[,':='(col1=log(col1),col2=log(col2))]
but since I don't know the nature of col_Names because it's created by another procedure I can't use that code.
is there any code, I don't know, like
dataset[,':='(col_Names=log(col_Names))]
which could help me? I don't want to use for
cycle or lapply
if it's possible...