Is there any way to use string stored in variable as a column name in a new data frame? The expected result should be:
col.name <- \'col1\' df <- data.fram
I don't recommend you do this, but:
col.name <- 'col1' eval(parse(text=paste0('data.frame(', col.name, '=1:4)')))