Message-ID: <D50DD870-D7D8-4040-896A-806C4BE7F8A9@r-project.org>
Date: 2009-10-01T21:36:07Z
From: Simon Urbanek
Subject: Value of SET_STRING_ELT() must be a 'CHARSXP' not a 'character' & 'getEncChar' must be called on a CHARSXP
In-Reply-To: <A1976D4B-18D1-462B-B11C-AC957201EC73@gmail.com>
Saptarshi,
how did you create those lists? Can you send us the code? If not, can
you put up the .RData file? Without a reproducible example this is
hard to debug ...
Thanks,
Simon
On Oct 1, 2009, at 14:26 , Saptarshi Guha wrote:
> Hello,
> I have list of 600K lists, each sublist a list of two elements, the
> first a character, the second a list of six named elements, some
> characters some numrics.
> LISTA (600K) (:= h)
> |__ List of two elements
> |__ Character
> |__ Named List of 6 elements (characters and numerics)
>
> This works,
> sip <- lapply(h,function(r) r[[2]][['sip']])
>
> but I wish to unlist this
>
> sip <- unlist(lapply(h,function(r) r[[2]][['sip']]))
>
> and get the following error:
> Value of SET_STRING_ELT() must be a 'CHARSXP' not a 'list'
> Debugging to find which:
>
> i<-1
> sip <- unlist(lapply(h,function(r) {
> i<<-i+1 #debug messages
> cat(i,"------------------>","\n"); print( r[[2]] ) #debug message
> r[[2]][['sip']]
> }))
>
> [1]Error in print.default(r[[2]]) : 'getEncChar' must be called on a
> CHARSXP
>
>
> Which occurs on the 122,204'th item. All entries r[[2]] are similar
> so I don't know why this happening?
> The strangest thing is that this error never happened a few days ago
> and the same code causes this to occur today.
>
>
> Any ideas would be helpful.
> Regards
> Saptarshi
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>