Is there a way to do this in R? I have data in the form: 57_input 57_output 58_input 58_output etc. can i use a for loop (i in 57:n) that plots only the outputs? I want this to be robust so im not specifying a column id but rather something like c++ code, %s_input, i is that doable in R? Thanks, justin
On Mon, Mar 21, 2011 at 2:03 PM, Justin Haynes <jtor14 at gmail.com> wrote:> Is there a way to do this in R? I have data in the form: > > 57_input ?57_output ?58_input ?58_output ?etc. > > can i use a for loop (i in 57:n) ?that plots only the outputs? ?I want > this to be robust so im not specifying a column id but rather > something like c++ code, > > %s_input, iIt's not entirely clear what you want here but it may help to look at the output of n <- 59 (onms <- paste(57:n, "output", sep="_"))> > is that doable in R? > > Thanks, > justin > > ______________________________________________ > R-help at 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. >
Try this: sprintf("%s_%s", rep(1:58, each = 2), c("input", "output")) On Mon, Mar 21, 2011 at 4:03 PM, Justin Haynes <jtor14 at gmail.com> wrote:> Is there a way to do this in R? I have data in the form: > > 57_input ?57_output ?58_input ?58_output ?etc. > > can i use a for loop (i in 57:n) ?that plots only the outputs? ?I want > this to be robust so im not specifying a column id but rather > something like c++ code, > > %s_input, i > > is that doable in R? > > Thanks, > justin > > ______________________________________________ > R-help at 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O