mika03
2008-Apr-02 14:15 UTC
[R] How to best read in this data / Switching rows and colums
Hi, I have to read in data which looks like this: SeriesA, 5, 5, 5, 5 SeriesB, 8, 5, 8, 8, 7, 10, 2, 7, 3 SeriesC, 5, 5, 8, 4, 7, 7, 4, 5 SeriesD, 5, 9, 5, 4, 2, 3, 10, 1 SeriesE, 7, 10, 9, 5, 8, 6, 10, 9, 5, 10, 4, 3, 2, 10, 8, 8, 10, 10, 10 SeriesF, 1, 2, 1, 5, 1, 7, 5, 7, 7, 3 There are actually much more data points in the data, each line contains between 300 and 500 values. If I use something like this: lc <- read.csv("file", header = FALSE, sep = ",", fill = TRUE) R treats rows as columns and columns as rows. Is there someway to change this bahaviour? Or can i post process the data once I read it in? Thanks a lot! -- View this message in context: http://www.nabble.com/How-to-best-read-in-this-data---Switching-rows-and-colums-tp16447071p16447071.html Sent from the R help mailing list archive at Nabble.com.
Henrique Dallazuanna
2008-Apr-02 17:32 UTC
[R] How to best read in this data / Switching rows and colums
Hi, If I understand: x <- "SeriesA, 5, 5, 5, 5 SeriesB, 8, 5, 8, 8, 7, 10, 2, 7, 3 SeriesC, 5, 5, 8, 4, 7, 7, 4, 5 SeriesD, 5, 9, 5, 4, 2, 3, 10, 1 SeriesE, 7, 10, 9, 5, 8, 6, 10, 9, 5, 10, 4, 3, 2, 10, 8, 8, 10, 10, 10 SeriesF, 1, 2, 1, 5, 1, 7, 5, 7, 7, 3" dat <- t(read.table(textConnection(x), row.names = 1, fill = T, sep = ",")) On Wed, Apr 2, 2008 at 11:15 AM, mika03 <carlmika@yahoo.de> wrote:> > > Hi, > > I have to read in data which looks like this: > > SeriesA, 5, 5, 5, 5 > SeriesB, 8, 5, 8, 8, 7, 10, 2, 7, 3 > SeriesC, 5, 5, 8, 4, 7, 7, 4, 5 > SeriesD, 5, 9, 5, 4, 2, 3, 10, 1 > SeriesE, 7, 10, 9, 5, 8, 6, 10, 9, 5, 10, 4, 3, 2, 10, 8, 8, 10, 10, 10 > SeriesF, 1, 2, 1, 5, 1, 7, 5, 7, 7, 3 > > There are actually much more data points in the data, each line contains > between 300 and 500 values. > > If I use something like this: > > lc <- read.csv("file", header = FALSE, sep = ",", fill = TRUE) > > R treats rows as columns and columns as rows. Is there someway to change > this bahaviour? Or can i post process the data once I read it in? > > Thanks a lot! > > > -- > View this message in context: > http://www.nabble.com/How-to-best-read-in-this-data---Switching-rows-and-colums-tp16447071p16447071.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]