[R] how to used regular expression while reading file

sagarnikam123 sagarnikam123 at gmail.com
Tue Mar 6 14:41:20 CET 2012


i have file as in txt format

@ATTRIBUTE f1996 REAL
@ATTRIBUTE f1997 REAL
@ATTRIBUTE f1998 REAL
@ATTRIBUTE f1999 REAL
@ATTRIBUTE f2000 REAL
@ATTRIBUTE class {-1,1}

@DATA
2.080750,1.099070,0.927763,1.029080,-0.130763,1.265460,-0.43
1.109460,0.786453,0.445560,-0.146323,-0.996316,0.555759,0.29
-0.676530,1.693100,1.559250,1.559980,-0.982179,-1.358510,-1.
0.534396,1.677540,1.489030,0.778605,-0.183776,-1.116850,-1.4
-1.018900,0.511080,0.755641,1.013820,0.529899,0.160440,-0.08
-1.185370,-0.514473,-0.566634,1.224720,0.619244,-0.684713,-0
1.779050,0.423947,0.820696,2.525690,0.666921,0.661346,0.4253
--------------------------------------------------------------------------------------------------------------------------------------------------------------

i want to parse only numbers not starting with @
like

2.080750,1.099070,0.927763,1.029080,-0.130763,1.265460,-0.43
1.109460,0.786453,0.445560,-0.146323,-0.996316,0.555759,0.29
-0.676530,1.693100,1.559250,1.559980,-0.982179,-1.358510,-1.
0.534396,1.677540,1.489030,0.778605,-0.183776,-1.116850,-1.4
-1.018900,0.511080,0.755641,1.013820,0.529899,0.160440,-0.08
-1.185370,-0.514473,-0.566634,1.224720,0.619244,-0.684713,-0
1.779050,0.423947,0.820696,2.525690,0.666921,0.661346,0.4253

& putting numbers only  in array for each line

how should i assess (read)  file


--
View this message in context: http://r.789695.n4.nabble.com/how-to-used-regular-expression-while-reading-file-tp4449889p4449889.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list