[R] Converting Data Types

From: Edward Wijaya <ewijaya_at_gmail.com>
Date: Wed, 21 May 2008 11:16:36 +0900


Hi,

How can I convert the matrices to list.

For example I have this snippet:

samples<-mymatrix[1,]
print(samples)

which prints:

     V1 V2 V3 V4 V5 V6
1 103.9 88.5 242.9 206.6 175.7 164.4

How can I convert the object "samples" such that it prints: [1] 103.9 88.5 242.9 206.6 175.7 164.4

The reason I ask this because I can't use the former "samples" object with this function:

llgm <- dgamma(samples, scale=1, shape=2, log = TRUE)

which gives this error:
e 1374Error in dgamma(x, shape, scale, log) :   Non-numeric argument to mathematical function

Regards,
Edward



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 Wed 21 May 2008 - 02:19:56 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 21 May 2008 - 03:30:39 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.

list of date sections of archive