[R] vector

Jan Goebel jgoebel at diw.de
Fri Sep 22 20:34:09 CEST 2000


Hi,

just a quick solution, i guess:

b<-scan("file",sep=",")
b<-b[!is.na(b)]

jan

On Fri, 22 Sep 2000, Mehdi Ghafariyan wrote:

> Dear all R users;
> I have a large vector type data in the following
> format :
> 
> 2,3,21,
> 1,3,5,6,17,21,
> 1,2,6,33,34,
> 4,5,
> 2,4,6,7,16,17,26,
> .
> .
> .
> 
> I use the following command to read it:
> 
> b<-scan("a:\\vectorB.txt",sep=",")
> 
> and I get 
> [1]  2  3 21 NA  1  3  5  6 17 21 NA  1  2  6 33 34 NA
>  4  5 NA  2  4  6  7 16
> .
> .
> .
> Is there a way to write the command so that it would
> go to the next line when it reaches end of the line
> instead of producing "NA"s . 
> 
> cheers 
-- 
-----------------------------------
Jan Goebel (mailto:jgoebel at diw.de)

DIW German Institute for Economic Research
SOEP
Königin-Luise-Str. 5
D-14195 Berlin
Germany

phone: 49 30 89789-377
-----------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list