Using summary.lm function in rapache

6 views
Skip to first unread message

bharani

unread,
Oct 22, 2009, 10:10:41 AM10/22/09
to rapache
I have installed [rapache][1] 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 any one 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


[1]: http://biostat.mc.vanderbilt.edu/rapache/

bharani

unread,
Oct 23, 2009, 1:11:02 AM10/23/09
to rapache
I am sorry i do not think this has something to do with rapache. It is
failing in R itself with core dump

*** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
1: .Call("La_chol2inv", x, size, PACKAGE = "base")
2: chol2inv(Qr$qr[p1, p1, drop = FALSE])
3: summary.lm(fit)
4: summary(fit)
5: cat(summary(fit)$adj.r.squared)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace


-Bharani

bharani

unread,
Oct 23, 2009, 5:18:46 AM10/23/09
to rapache
I finally figured out the problem. Reading the [discussion][1] 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


[1]: https://bugs.launchpad.net/ubuntu/+source/rkward/+bug/264436
Reply all
Reply to author
Forward
0 new messages