# [R] The ttest.c example in R under MS Windows

Liaw, Andy andy_liaw at merck.com
Tue Feb 10 15:53:33 CET 2004

```Works just fine for me with the recommended compilers and tools.  Here's a
transcript of the build:

c:\tools\R-1.8.1\src\gnuwin32>Rcmd install windlgs

---------- Making package windlgs ------------
making DLL ...
making ttest.d from ttest.c
gcc   -Ic:/tools/R-1.8.1/src/include -Wall -O2
-Ic:/tools/R-1.8.1/src/gnuwin32/
graphapp  -c ttest.c -o ttest.o
ar cr windlgs.a *.o
ranlib windlgs.a
windres --include-dir c:/tools/R-1.8.1/src/include  -i windlgs_res.rc -o
windlgs
_res.o
gcc  --shared -s  -o windlgs.dll windlgs.def windlgs.a windlgs_res.o
-Lc:/tools
/R-1.8.1/src/gnuwin32  -lg2c -lR
installing DLL
installing R files
installing man source files
installing indices
installing help
>>> Building/Updating help pages for package 'windlgs'
Formats: text html latex example
>>> Building/Updating help pages for package 'windlgs'
Formats: chm
Microsoft HTML Help Compiler 4.74.8702

Compiling c:\tools\R-1.8.1\src\gnuwin32\windlgs\chm\windlgs.chm

Compile time: 0 minutes, 2 seconds
2       Topics
1       Graphic

Created c:\tools\R-1.8.1\src\gnuwin32\windlgs\chm\windlgs.chm, 22,531 bytes
Compression increased file by 8,709 bytes.

And here's the test:
> library(windlgs)
To remove the Statistics menu use del.ttest()
> x <- runif(10)
> y <- runif(20)
[click on `Statistics' from the menu, choose `ttest:1' and fill in.]

Welch Two Sample t-test

data:  x and y
t = 2.1473, df = 22.03, p-value = 0.04303
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
0.007352435 0.422008138
sample estimates:
mean of x mean of y
0.6706490 0.4559688

Andy

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
> Lennart.Borgman at astrazeneca.com
> Sent: Tuesday, February 10, 2004 8:27 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] The ttest.c example in R under MS Windows
>
>
> We are trying to compile and run the ttest.c example that
> comes with R (in
> C:\Program Files\R\rw1081\src\library\windlgs\src\ttest.c).
> After compiling
> it with MS Visual C++ we load the DLL with dyn.load.
>
> So far it seems good, but when we try to call it from R (after running
> C:\Program Files\R\rw1081\src\library\windlgs\R\windlgs.R) R crashes.
>
> We have tried changing the exports from DLL but have failed
> so far. Since I
> have a guy helping me who is fluent in MS Visual C++ I believe we are
> missing something crucial. Have anyone compiled and used the
> example above
> using MS Visual C++? Has anyone done this using the gcc (or
> Mingw) compiler
> on MS Windows?
>
> I would be very glad to find a complete example for compiling under MS
> Windows.
>
>
> - Lennart
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help