Matt Munson
Matt Munson

Reputation: 3003

How should I format output for reading into a list of vectors

I have a program that outputs to file an unevenly spaced time series of vectors (one vector per interval) that vary in size . I'm wondering what would be the best way of formatting the output so that the file can be read into a list of vectors in R (Assuming that is the correct data structure), and what code in R i would use to read it.

For example, I imagine the output could look something like this:

1, 24, 5, 211
3, 5
59, 465, 3, 333, 9, 98

or

(1 24 5 211)
(3 5)
(59 465 3 333 9 98)

But what I'm saying is that I want to change the formatting to suite the R read function.

Upvotes: 0

Views: 41

Answers (1)

Sowmya S. Manian
Sowmya S. Manian

Reputation: 3833

Keep fill = TRUE

data = read.table(file.choose(),sep=",",fill=TRUE)

data[is.na(data)] <- ""   # Replacing NA Values with nothing..

Upvotes: 0

Related Questions