[R] read irregular data set
Marc Schwartz
MSchwartz at MedAnalytics.com
Thu Sep 30 05:13:28 CEST 2004
On Wed, 2004-09-29 at 21:35, Johnny Zhang wrote:
> Hi Friends,
> I have a data set like this
> 1
> 2 3 4 5
> 6 7
> 8 9 10
> Is there a way to read it into R as a row or column vector?
You can use scan(). Presuming that your data above is in a file called
"MyFile.txt":
> MyData <- scan("MyFile.txt")
Read 10 items
> MyData
[1] 1 2 3 4 5 6 7 8 9 10
See ?scan for more information.
HTH,
Marc Schwartz
More information about the R-help
mailing list