Tena koe Jessie Lots of ways of doing this. Perhaps the easiest, if your data is formatted as you suggest, is to use substring; e.g., substring(yourData$Sample, 1, 4) should give you the sites.
Otherwise, you might need to investigate regular expressions. HTH ..... Peter Alspach -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jmcable Sent: Tuesday, 18 March 2014 10:13 a.m. To: r-help@r-project.org Subject: [R] Beginner: how to split up character string into different columns Hello, I'm an R beginner and am not sure how to address this question. I've read through tutorials and am still stuck. I have a column in my data called "Sample". The samples are listed as four sites (SFHS, SFLS, NFLS, NFHS) with tree numbers (01 through 23) and replicates per tree (A and B). So, a typical sample name would look like: SFLS01A or SFHS05B. I need to split this column into three columns (site, tree, and rep), but I can't figure this out. Does someone have advice / suggestions? Thanks so much! Jessie -- View this message in context: http://r.789695.n4.nabble.com/Beginner-how-to-split-up-character-string-into-different-columns-tp4686998.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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 provide commented, minimal, self-contained, reproducible code. The contents of this e-mail are confidential and may be ...{{dropped:14}} ______________________________________________ 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 provide commented, minimal, self-contained, reproducible code.