Re: [R] 1st script

2015-03-23 Thread William Dunlap
> # Import CSV file into a data frame. > case_weights <- read.csv(file = "case_weights.csv") > > # For each row, take the number in the Weight column and replicate it > # as many times as there are in each count column. > LC09 <- rep(case_weights$Weight, case_weights$LC09) > LC10 <- rep(case_weight

Re: [R] 1st script

2015-03-23 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > memilanuk > Sent: Monday, March 23, 2015 8:41 AM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] 1st script > > On 03/22/2015 10:58 PM, PIKAL Petr wrote: > > >

Re: [R] 1st script

2015-03-23 Thread memilanuk
On 03/22/2015 10:58 PM, PIKAL Petr wrote: use list and numeric indexing. As you did not provide reproducibe example here is possible way. dat <- data.frame(w=abs(rnorm(10)), LC09=round(runif(10)*10), LC10=round(runif(10)*10)) lll <- vector("list", 2) k=0 for(i in 2:3) { k=k+1 lll[[k]] <- rep(

Re: [R] 1st script

2015-03-22 Thread PIKAL Petr
mes(lll)<-names(dat[,2:3]) boxplot(lll) Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > memilanuk > Sent: Monday, March 23, 2015 2:22 AM > To: r-h...@stat.math.ethz.ch > Subject: [R] 1st script > > So... wro

[R] 1st script

2015-03-22 Thread memilanuk
So... wrote my first script, rather than just using the interactive console. I think I got everything working more or less the way I want, but I'm sure there's a ton of room for improvement. Specifically in the way of automation - but thats where I kind of ran out of steam. Any suggestions w