[R] Removing Double Quotations After Using Cbind

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Jun 7 01:19:03 CEST 2012


Arrays must all be the same type. Data frame columns may be of differing types. Try to avoid creating a matrix and converting it to a data frame.

 a<- data.frame(name=c(2,2,"X"), value=c(,1:3,2:4), as.is=TRUE)
str(a)
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Joshua Budman <josh.budman at gmail.com> wrote:

>Hi,
>I am trying to process genomics data and the presence of both  
>characters and integers in an array is giving issues. The following is 
>
>an example:
> > a<-array(c(2,2,"X",1:3,2:4),dim=c(3,3))
> > b<-cbind(a[,1],a[,2])
>With the output being:
>      [,1] [,2]
>[1,] "2"  "1"
>[2,] "2"  "2"
>[3,] "X"  "3"
>
>Is there any way for me to remove the quotation marks from every  
>integer/character in the new array? Or, is there a way to create the  
>new array without getting the quotation marks?
>
>Regards,
>Josh
>	[[alternative HTML version deleted]]
>
>______________________________________________
>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