1

With Reference to following to questions already asked on stack overflow

I am trying to achieve the following: Suppose there are data for 2 country

d1 <- data.frame(x=rnorm(100),y=rnorm(100))
d2 <- data.frame(x=rnorm(100),y=rnorm(100))
m1 <- lm(x~y,data=d1);m2 <- lm(x~y,data=d2)
m1.ser <- rawToChar(serialize(m1,NULL,ascii=TRUE))
m2.ser <- rawToChar(serialize(m2,NULL,ascii=TRUE))
res <- data.frame(country=c('c1','c2'),model=c(m1.ser,m2.ser))

After this I want to use write.table to write out the file in text and then push the file to hive. So while writing out to the file because of \n line alignments get disturbed and hence pushing it to hive becomes problematic.

I am also aware of the fact that I can use digest package to serialize

m1.ser1 <- digest(m1,ascii=TRUE)
m2.ser1 <- digest(m2,ascii=TRUE)

But I am not sure how to get the original models m1,m2 back from them. May be I am missing out something very simple.

Any help, pointers will be very much appreciated.

On a different note are this serializations cross-platform? I understand PMML is built exactly for this purpose. But is it possible for other languages like python, java be able to figure out at least the coeffecients and model properties from the R serialization?

Thanks,

4

0 に答える 0