Here I have a variable called "Variable_1".
Variable_1 <- "MyDataFrame"
Here I want to create another variable, by assigning the value of
"Variable_1" .
So, it will come like,
Assign(Variable_1,data.frame(read.csv("c:\\Mydata.csv"))) --->[this
was the 1st requirement, now I got the s
On 08/27/2012 07:29 PM, Rantony wrote:
Hi,
here im unable to run a string handle function called unpaste().
for eg:- a<- "12345_mydata"
Actually my requirement what is i need to get , only 12345. Means that , i
need the all letter as a word which is before of first " _ " - symbol of
"a". i t
Hello,
If the op says he has tried strsplit, maybe a simple subsetting
afterwards would solve it.
a <- "12345_mydata"
strsplit(a, "_")[[1]][1]
Hope this helps,
Rui Barradas
Em 27-08-2012 15:22, jim holtman escreveu:
Is this what you want:
a<- "12345_mydata"
sub("_.*", "", a)
[1] "12345
Is this what you want:
> a<- "12345_mydata"
> sub("_.*", "", a)
[1] "12345"
On Mon, Aug 27, 2012 at 5:29 AM, Rantony wrote:
> Hi,
>
> here im unable to run a string handle function called unpaste().
>
> for eg:- a<- "12345_mydata"
> Actually my requirement what is i need to get , only 12345.
Hi,
here im unable to run a string handle function called unpaste().
for eg:- a<- "12345_mydata"
Actually my requirement what is i need to get , only 12345. Means that , i
need the all letter as a word which is before of first " _ " - symbol of
"a". i tried to do with unpaste, it says functio
Here is a slightly simpler variant of the strapply solution:
> lapply(DF, strapply, "(.)/(.)", c, simplify = rbind)
$var1
[,1] [,2]
[1,] "G" "G"
[2,] "A" "T"
[3,] "G" "G"
$var2
[,1] [,2]
[1,] "C" "T"
[2,] "C" "C"
[3,] "A" "A"
On Fri, Jun 4, 2010 at 8:08 AM, Gabor Grothendieck
w
Thank you guys very much, these help!!
--
View this message in context:
http://r.789695.n4.nabble.com/string-handling-tp2242119p2243388.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.eth
This solution using strapply in gsubfn is along the same lines as the
stringr solution. First we read in the data using as.is = TRUE so
that we get character rather than factor columns. On the other hand,
if your data is already in columns with class factor then just replace
strappy(x, ...) with
On Thu, Jun 3, 2010 at 4:06 PM, Wu Gong wrote:
>
> Hope it helps.
>
> text <- "var1 var2
> 9G/G09 abd89C/T90
> 10A/T9 32C/C
> 90G/G A/A"
>
> x <- read.table(textConnection(text), header = T)
Or with the stringr package:
library(stringr)
str_match(x$var1, "(.)/(.)")
Hadley
--
Hope it helps.
text <- "var1var2
9G/G09abd89C/T90
10A/T932C/C
90G/G A/A"
x <- read.table(textConnection(text), header = T)
x$var1.1 <- sub(".*(.)/.*", "\\1", x$var1)
x$var1.2 <- sub(".*/(.).*", "\\1", x$var1)
x$var2.1 <- sub(".*(.)/.*", "\\1", x$var2)
x$var2.2 <- sub(".*/(.
try this:
> x <- "1234C/Tasdf"
> y <- strsplit(sub("^.*(.)/(.).*", "\\1 \\2", x),' ')[[1]]
> y
[1] "C" "T"
>
On Thu, Jun 3, 2010 at 2:18 PM, karena wrote:
>
> I have a data.frame as the following:
> var1 var2
> 9G/G09 abd89C/T90
> 10A/T9 32C/C
> 90G/G A/A
> . .
> .
I have a data.frame as the following:
var1var2
9G/G09abd89C/T90
10A/T932C/C
90G/G A/A
. .
. .
. .
10T/C 00G/G90
What I want is to get the letters which are on the left and right of '/'.
for example, for "9G/G09", I only want "G", "G",
12 matches
Mail list logo