From: Rolf Turner <r.turner_at_auckland.ac.nz>

Date: Wed, 16 Apr 2008 11:08:07 +1200

R-help_at_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. Received on Tue 15 Apr 2008 - 23:31:03 GMT

Date: Wed, 16 Apr 2008 11:08:07 +1200

RML: *** Data frames are NOT matrices!!! ***

On 16/04/2008, at 10:35 AM, stephen sefick wrote:

*> x <- read.table("LittleGarvin.csv", sep=",", header=TRUE)
*

> y <- t(x)

*> str(y)
**>
**> chr [1:193, 1:288] "oligocha" "0" " 0" " 0" " 0" "0" ...
**> - attr(*, "dimnames")=List of 2
**> ..$ : chr [1:193] "X" "upwd1201" "upwd0502" "upwd0702" ...
**> ..$ : NULL
**>
**> x is a data frame with a whole bunch of numeric vectors I would
**> like for the
**> rows and columns to be reversed == transposed but with the same
**> attributes.
**> I am trying to feed the transposed data frame to metaMDS(vegan). I am
**> stumped- sorry for the large attached file- I am at a loss.
*

Although it is possible, transposition makes little to no sense for data frames. If you want to transpose something you are thinking of it as being a *matrix* not a data frame. The result of transposing a data frame is in fact a matrix. There is as far as I know no structure in R whereby the rows of a matrix-like object can have different characteristics. (The term ``attributes'' has a technical meaning in R which is probably not what you intend --- but even if you do intend that, it's not possible.) The complaint made in your subject line is that the result of your transposition is not numeric. It is in fact character. That's because there is character data in the data frame x. When you transpose x, it is first coerced into a matrix. If there are any character or factor columns in x the coercion will result in a character matrix, the transpose of which will of course be a character matrix. The solution is of course to remove the character or factor columns from x before transposition. If you ``can't'' do this, then you ***can't*** transpose --- transposition just doesn't make any sense at all. Simple as that. cheers, Rolf Turner ######################################################################Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

R-help_at_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. Received on Tue 15 Apr 2008 - 23:31:03 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 01:30:30 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*