Displaying 1 result from an estimated 1 matches for "fract2".
Did you mean:
fact2
2016 Apr 07
2
Using a function with apply Error: undefined columns selected
...trying to write a function that can be used to apply to process all the columns of a data.frame. If you will run the code below, you will get the error message undefined columns selected. I hope someone will be able to teach me what I am doing wrong.
Thank you,
John
# create data frame.
guppy
fract2 <- function(col,data) {
cat("Prove we have passed the data frame\n")
print(data)
# Get the name of the column being processed.
zz<-deparse(substitute(col))
cat("Column being processed\n")
print(zz)
p<-sum(data[,zz]!="")/length(data[,zz])
ret...