I am aware of selecting a column of data frame using data$column
. My question - Is there a way to do that dynamically where I create a function and pass data, columnName
as parameter and get the result back
fnGetColumnData (data, columnName) {
data$columnName
}
above does not work when encapsulating the code in a function. However if I write data$"columnName"
then it works. Is there a way to encapsulate this?