[R] Converting Data Types
Edward Wijaya
ewijaya at gmail.com
Wed May 21 04:27:16 CEST 2008
Hi Mark,
Doesn't seem to work.
x <- unclass(samples)
print (x)
It prints this instead
$V1
[1] 103.9
$V2
[1] 88.5
$V3
[1] 242.9
$V4
[1] 206.6
$V5
[1] 175.7
$V6
[1] 164.4
attr(,"row.names")
[1] 1
And it gives the same error for dgamma function.
- Edward
On Wed, May 21, 2008 at 11:22 AM, <markleeds at verizon.net> wrote:
> unclass or should work , I think. so
>
> nonames<-unclass(samples)
>
>
>
> On Tue, May 20, 2008 at 10:16 PM, Edward Wijaya wrote:
>
>> 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.
>
More information about the R-help
mailing list