Skip to content

How to separate the string?

6 messages · Hemavathi Ramulu, milton ruser, PIKAL Petr

#
Hi

r-help-bounces at r-project.org napsal dne 07.07.2009 09:54:30:
Well, how did you get the data in R? Are they in separated columns of 
data.frame? What do you mean by "separate"?
As Microsoft is more user friendly and uses translated functions in 
language specific versions of Excel I do not have function MID. I suspect 
it takes values from middle of string set by some identifiers. If it is 
the case see

?substr

However I would start with

?read.table

and related read.* functions to get the data into R in appropriate shape.

Regards
Petr
http://www.R-project.org/posting-guide.html
#
Hi

If you have data frame like this

test=data.frame(x=c("abcd", "abc", "abcde"))
than
strsplit(as.matrix(test), "")

makes a list with splitted character vectors. If you want them in data 
frame you would need to combine vectors of unequal length.

However I would try reading your text file with

read.fwf(file, 1)

Regards
Petr


Hemavathi Ramulu <hema.ramulu at gmail.com> napsal dne 07.07.2009 10:36:40:
the
wrote:
suspect
shape.

            
1 day later