[datatable-help] data.table - grouping character values

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue May 10 19:08:01 CEST 2011


Hi Nicolas,

On Tue, May 10, 2011 at 12:29 PM, Nicolas Servant
<Nicolas.Servant at curie.fr> wrote:
> Thanks a lot. It works but then, do you how I can have access to the
> result !
> For instance :
>>g$V1
>  [1]Error: 'getCharCE' must be called on a CHARSXP

Hmm ... this works for me:


R> dt <- data.table(
  reads=c(
    "1279_1000_530_F3-ad",
    "1279_1000_530_F3-ad",
    "1279_1000_940_F3-ad",
    "1279_1000_940_F3-ad",
    "1279_1018_1051_F3-ad"),

  annot=c(
    "Simple_repeat",
    "LINE",
    "snRNA",
    "snRNA",
    "Simple_repeat"),
  key='reads')

R> g <- dt[, paste(annot, collapse=','), by=reads]
R> g$V1
[1] "Simple_repeat,LINE" "snRNA,snRNA"        "Simple_repeat"

What are you trying exactly?
What is your sessionInfo()?

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact


More information about the datatable-help mailing list