I have got a function :
aggreg <- function(fileName, param){
contents <- read.csv(fileName, header=T)
#print(contents) #This displays all contents
print(contents$param) #gives NULL
}
> aggreg("test.csv","Close.Price")
> NULL
Please guide further. Thanks:)
you need to use another way of accessing the columns in the dataframe than via $
. There are two other ways:
1.
print(content[[param]])
2.
print(content[,param])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.