Dear John, Try using sapply(data5NonEventEpochs, fract)
HTH Best, Luisfo Chiroque PhD Student IMDEA Networks Institute http://fourier.networks.imdea.org/people/~luis_nunez/ <http://fourier.networks.imdea.org/people/~luis_nunez/> > El 7 abr 2016, a las 23:25, John Sorkin <jsor...@grecc.umaryland.edu> > escribió: > > > I would like to apply a function, fract, to the columns of a > dataframe. I tried the following > apply(data5NonEventEpochs,2,fract) > but, no surprise it did not work as apply works on matrices not data > frames. How can I apply a fuction to the columns of a data frame? (I > can't covert data5NonEventsEpochs to a matrix as it contains character > data). > Thank you, > John > 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 > GRECC (BT/18/GR) > 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 ...{{dropped:16}} ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.