Re: [R] multiple values in one column

2012-04-06 Thread Sarah Goslee
To the best of my knowledge, you can't skip step #2, at least not with using much more complicated work-arounds like including a gsub() step within the call to table, and to everything else you do with those data. Computers are generally better at dealing with normalized data, which is what you're

Re: [R] multiple values in one column

2012-04-06 Thread John D. Muccigrosso
On Apr 6, 2012, at 9:09 AM, John D. Muccigrosso wrote: > I have some data files in which some fields have multiple values. For example > > first last sex major > John Smith M ANTH > Jane DoeF HIST,BIOL > > What's the best R-like way to handle these data (Jane's major in my

Re: [R] multiple values in one column

2012-04-06 Thread Nutter, Benjamin
riginal Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Grimes Sent: Friday, April 06, 2012 11:16 AM To: John D. Muccigrosso Cc: r-help@r-project.org Subject: Re: [R] multiple values in one column John I have to deal with this kind of thin

Re: [R] multiple values in one column

2012-04-06 Thread Ashish Agarwal
How about reading lines and separating out cases having more than one major? For cases having more than one major, process the data to create duplicate rows - one for each major On Fri, Apr 6, 2012 at 8:39 PM, John D. Muccigrosso < intern...@muccigrosso.org> wrote: > I have some data files in whi

Re: [R] multiple values in one column

2012-04-06 Thread Mark Grimes
John I have to deal with this kind of thing too for my class. # Some functions # for ad$Full.name = "Mark Grimes" get.first.name <- function(cell){ x<-unlist(strsplit(as.character(cell), " ")) return(x[1]) } get.last.name <- function(cell){

[R] multiple values in one column

2012-04-06 Thread John D. Muccigrosso
I have some data files in which some fields have multiple values. For example first last sex major John Smith M ANTH Jane DoeF HIST,BIOL What's the best R-like way to handle these data (Jane's major in my example), so that I can do things like summarize the other fields by