Search code examples
rrapache

Using summary.lm function in rapache


I have installed rapache and I am trying to fit a linear model inside the R script file. I have configured the RFileHandler in the http.conf. When I am trying to invoke the summary(model) it is giving me a segment fault error ( i see this in the apache log file). I am guessing that it is trying to print to the console and that is why it is failing.

Has anyone encountered a similar problem with R and rapache? I am relatively new to R and summary is doing a lot of things that are not directly exposed as functions so I am hoping I could get it to work

Here is my r script

mydata <- read.table("/home/user/test.csv", header = TRUE, sep = ",")
fit <- lm(y~x1+x2+x3, data = mydata)
setContentType("text/html")
cat('<HTML><BODY>')
cat(summary(fit)$adj.r.squared)
cat('</BODY></HTML>\n')
DONE

if i replace

    cat(summary(fit)$adj.r.squared)

with this

    cat(coef(fit))

it is working!

Thanks Bharani


Solution

  • I finally figured out the problem. Reading the discussion i wrongly libRlapck.so to lapack.so. Looks like that was causing problems. Did a clean install of R again and then modified apache to explicity load the libraries then it all worked Thanks - Bharani