[R] Help in splitting the records

arun smartpink111 at yahoo.com
Mon Nov 26 17:41:49 CET 2012


Hi, 
You could do this: 
Lines<-"qwer$$12$$qwre 
ewrtr$7789$ewwe 
" 
res<-unlist(strsplit(Lines,split="\\$|\n")) 
 as.data.frame(matrix(res[res!=""],nrow=2,byrow=TRUE),stringsAsFactors=FALSE)   
   V1   V2   V3 
#1  qwer   12 qwre 
#2 ewrtr 7789 ewwe 

A.K. 



----- Original Message -----
From: arunkumar1111 <akpbond007 at gmail.com>
To: r-help at r-project.org
Cc: 
Sent: Monday, November 26, 2012 5:51 AM
Subject: [R] Help in splitting the records

Hi

I have set of records seperated by a separator say "$$$" i want to get the
values in a dataframe.

eq

qwer$$12$$qwre
ewrtr$7789$ewwe

I want the output as\

V1       V2    V3
qwer 12 qwre
ewrtr  7789 ewwwe



Please help me






-----
Thanks in Advance
        Arun
--
View this message in context: http://r.789695.n4.nabble.com/Help-in-splitting-the-records-tp4650827.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at 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.





More information about the R-help mailing list