[R] Using a function with apply Error: undefined columns selected

John Sorkin jsorkin at grecc.umaryland.edu
Fri Apr 8 00:39:37 CEST 2016

I am 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,
# create data frame.
fract2 <- function(col,data) {
  cat("Prove we have passed the data frame\n")
  # Get the name of the column being processed.
  cat("Column being processed\n")
John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing) 

Confidentiality Statement:
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. 

More information about the R-help mailing list