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

Nicolas Servant Nicolas.Servant at curie.fr
Tue May 10 19:52:50 CEST 2011


Indeed, your example also works on my session ... it seems to be linked
to one of my reads features.
Because even with my data

>g$V1

 [1]Error: 'getCharCE' must be called on a CHARSXP

>head(g)$V1
[1] "Simple_repeat,LINE" "snRNA,snRNA"        "Simple_repeat"



Finally I found it but data.table really doesn't like it :)
> dt["1335_868_1708_F3-ad"]

 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: `[[<-.data.frame`(`*tmp*`, lc, value = 31239L)
 2: `[[<-`(`*tmp*`, lc, value = 31239L)
 3: `[.data.table`(dt, "1335_868_1708_F3-ad")
 4: dt["1335_868_1708_F3-ad"]

I will check that in details.
Thanks again.
Regards,

Nicolas

> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C             
 [3] LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8   
 [5] LC_MONETARY=C              LC_MESSAGES=fr_FR.UTF-8  
 [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C                
 [9] LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
 [1] data.table_1.6       RColorBrewer_1.0-2   multicore_0.1-5    
 [4] Rsamtools_1.4.0      Biostrings_2.20.0    GenomicRanges_1.4.0
 [7] IRanges_1.10.0       org.Mm.eg.db_2.5.0   RSQLite_0.9-4      
[10] DBI_0.2-5            AnnotationDbi_1.14.0 Biobase_2.12.0     




Steve Lianoglou a écrit :
> 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
>
>   


-- 
Nicolas Servant
Equipe Bioinformatique
Institut Curie
26, rue d'Ulm - 75248 Paris Cedex 05 - FRANCE

Email: Nicolas.Servant at curie.fr
Tel: 01 56 24 69 85
http://bioinfo.curie.fr/



More information about the datatable-help mailing list