开发者

RDF integers in R

I'm loading data through rrdf in my R app. I can handle the URIs开发者_如何学Go no problem, but when it comes to integers I don't know how to convert them into R integers. E.g. 5^^http://www.w3.org/2001/XMLSchema#integer

If I try with

sub( "^^http://www.w3.org/2001/XMLSchema#integer", "5^^http://www.w3.org/2001/XMLSchema#integer" )

But I get Error in is.character(x) : 'x' is missing. Any hint?


I solved it with this R function:

utils.rdfIntToInt <- function( intStr ){
    intValue <- sub("\\^\\^http://www.w3.org/2001/XMLSchema#integer",x=intStr,replacement="")
    return(as.integer(intValue))
}


At the risk of looking foolish: I know of no "^^" in R syntax. What are you trying to do? Can you provide a sample of your data, and explain why you think it isn't in a format that R recognizes as an integer?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜