[R] Subscripting specified variables in a function

2007-06-26 Thread Zodet, Marc W. (AHRQ)
I'm trying to create a function which will allow me to subset a data set based on values of various specified variables. I also want to then apply some other function(s) (e.g., summary). This is what I've tried so far > test.fx <- function(dta, expvar, expval) { + newdta <- subset(dta

[R] Simulation help

2006-09-20 Thread Zodet, Marc W. (AHRQ)
I'm trying to simulate trend data over a five year period. I want different trend profiles...the simplest being a linear trend. I've been using the following code: patBdta1 <- NULL for(i in 1:100) patBdta1 <- rbind(patBdta1,c(yr1= mean(rbinom(50,1,.50)), yr2 =m

[R] Running/submitting script files

2006-09-07 Thread Zodet, Marc W. (AHRQ)
All: Is there any way to run an R script file (i.e., *.R) from the command prompt in the console window. Ultimately, I'm looking to put such code in a script file so that it can set off other R scripts/programs as needed. Thanks. Marc [[alternative HTML version deleted]]