Re: [R] Help with data layout - Thanks

2008-07-17 Thread Iain Gallagher
Thanks for all the excellent replies. Iain [[alternative HTML version deleted]] __ 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 p

Re: [R] help with data layout

2008-07-17 Thread jim holtman
Does this do at least the means for you: > x <- read.csv(textConnection("Col1 , Col2 + A, 3 + , 2 + , 3 + B, 4 + , 5 + , 4 + C , 1 + , 4 + , 3"), strip.white=TRUE) > x Col1 Col2 1A3 2 2 3 3 4

Re: [R] help with data layout

2008-07-17 Thread Stephen Tucker
sd A 2.67 0.5773503 B 4.33 0.5773503 C 2.67 1.5275252 - Original Message From: Iain Gallagher <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent: Thursday, July 17, 2008 8:50:42 AM Subject: [R] help with data layout Hello list I have been given some Excel sheets with data laid

Re: [R] help with data layout

2008-07-17 Thread Mike Lawrence
Nice tip on filling missing col1 values. I've always just done the filling in excel by hand. I then use that same hand to smack the person that gave me data in excel format :Op On 17-Jul-08, at 1:19 PM, Erik Iverson wrote: Iain Gallagher wrote: Hello list I have been given some Excel sheet

Re: [R] help with data layout

2008-07-17 Thread Henrique Dallazuanna
Try this: #x <- read.csv('your_file.csv') x$Col1 <- rep(as.character(x$Col1[x$Col1!="" ]), each = unique(diff(which(x$Col1 != "" with(x, sapply(c(sd, mean), function(x)tapply(Col2, Col1, x))) On Thu, Jul 17, 2008 at 12:50 PM, Iain Gallagher <[EMAIL PROTECTED]> wrote: > Hello li

Re: [R] help with data layout

2008-07-17 Thread Erik Iverson
Iain Gallagher wrote: Hello list I have been given some Excel sheets with data laid like this: Col1Col2 A 3 2 3 B 4 5 4 C 1 4 3 I was hoping to import this into R as a csv and then get the mean and SD for each letter in column 1. Could someone give me some guidance

[R] help with data layout

2008-07-17 Thread Iain Gallagher
Hello list I have been given some Excel sheets with data laid like this: Col1Col2 A 3 2 3 B 4 5 4 C 1 4 3 I was hoping to import this into R as a csv and then get the mean and SD for each letter in