Bert Gunter
Genentech Nonclinical Biostatistics
 
 -----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of phani kishan
Sent: Tuesday, June 22, 2010 8:10 AM
To: David Winsemius
Cc: r-help@r-project.org
Subject: Re: [R] Applying forecast functions to columns in a data frame

Simple operations like mean etc. can be applied
using lapply but not statistical functions.

--NONSENSE!

func <- function(x){
        ##write any function you like
        z <- sin(x^2-2)+rnorm(length(x))
        lm(z~ seq(along=z))
        }
dat <- data.frame(a=1:5,b=rnorm(5))
lapply(dat,func)## could also have been inserted inline


Have you read "An Introduction to R" where these sorts of things are
discussed?




Bert Gunter
Genentech Nonclinical Biostatistics

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to