Re: [R] Function to create variables with prefix

2008-07-17 Thread Moira Burke
Ligges <[EMAIL PROTECTED]> wrote: > Example: > > myfunction <- function(mydata, myvariables, prefix="norm_"){ >newnames <- paste(prefix, myvariables, sep="") > mydata[newnames] <- scale(mydata[myvariables]) >mydata > } &g

[R] Function to create variables with prefix

2008-07-14 Thread Moira Burke
Hi. I'm a new R user and think what I'm trying to do is pretty basic, but haven't been able to find the answer in the mailing list archives. How do I write a function that creates new variables in a given data.frame with a prefix attached to the variable names? I do a lot of repetitive logging a