substr(x,1,3) On Thu, 2010-03-04 at 21:32 -0800, Nick Matzke wrote: > Hi, > > This has got to be easy, but for some reason the simplest things can be > the hardest to find help on in R. > > How the heck do I subset a string? > > e.g., > > x = "abcdef" > > I just want the first 3 characters. > > Cheers! > Nick > > >
-- Simon Blomberg, BSc (Hons), PhD, MAppStat. Lecturer and Consultant Statistician School of Biological Sciences The University of Queensland St. Lucia Queensland 4072 Australia Room 320 Goddard Building (8) T: +61 7 3365 2506 http://www.uq.edu.au/~uqsblomb email: S.Blomberg1_at_uq.edu.au Policies: 1. I will NOT analyse your data for you. 2. Your deadline is your problem. Statistics is the grammar of science - Karl Pearson ______________________________________________ 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.