Hi,
May be this helps:
dat <- read.table(text="Sample
SFLS01A
SFHS05B",sep="",header=TRUE,stringsAsFactors=FALSE)
dat1 <-
setNames(as.data.frame(do.call(rbind,strsplit(gsub("([[:alpha:]]+)(\\d+)([[:alpha:]]+)","\\1
\\2 \\3",dat$Sample)," ")),stringsAsFactors=FALSE),c("site","tree","rep"))
#or
-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
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,
3 matches
Mail list logo