[R] Class noquote to matrix

Peter Ehlers ehlers at ucalgary.ca
Wed Mar 30 11:04:06 CEST 2011


On 2011-03-29 19:12, Mark Ebbert wrote:
> Hi,
>
> I apologize if the solution is right in front of me, but I can't find anything on how to convert a class of 'noquote' to 'matrix'. I've tried as.matrix and I've tried coercing it by 'class(x)<-matrix', but of course that didn't work. I've been using the function 'symnum' which returns an object of class 'noquote'.
>
> Here is an example from the 'symnum' help page:
> pval<- rev(sort(c(outer(1:6, 10^-(1:3)))))
>       symp<- symnum(pval, corr=FALSE,
>                      cutpoints = c(0,  .001,.01,.05, .1, 1),
>                      symbols = c("***","**","*","."," "))

One way would be to unclass the object first:

  as.matrix(unclass(symp))

Peter Ehlers

>
> Thanks!
> ______________________________________________
> 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