Dear R users, I read on the "Introduction to the .C Interface to R" by Peng & Leeuw (http://www.biostat.jhsph.edu/~rpeng/docs/interface.pdf) that it is possible to use a few R functions (such as "dnorm") within C by including the "Rmath.h" header file in your C code: e.g. #include <R.h> #include <Rmath.h> void kernel_smooth(double *x, int *n, double *xpts, int *nxpts, double *h, double *result) { int i, j; double d, ksum; for(i=0; i < *nxpts; i++) { ksum = 0; for(j=0; j < *n; j++) { d = xpts[i] - x[j]; ksum += dnorm(d / *h, 0, 1, 0); } result[i] = ksum / ((*n) * (*h)); } } In the manual "Writing R extensions" there is also a list of special functions which can be called in C. I was wondering whether there is a way to call any other R functions similarly. Is there any documented exemple available somewhere? Thanks a lot for your help, Florent
Calling R functions from C
3 messages · Florent Baty, Jarrett Byrnes, John Fox
I'm curious, I realize there are methods for Type II and III sums of squares, and yet, when I've been constructing models with lm, I've noticed that position of the term of the model has not mattered in terms of its p-value. Does lm use sequential Type I sums of squares, or something else? Thanks! -Jarrett
Dear Jarrett, anova() gives sequential sums of squares (as ?anova.lm says). See Anova() in the car package for something similar to Type II and III sums of squares. I hope this helps, John On Fri, 28 Oct 2005 10:05:39 -0700
Jarrett Byrnes <redbeard at arrr.net> wrote:
I'm curious, I realize there are methods for Type II and III sums of squares, and yet, when I've been constructing models with lm, I've noticed that position of the term of the model has not mattered in terms of its p-value. Does lm use sequential Type I sums of squares, or something else? Thanks! -Jarrett
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/