[Rd] Value of SET_STRING_ELT() must be a 'CHARSXP' not a 'character' & 'getEncChar' must be called on a CHARSXP

Saptarshi Guha saptarshi.guha at gmail.com
Thu Oct 1 20:26:50 CEST 2009


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



More information about the R-devel mailing list