Hey guys, quick question.
I swear I have done it before, but it isn't working for some reason this time, perhaps you guys can help me with the syntax:
I am interested in extracting a column from a data.frame ("df"). However, the name of the column to be extracted will be provided by an argument. It looks a little like this:
extraction <- function (x) {
column.in.question <- df$x
print(column.in.question)
}
In this scenario, executing "extraction(Glutamate)" should extract the column called "Glutamate" from the data frame "df", however, it does not. It returns "NULL".
If I manually type "df$Glutamate", it magically works again. This leads me to believe that somethings about using the argument as a column name isn't translating properly, even though I have done this exact process before.
I would greatly appreciate any help.