[R] Read a dataset with different lengths
Uwe Ligges
ligges at statistik.uni-dortmund.de
Mon Mar 21 19:03:04 CET 2005
Xiyan Lon wrote:
> Dear useR again,
> How can I read a dataset if lines in dataset did not have same
> elements (have different lengths), For example:
>
> 1 2, 4, 16, 1, 1, 3, 1, 1, 15, 5, 1, 1, 14, 1, 1
> 2 2, 13, 5, 1, 1, 3, 1, 1, 15, 5, 1, 1, 14, 1, 1
> 3 4, 5, 11, 1, 1, 6, 1, 1, 5, 14, 1, 1, 15, 1, 1
> 4 2, 5, 9, 1, 1, 14, 1, 1, 8, 16, 1, 1, 13, 1, 1
> 5 3, 7, 14, 1, 1, 14, 1, 1, 5, 21, 1, 1, 8, 1, 1
> 6 6, 3, 1, 12, 1, 1, 5, 8, 1, 1, 15, 1, 1
> 7 6, 3, 1, 11, 1, 1, 10, 7, 1, 1, 21, 1, 1
> 8 21, 20, 9, 1, 1, 6, 1, 1, 13, 10, 1, 1, 1
> 9 5, 7, 21, 1, 1, 13, 1, 1, 14, 2, 1, 1, 6, 1, 1
> 10 8, 14, 10, 1, 1, 5, 1, 1, 10, 5, 1, 1, 5, 1, 1
> 11 5, 20, 17, 1, 1, 19, 1, 1, 14, 7, 1, 1, 6, 1, 1
> 12 7, 4, 11, 1, 1, 2, 1, 1, 5, 13, 1, 1, 14, 1, 1
> 13 7, 14, 13, 1, 1, 6, 1, 1, 13, 16, 1, 1, 17, 1, 1
> 14 7, 14, 5, 1, 1, 5, 1, 1, 5, 17, 1, 1, 17, 1, 1
> 15 3, 9, 12, 1, 1, 18, 1, 1, 6, 1, 4, 1, 1
> 16 7, 10, 5, 1, 1, 12, 1, 1, 5, 17, 1, 1, 13, 1, 1
> 17 12, 8, 16, 1, 1, 5, 1, 1, 8, 10, 1, 1, 14, 1, 1
> 18 5, 11, 7, 1, 1, 5, 1, 1, 18, 13, 1, 1, 17, 1, 1
> 19 7, 13, 8, 1, 1, 14, 1, 1, 5, 17, 1, 1, 13, 1, 1
> 20 7, 18, 21, 1, 1, 16, 1, 1, 5, 17, 1, 1, 13, 1, 1
>
For data structured as above, read.fwf() should work.
> I know that in BioC package rmutil have a function (read.list) to
> handle different lengths sets of lines but it did not work.
>
>>library(rmutil)
>
> Error in library(rmutil) : 'rmutil' is not a valid package -- installed < 2.0.0?
You have to install a version that has been compiled for R-2.0.x
Uwe Ligges
>
> Are there any others function to handle this.
>
> Best regards
> Xiyan Lon
>
>
>>version
>
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 0.1
> year 2004
> month 11
> day 15
> language R
>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list