我在我的R应用中通过rrdf加载数据。我可以处理URI,没有问题,但是当涉及到整数时,我不知道如何将它们转换为R整数。例如,5^^http://www.w3.org/2001/XMLSchema#integer
如果我尝试
sub( "^^http://www.w3.org/2001/XMLSchema#integer", "5^^http://www.w3.org/2001/XMLSchema#integer" )但我能给Error in is.character(x) : 'x' is missing.任何提示吗?
发布于 2011-08-30 01:11:29
我用这个R函数解决了这个问题:
utils.rdfIntToInt <- function( intStr ){
intValue <- sub("\\^\\^http://www.w3.org/2001/XMLSchema#integer",x=intStr,replacement="")
return(as.integer(intValue))
}发布于 2011-08-29 22:03:48
冒着看起来很愚蠢的风险:我知道在R语法中没有"^^“。你想做什么?您能提供一个数据示例,并解释为什么您认为它不是R识别为整数的格式吗?
https://stackoverflow.com/questions/7230360
复制相似问题