Hi [EMAIL PROTECTED] napsal dne 05.04.2007 12:50:09:
> Dear R-experts, > > I still have problems with the reading of a matrix. > > Input: matrixData6.txt > > A-Paar B-Paar C-Paar D-Paar E-Paar > A 1 3 5 7 9 > B 2 4 6 8 10 > > > R-commands: > y=read.table(file="Z:/Software/R-Programme/matrixData6.txt") > y > > Result: > A.Paar B.Paar C.Paar D.Paar E.Paar > A 1 3 5 7 9 > B 2 4 6 8 10 > > > If you look into the txt-file you can recognize that the column names > are not the same. Why? > > If I add in the txt-file the line "MyData:" infront of all followed by a > newline. The R-command as above response an error. How can I read the > modified input and get the following result: > > MyData: > > A.Paar B.Paar C.Paar D.Paar E.Paar > A 1 3 5 7 9 > B 2 4 6 8 10 The only difference I can see is centering columns and Mydata: row. This does not have anything with reading your data. You shall instead consult how your data is printed on console by looking at ?print help page. However I think that R itself is not the best tool for text formating. > > Another stupid question might be hows can I change the column and row > names after I made "read.table"? I want to have the following result, > for example: > > MyData: > > G H I J K > M 1 3 5 7 9 > N 2 4 6 8 10 > > I studied all manuals I could find and the help but could not understand > the examples or interpret it right for my case. Did you by chance try ?names or ?rownames Regards Petr > > Thanks for help, > > Corinna > > ______________________________________________ > R-help@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 > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@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 and provide commented, minimal, self-contained, reproducible code.