Re: [R] help comparing two median with R

2007-04-18 Thread Prof Brian D Ripley
 nonparametric confidence interval for the median
 (unrelated to Wilcoxon) but none exists for the mean.

 Cheers,
 Frank
 --
 Frank E Harrell Jr   Professor and Chair   School of Medicine
   Department of Biostatistics
 Vanderbilt University

 __
 R-help@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
 and provide commented, minimal, self-contained, reproducible code.

 __
 R-help@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
 and provide commented, minimal, self-contained, reproducible code.


 __
 R-help@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
 and provide commented, minimal, self-contained, reproducible code.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error message when building a package

2007-01-29 Thread Prof Brian D Ripley
Please update your Xcode tools.  According to

http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html

2.2 or later is needed, and 2.4.1 is current.


On Tue, 30 Jan 2007, C. Lillian Yau wrote:

 I'm trying to build a package. The machine is PowerPC G4 with Mac OS 10.4.8,
 and I'm using R2.4.1.

 I get R CMD build roots working, and it created roots.tar.gz. But I get
 the following message when I run R CMD INSTALL -l ../myrlibrary
 roots.tar.gz

 ==
 * Installing *source* package 'roots' ...
 ** libs
 ** arch - ppc
 gcc-4.0 -arch ppc -std=gnu99
 -I/Library/Frameworks/R.framework/Resources/include
 
-I/Library/Frameworks/R.framework/Resources/include/ppc
 -I/usr/local/include-fPIC  -g -O2 -c fifrt.c -o fifrt.o
 gfortran-4.0 -arch ppc   -fPIC  -g -O2 -c fthrt.f -o fthrt.o
 gcc-4.0 -arch ppc -std=gnu99 -dynamiclib -Wl,-macosx_version_min -Wl,10.3
 -undefined dynamic_lookup -single_module -multiply_defined suppress
 -L/usr/local/lib -o roots.so fifrt.o fthrt.o  -lgfortran -lgcc_s
 -lSystemStubs -lmx -lSystem
 -L/Library/Frameworks/R.framework/Resources/lib/ppc -lR -dylib_file
 libRblas.dylib:/Library/Frameworks/R.framework/Resources/lib/ppc/libRblas.dy
 lib
 /usr/bin/libtool: unknown option character `m' in: -macosx_version_min

[...]

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] building R on freebsd 6.2 (amd64)

2007-01-18 Thread Prof Brian D Ripley
On Thu, 18 Jan 2007, Hiroyuki Kawakatsu wrote:

 Hi,

 I updated my os to freebsd 6.2 and built R-patched with no changes in
 configure. I pass make check and copy the R executable to
 /usr/local/bin/R. Then when I start R, I get

 /libexec/ld-elf.so.1: Shared object libRblas.so not found, required by R

 and have to copy/link the two shared object files (libRblas.so and
 libRlapack.so) to somewhere visible like /usr/local/lib/ as well. I
 didn't have to do this last step in freebsd 6.1. Is there some
 configure setting I can use to avoid having to move the two shared
 object files?

The R front end sets LD_LIBRARY_PATH to include the place it puts libR.so. 
It looks like that is not effective on your machine, but you will have to 
investigate for us why.  I am pretty sure other FreeBSD users (6.2 and 7) 
on AMD64 reported success on R 2.4.x.

How does FreeBSD 6.2 handle 64-bit systems?  Most OSes would use 
/usr/local/lib64, and there is a configure setting LIBnn to cover that 
issue.

Another solution for ELF systems is to include R_HOME/lib in the list of 
directories known to ldconfig.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Seeking advice on lattice package in R2.4.0 concerning stripplot

2006-12-15 Thread Prof Brian D Ripley
The problem looks to be that you are specifying the types of symbols in two 
ways:

 pch=c(0,3,6,5),

 points = Rows(trellis.par.get(superpose.symbol),1:4),

The simplest thing to do is to run your code directly on the pdf() device,
but you could experiment with other ways of setting the key.

(We don't have the data, so cannot test these ideas.)

On Sat, 16 Dec 2006, Dr L. Y Hin wrote:

 Dear all,

 I am using the R 2.4.0 environment on Windows XP SP2 machine and trying to 
 use the lattice package version 0.14-9 which you have kindly written to share 
 with the R community.

 I have a question concerning the stripplot which I'd be very
 grateful if you can kindly advise me on:

 I used the dataset called trydata to plot a graph using
 stripplot (dataset attached), and the scripts used to procude the plot is as 
 follows:

 trydata-dget(trydata)
 stripplot(Position~Count|y*Grouping,jitter=T,group=subtype,
 data=trydata,xlab=Count rate (%),
 pch=c(0,3,6,5),
 key=list(text=list(c(GS in front, GS at the back,
 MS in front,MS at the back)),
 points = Rows(trellis.par.get(superpose.symbol),1:4),
 columns=2))

 When I plotted the graph and viewed it on
 R, the legend and the datapoint shapes are
 correct. However, when I export it into .pdf
 form using the pulldown menu in R, the legend for GS in front is incorrect. 
 Instead if being a prism, it became
 a circle. How can I get around this?
 I've attached the figure thus generated in pdf form
 for your kind consideration.

 Specifically, how can I modify the specifications in the
 command to produce the correct pch type in the legend as in the chart itself?

 Thank you very much in advance for your kind advice.

 Best
 Lin


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] *** caught segfault *** error

2006-12-01 Thread Prof Brian D Ripley
On Fri, 1 Dec 2006, Juanjo Abellan wrote:

[...]

 Sorry, I didn't understand the issue about the locale and the C locale that 
 Prof Ripley mentioned. Where could I learn about that?

In the R-admin manual (but Roger will understand).

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Install bioconductor

2006-11-11 Thread Prof Brian D Ripley
You are missing both the library and headers for what would be called 
either zlib or libz.  (On an RPM-based system it would be zlib-devel that 
is missing.)

However, this is the wrong list for questions anout installing BioC 
packages: please see the R posting guide.  (And probably the packages 
should check for the headers like zlib.h as well as for -lz, something 
which is best discussed on the BioC list.)

On Sat, 11 Nov 2006, David Hajage wrote:

 Hello useRs,

 I'm trying to install bioconductor on ubuntu edgy eft and R 2.4.0.

 I have some error messages during installation, in particular for the
 package affy :

 Error: package 'affy' required by 'makecdfenv' could not be found

 I have tryed to install 'makecdfenv' with the command :

 getBioC(makecdfenv)

 But I have this message :

 Running getBioC version 0.1.8 with R version 2.4.0
 Running biocinstall version 1.9.9 with R version 2.4.0
 Your version of R requires version 1.9 of Bioconductor.
 Avis dans install.packages(pkgs = pkgs, repos = repos, dependencies =
 dependencies,  :
argument 'lib' is missing: using /usr/local/lib/R/site-library
 also installing the dependencies 'affy', 'affyio'

 essai de l'URL '
 http://bioconductor.org/packages/1.9/bioc/src/contrib/affy_1.12.1.tar.gz'
 Content type 'application/x-gzip' length 1370295 bytes
 URL ouverte
 ==
 downloaded 1338Kb

 essai de l'URL '
 http://bioconductor.org/packages/1.9/bioc/src/contrib/affyio_1.2.0.tar.gz'
 Content type 'application/x-gzip' length 57410 bytes
 URL ouverte
 ==
 downloaded 56Kb

 essai de l'URL '
 http://bioconductor.org/packages/1.9/bioc/src/contrib/makecdfenv_1.12.0.tar.gz
 '
 Content type 'application/x-gzip' length 3222836 bytes
 URL ouverte
 ==
 downloaded 3147Kb

 * Installing *source* package 'affyio' ...
 creating cache ./config.cache
 checking how to run the C preprocessor... cc -E
 checking for main in -lz... no

[etc]


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Adding predicted values as a new variable in a data frame

2006-09-14 Thread Prof Brian D Ripley
?na.exclude should help you: my guess is that you asked (by using the 
default) na.action = na.omit) for rows with missing values to be excluded 
from the residuals. But since you have not mentioned missing values, we 
have to guess what 'for some reason' was: please note the footer of this 
messag.

On Thu, 14 Sep 2006, Robi Ragan wrote:

 I am running a regression:

 ols.reg1 - lm(y ~ x1 + x2 + x3 + x4)

 on a data.frame

Hmm, no data frame is mentioned: you want a data= argument.

 and then generating fitted values:

 y.hat - ols.reg1$fitted.values

Please use the accessor functions and not dive into the internal details, 
e.g.

y.hat - fitted(ols.reg1)

BTW: where did you get the use of ols.reg1$fitted.values from?

 Then I would like to add these fitted values to the data.frame as a
 new variable. The problem is that when the values are predicted the
 resulting output has too few rows. for some reason certian
 observations do not get predicted values. So this shrinks the column
 down and I then cannot combine the output into the original
 data.frame.

fit - lm(formula, data=data_frame, na.action=na.exclude)
data_frame$fitted - fitted(fit)

 If someone could please help I would apreciate it. Stata automatically
 adds a new column to the data set when you find the fitted values. So
 having to fight with R just to do something I used to routimely do has
 made me think of turning back to the dark side. I hope I have just
 missed something trival in all the help files I have been
 looking through.

The above looks trivial to me.  It was not in R or S when lm was first 
introduced (1991 White Book), but was added last century (thanks to the 
ideas and persistent advocacy of Terry Therneau).

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem setting options(error=recover) in my Rprofile.site

2006-09-14 Thread Prof Brian D Ripley
On Thu, 14 Sep 2006, Marcus, Jeffrey wrote:

 I'd like to be able to set options(error=recover) in my Rprofile.site file.
 When I do this I get the message
 Error in options(error = recover) : object recover not found

 I assume this is because the utils package (where recover and dump.frames
 are defined) has not been loaded at the time I make this call.

 I suppose I could explicitly do library(utils) before setting the
 options even though it will be loaded again when the default packages are
 loaded.

It will not be loaded again.

 Any simpler suggestions of how to get options(error=recover) set
 automatically every time I start R?

options(error=utils::recover)

 More generally, is there a way to have code executed on startup but *after*
 the default packages are loaded?

Load the default packages yourself in your startup code, by calling 
.First.sys() (and resetting it to avoid the slight overhead of subsequent 
require() calls if you want).

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Parameterization puzzle

2006-07-21 Thread Prof Brian D Ripley
On Fri, 21 Jul 2006, Berwin A Turlach wrote:

 G'day all,

 BDR == Prof Brian Ripley [EMAIL PROTECTED] writes:

BDR R does not know that poly(age,2) and poly(age,1) are linearly
BDR dependent.
 Indeed, I also thought that this is the reason of the problem.

BDR (And indeed they only are for some functions 'poly'.)
 I am surprised about this.  Should probably read the help page of
 'poly' once more and more carefully.

My point was perhaps simpler: if you or I or Murray had a function poly() 
in our workspace, that one would be found, I think.  (I have not checked 
the ramifications of namespaces here, but I believe that would be the 
intention, that formulae are evaluated in their defining environment.)  So 
omly when the model matrix is set up could the linear dependence be known 
(and there is nothing in the system poly() to tell model.matrix).

What is sometimes called extrinsic aliasing is left to the fitting 
function, which seems to be to do a sensible job provided the main effect 
is in the model.  Indeed, including interactions without main effects (as 
Murray did) often makes the results hard to interpret.

BDR I cannot reproduce your example ('l' is missing), [...]
 My guess is that 'l' is 'pyears'.  At least, I worked under that
 assumption.

Apparently l = log(pyears), which was my uncertain guess.

 Interestingly, on my machine (using R 2.3.1, 2.2.1 and 2.1.1) I cannot
 fit any of the Poisson GLM that Murray tried.  I always get the error
 message:

 Error: no valid set of coefficients has been found: please supply starting 
 values

Related to the offset, I believe.


 But I have to investigate this further.  I can fit binomial models
 that give me similar answers.

BDR [...] but perhaps
BDR glm(deaths ~ poly(age,2) + poly(age,1)*Smoke + offset(l),
BDR poisson)
BDR was your intention?
 In this parameterisation a 'poly(age,1)' term will appear among the
 coefficients with an estimated value of NA since it is aliased with
 'poly(age, 2)1'.  So I don't believe that this was Murray's intention.

 The only suggestion I can come up with is:

 summary(glm(cbind(deaths, l-deaths) ~ age*Smoke+I(age^2), family=binomial))

 [...]

 Coefficients:
  Estimate Std. Error z value Pr(|z|)
 (Intercept)  -10.798950.45149 -23.918   2e-16 ***
 age2.378920.20877  11.395   2e-16 ***
 SmokeYes   1.445730.37347   3.871 0.000108 ***
 I(age^2)  -0.197060.02749  -7.168  7.6e-13 ***
 age:SmokeYes  -0.308500.09756  -3.162 0.001566 **

 [...]

 Which doesn't use orthogonal polynomials anymore.  But I don't see how
 you can fit the model that Murray want to fit using orthogonal
 polynomials given the way R's model language operates.

 So I guess the Poisson GLM that Murray wants to fit is:

glm(deaths~ age*Smoke+I(age^2)+offset(l), family=poisson)

 Cheers,

Berwin

 == Full address 
 Berwin A Turlach  Tel.: +61 (8) 6488 3338 (secr)
 School of Mathematics and Statistics+61 (8) 6488 3383 (self)
 The University of Western Australia   FAX : +61 (8) 6488 1028
 35 Stirling Highway
 Crawley WA 6009e-mail: [EMAIL PROTECTED]
 Australiahttp://www.maths.uwa.edu.au/~berwin



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] failed installing rgl

2006-07-21 Thread Prof Brian D Ripley

On FC5:

roc% rpm -q --file /usr/include/GL/glu.h
mesa-libGLU-devel-6.4.2-6.FC5.3

Do check what the R-admin manual says about -devel RPMs.


On Thu, 20 Jul 2006, James Foadi wrote:


Dear all,
I have tried installing rgl with the usual command:

R CMD INSTALL rgl_0.67-2.tar.gz

Differently from what happened last time I have succesfully installed this
package, this time there was a failure:

...
...g++ -I/usr/lib/R/include -I/usr/lib/R/include -I -DHAVE_PNG_H
-I/usr/include/libpng12 -I/usr/local/include   -fpic  -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -c api.cpp -o api.o
In file included from glgui.hpp:9,
from gui.hpp:11,
from rglview.h:10,
from Device.hpp:11,
from DeviceManager.hpp:9,
from api.cpp:14:
opengl.hpp:23:20: error: GL/glu.h: No such file or directory
Disposable.hpp:13: warning: ÿÿstruct IDisposeListenerÿÿ has virtual functions
but non-virtual destructor
types.h:77: warning: ÿÿclass DestroyHandlerÿÿ has virtual functions but
non-virtual destructor
gui.hpp:56: warning: ÿÿclass gui::WindowImplÿÿ has virtual functions but
non-virtual destructor
gui.hpp:90: warning: ÿÿclass gui::GUIFactoryÿÿ has virtual functions but
non-virtual destructor
pixmap.h:39: warning: ÿÿclass PixmapFormatÿÿ has virtual functions but
non-virtual destructor
api.cpp: In function ÿÿvoid rgl_user2window(int*, int*, double*, double*,
double*, double*, int*)ÿÿ:
api.cpp:707: error: ÿÿgluProjectÿÿ was not declared in this scope
api.cpp: In function ÿÿvoid rgl_window2user(int*, int*, double*, double*,
double*, double*, int*)ÿÿ:
api.cpp:735: error: ÿÿgluUnProjectÿÿ was not declared in this scope
make: *** [api.o] Error 1
chmod: cannot access `/usr/lib/R/library/rgl/libs/*': No such file or
directory
ERROR: compilation failed for package 'rgl'
** Removing '/usr/lib/R/library/rgl'
...
...

It is clear that glu.h cannot be found during installation and, indeed, I have
checked and there is no glu.h under /usr/include/GL.

Any suggestion on how I could proceed?
I am using FEDORA CORE 5.
By typing glxinfo it seems that glu 1.3 is installed. But where's glu.h, then?

Many thanks

J

--
Dr James Foadi
Department of Physics
University of York
York YO10 5DD

email: [EMAIL PROTECTED]
Tel: 0044 1904 434622
Mobile: 0044 7740 678548


___
All New Yahoo! Mail ? Tired of [EMAIL PROTECTED]@! come-ons? Let our SpamGuard 
protect you. http://uk.docs.yahoo.com/nowyoucan.html




--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] install RMySQL under Mac OS X 10.4.7

2006-07-05 Thread Brian D Ripley
If this is R as installed from CRAN, it is by default looking for a binary
and not a source package.

Please study the `R Installation and Administration' manual.

On Wed, 5 Jul 2006, Luo Weijun wrote:

 Hello All,

 I tried to install RMySQL package, but the error
 messages says there is no such package, even though I
 did see RMySQL is there in the contributed package
 list in all mirror sites of CRAN I tried. Not sure
 what is the problem.

  mysql.home - '/usr/local/mysql'
 
 Sys.putenv('PKG_CPPFLAGS'=paste('-I',file.path(mysql.home,'include'),sep=''))

 
 Sys.putenv('PKG_LIBS'=paste('-L',file.path(mysql.home,'lib'),'
 -lmysqlclient',sep=''))
  install.packages('RMySQL', repos =
 http://www.biometrics.mtu.edu/CRAN/,dependencies =T)
 dependency ''RMySQL'' is not available
  install.packages('RMySQL', repos =
 http://www.biometrics.mtu.edu/CRAN/;)
 Warning in download.packages(pkgs, destdir = tmpd,
 available = available,  :
  no package 'RMySQL' at the repositories

 I tried download the package manually under unix, and
 install it from within R, and no luck too.

 cd ~/download/R
 curl -O
 http://www.biometrics.mtu.edu/CRAN/src/contrib/RMySQL_0.5-7.tar.gz

And where did you run R from?  I think you needed to give a full path here


  install.packages( 'RMySQL_0.5-7.tar.gz', repos =
 NULL)
 Error in gzfile(file, r) : unable to open connection
 In addition: Warning message:
 cannot open compressed file
 'RMySQL_0.5-7.tar.gz/DESCRIPTION'
 

  sessionInfo()
 Version 2.3.0 (2006-04-24)
 powerpc-apple-darwin8.6.0

 attached base packages:
 [1] methods   stats graphics  grDevices
 utils datasets
 [7] base


 could anybody tell me what happens here, and how to
 fix the problem? Thank you so much!
 Weijun

 __
 R-help@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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] R and Java

2006-05-09 Thread Brian D Ripley
On Tue, 9 May 2006, Erin Hodgess wrote:

 Dear R People:

 Where are the rJava and SJava packages, please?

 I looked for them to download but they are nowhere to be found.

rJava is on CRAN:

http://cran.r-project.org/bin/windows/contrib/2.3/rJava_0.4-1.zip

(The capitalization can cause this to sort in unexpected ways, so you can
miss it in a list.)

 Do they have their own list serves, please?

SJava is part of Omegahat, at

http://www.omegahat.org/RSJava/

I think that there is no Windows binary currently available: if there
were, it would be at http://www.omegahat.org/R/bin/windows/contrib/2.3/
and accessible by choosing Omegahat as a repository from the Packages |
Select Repositories menu.

rJava was a page at http://stats.math.uni-augsburg.de/rJava/

 R Windows 2.3.


 Thanks in advance!


 Sincerely,
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: [EMAIL PROTECTED]

 ___

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] How to access results of survival analysis

2006-05-08 Thread Prof Brian D Ripley
The solution is to use a separate function to do this (and call it from the 
print method).


On Mon, 8 May 2006, Heinz Tuechler wrote:


At 12:55 07.05.2006 +0100, Prof Brian Ripley wrote:

On Sun, 7 May 2006, Heinz Tuechler wrote:


Hello Xiaochun Li!

Thank you for submitting the function. At the time I had that problem I
solved it in a somewhat different way.
I changed a few lines in the print.survfit method. I introduced a parameter
ret.res=FALSE set to false to preserve the normal behaviour of print.
The second last line invisible(x) I changed to:

if (ret.res)
invisible(list(x,x1))
else
invisible(x)

So print.survfit returned the results. Of course, Your method has the
advantage to work as long as the output structure of print.survfit does not
change. At the end I would prefer the original function to be changed and
when I find the time I will submit a worked proposal to Thomas Lumley, the
maintainer of the survival package. In that way it would be available also
in future versions of survival.


But all print() methods are required to return their first argument
unchanged, so

foo
print(foo)

do the same thing.  See ?print.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595



I see that my proposal is against the rules.
So what would be a correct solution? Using the (expanded) example from
Xiaochun Li, you see that print(fit1) does not _simply_ print its first
argument, but calculates the median and its confidence interval.
What would be the correct way to access these values?

# example:

library(survival)

fit1 - survfit(Surv(time, status) ~ 1, data=aml)
print(fit1)

Call: survfit(formula = Surv(time, status) ~ 1, data = aml)

 n  events  median 0.95LCL 0.95UCL
23  18  27  18  45




smed - function(x) {
   ox - capture.output(print(x))
   n - length(ox)
   tmp - t(sapply(ox[4:n],
   function(l) strsplit(l, split=' +')[[1]]))
   nres - strsplit(ox[3],split=' +')[[1]][2:6]
   res - matrix(as.numeric(tmp[,2:6]), ncol=5,
   dimnames=list(tmp[,1], nres))
   res
}

sf1 - smed(fit1)
sf1

Lacking experience in R-programming, my personal opinion is that
calculations like the median and the confidence interval should not be only
side effects of a print command but accessible result objects of a
corresponding function.

Heinz Tüchler





--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@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

Re: [R] error in color-labeling in plot.lm

2006-05-08 Thread Prof Brian D Ripley
On Mon, 8 May 2006, Ulrich Halekoh wrote:

 I want to label groups of points in
 the plot of residuals against predicted values
 generated by plot.lm().

 Labelling the points by color

 x-1:15
 y-rnorm(15)
 f-factor(rep(c(1:3),each=5))
 g-glm(y~x)
 plot(g,which=1,col=c(1,2,3)[f])


 I receive the error message

 Error in title(main, sub, xlab, ylab, line, outer, ...) :
graphical parameter col has the wrong length

 How can I resolve the error?

Well, the help does say


  ...: other parameters to be passed through to plotting functions.

and it really is unclear what you intended 'col' to refer to.  But as 
title() is not going to make use of it, it should accept it.  I'll see if I 
can adapt it suitably.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] Link to useR! 2006 from ww.r-project.org not working

2006-05-03 Thread Prof Brian D Ripley
Yes, this has been reported to the webmasters (not really much point in 
telling a list).

cran.r-project.org and www.r-project.org now point at machines at 
wu-wien.ac.at (the DNS was changed in the last 24 hours).  I have also 
found that rsync is not being allowed through (e.g. for 
tools/rsync-recommended) and ftp cannot see the R data area.  Doubtless it 
will all be back to normal in a day or two.

On Wed, 3 May 2006, Pfaff, Bernhard Dr. wrote:

 I noticed that:

 http://www.r-project.org/useR-2006/

 seems to be inexistent (page not found).

Try

http://www.ci.tuwien.ac.at/Conferences/useR-2006/


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] Mixture normal distribution

2006-02-08 Thread Brian D Ripley
We did get your previous message.  See the posting guide about what to do
if you do not get an answer.

See MASS4, chapter 16 (and see the FAQ for what MASS4 is) for fitting
mixtures of normals and testing their fit.

 I want to know how to read the data to txt file.

What does that mean?  (You 'read from' or 'write to'.)

On Wed, 8 Feb 2006 [EMAIL PROTECTED] wrote:

 Dear R helper,


 I hope that u can help me to sort out my problem
 because I sent an E-mail last night to R-list but I
 have not receive any help and at the same time I think
 this problem is not so hard.

 I have used the following functions before

  K-10
  prime-c(2,3,5,7,11,13,17)
  UN-seq(1:K)%*%t(sqrt(prime))
  U1-UN-as.integer(UN)
  U-matrix(qnorm(U1),K,7)
  U

 [,1][,2][,3][,4]
  [,5]   [,6]
  [1,] -0.2167193  0.61902728 -0.71900806  0.37387492
 -0.47715805  0.2677426
  [2,]  0.9479680 -0.09010569 -0.06990169 -0.54900030
 0.34047235 -0.8026015
  [3,] -0.6978334 -0.85544499  0.54814530  1.53212280
 1.64363675  0.9026864
  [4,]  0.4038929  1.46253909  1.59168198  0.20958766
 -0.62343558 -0.1962555
  [5,] -1.4678844  0.41315654 -0.91407055 -0.74294809
 0.20989183 -1.9148412
  [6,] -0.0369025 -0.27331681 -0.21109168  1.14796196
 1.28012119  0.3406266
  [7,]  1.2786790 -1.15348516  0.39201340  0.05080407
 -0.78449952 -0.7099779
  [8,] -0.4853656  1.06431267  1.21882042 -0.97005119
 0.08280907  1.0127500
  [9,]  0.6065405  0.22357828 -1.15223725  0.88440727
 1.03481830 -0.1257587
 [10,] -1.0707736 -0.46627852 -0.35664238 -0.10670096
 -0.96909898 -1.5936006
  [,7]
  [1,] -1.15960110
  [2,] -0.68646092
  [3,] -0.33366316
  [4,] -0.01899511
  [5,]  0.29375681
  [6,]  0.63913903
  [7,]  1.08816734
  [8,]  2.16601566
  [9,] -1.23750068
 [10,] -0.73537275


 Now I want instead of using (qnorm) the inverse of
 slandered normal distribution, I want to use the
 mixture of normal distribution, and also, I want to
 know how to read the data to txt file.


 Many thanks for your help in advance.

 Al-Eid


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] difference between rnorm(1000, 0, 1) and running rnorm(500, 0, 1) twice

2006-02-08 Thread Brian D Ripley
On Wed, 8 Feb 2006, Duncan Murdoch wrote:

 On 2/8/2006 4:53 AM, Bj?rn-Helge Mevik wrote:
  Why don't you test it yourself?
 
  E.g.,
 
  set.seed(42)
  bob1 - rnorm(1000,0,1)
  set.seed(42)
  bob2 - rnorm(500,0,1)
  bob3 - rnorm(500,0,1)
  identical(bob1, c(bob2, bob3))
 
  I won't tell you the answer. :-)

 This isn't really something that can be proved by a test.  Perhaps the
 current implementation makes those equal only because 500 is even, or
 divisible by 5, or whatever...

 I think the intention is that those should be equal, but in a quick
 search I've been unable to find a documented guarantee of that.  So I
 would take a defensive stance and assume that there may be conditions
 where c(rnorm(m), rnorm(n)) is not equal to rnorm(m+n).

 If someone can point out the document I missed, I'd appreciate it.

It's various source files in R_HOME/src/main.

Barring bugs, they will be the same.  As you know

R is free software and comes with ABSOLUTELY NO WARRANTY.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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

Re: [R] User error (was arima.sim bug?)

2005-10-04 Thread Brian D Ripley
On Tue, 4 Oct 2005, Rolf Turner wrote:


 Brian Ripley wrote (in response to S. E. Kemp):

   I am using the arima.sim function to generate some AR time series.
   However, the function does not seem to produce exactly the same time
   series when I specify the innov parameter. For example
   snip
   Given the fact that I have provided the innovations shouldn't the time
   series be exactly the same?
 
  No.  Hint: where does the randomness for the burn-in come from?

   What then, pray tell, is the point of having the
   ``innov'' argument at all?

To allow non-Gaussian innovations, in particular for use in bootstrapping
time series.  (This started life in package boot and is used in
example(tsboot).)

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] R CMD build produces tar error under FreeBSD 5.4

2005-09-25 Thread Prof Brian D Ripley
On Sun, 25 Sep 2005, Andrew Robinson wrote:

 On Sun, Sep 25, 2005 at 12:07:02PM +0100, Prof Brian Ripley wrote:
  On Sun, 25 Sep 2005, Andrew Robinson wrote:
 
   I have constructed a package using package.skeleton(), when I try
  
   $ R CMD build foo
   * checking for file 'foo/DESCRIPTION' ... OK
   * preparing 'foo':
   * checking DESCRIPTION meta-information ... OK
   * cleaning src
   * removing junk files
   tar: Option -L is not permitted in mode -x
   Error: cannot open file 'foo/DESCRIPTION' for reading
  
   foo/DESCRIPTION exists and the permissions are correct. The same
   command works under Linux Fedora 2.  The man pages on each OS imply
   that tar differs across the two platforms.  Does anyone have any
   thoughts on a work-around?
 
  No, because R does not use tar -L (which is to do with tape lengths on GNU
  tar).
 
  It does use tar chf and tar xhf.  The h modifier would appear to be
  applicable only to dumps, so at a wild guess the error message means -h is
  not permitted.  Try replacing xhf by xf.

 Yes, that works.  For the record: I removed the 'h' options from all
 tar calls in

You do in principle want them for the chf calls.


 /usr/local/lib/R/bin/build

 Thanks for your speedy and accurate response.

 Andrew

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] Help: lda predict

2005-08-27 Thread Brian D Ripley
On Sat, 27 Aug 2005, Shengzhe Wu wrote:

 Hello,

 I use qda (package MASS) to obtain an object. If there is any
 function to plot density plot of qda object with one dimension$B!)(B

That makes no sense.  qda objects do not have a density.

Please do study the background material (as you have been repeatedly asked
to do).

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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

Re: [R] Error in contrasts in step wise regression

2005-06-27 Thread Prof Brian D Ripley
On Mon, 27 Jun 2005, Young Cho wrote:

 Thanks for the reply. I created a new dataframe and ran step on it. But, 
 still it does not work.

  detach(dat)
  attach(ds)
  dat - ds[,sapply(ds,nlevels)=2]
  dat$Y - Response
  detach(ds)
  attach(dat)
  fmla - as.formula(paste( ~ 
  ,paste(collist1[sapply(ds,nlevels)=2],collapse=+)))
  fit.s - step(fit.1, direction=forward,scope=list(upper= fmla,lower= ~1))
 Start:  AIC= -1651.18
  Y ~ 1
 Error in contrasts-(`*tmp*`, value = contr.treatment) :
 contrasts can be applied only to factors with 2 or more levels
 

R does have debugging tools: please use them.

 Also, I was wondering if you know why the followings behave differently
 from the above:

Yes, as I have read the help page for step().  Have you?  It is discussed
there.

  fit.s - step(lm(Y~1),scope=list(upper=~.,lower=~1),)
 Start:  AIC= -1651.18
  Y ~ 1
  fit.s - step(fit.1,scope=list(upper=~.,lower=~1),)
 Start:  AIC= -1651.18
  Y ~ 1

 I thought ~. uses all other variables in the data frame according to
 Introduciton to R.

In contexts where there is a data frame and there is no more specific
documentation, it means `all remaining variables separated by +'.


 -Young.


 Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Fri, 24 Jun 2005, Young Cho wrote:

  Hi,
 
  I have a problem in getting step function work.

 This is not coming from step(), but (AFAIK) from model.matrix() called by
 lm(). One way to debug it is to try fitting the models directly.

  I am getting the following error:
 
  fit1 - lm(Response~1)
  fmla - as.formula(paste( ~ ,paste(colnames,collapse=+)))
  sfit - step(fit1,scope=list(upper= fmla,lower= ~1),k=log(nrow(dat)))
  Start: AIC= -1646.66
  Response ~ 1
  Error in contrasts-(`*tmp*`, value = contr.treatment) :
  contrasts can be applied only to factors with 2 or more levels
 
  But if i count the unique values in each column by
 
  A - NULL
  for (ii in 1:length(colnames)){
  A[ii] - length(unique( eval(parse(text=paste('dat$',colnames[ii])
  }
 
  I do not see any column with only 1 value. Is there some other possible
  reason why I am getting the error? Thanks a lot!

 It says `levels', not values. So try

 sapply(dat, nlevels)

 The values can include NA, which is not a level (usually). E.g.

  x - factor(c(1, NA))
  nlevels(x)
 [1] 1
  length(unique(x))
 [1] 2

 (Incidentally, you are assuming variables are found in dat, and you should
 use

 lm(Response ~ 1, data=dat)

 to ensure that. And your calculation can be done more legibly as

 sapply(dat, function(x) length(unique(x)))

 .)

 --
 Brian D. Ripley, [EMAIL PROTECTED]
 Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel: +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UK Fax: +44 1865 272595


 -
 Yahoo! Sports
  Rekindle the Rivalries. Sign up for Fantasy Football

__
R-help@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


Re: [R] modifications to text.tree function

2005-05-12 Thread Brian D Ripley
Is this from package tree?  If so treeco is in the namespace but not
exported.

 library(tree)
 ls(asNamespace(tree))
 [1] cv.treedata.tree  descendants
 [4] deviance.tree  labels.treemisclass.tree
 [7] model.frame.tree   na.tree.replacenode.match
[10] partition.tree plot.tree  plot.tree.sequence
[13] pred1.tree predict.tree   print.summary.tree
[16] print.tree prune.misclass prune.tree
[19] residuals.tree snip.tree  summary.tree
[22] text.tree  tile.tree  tree
[25] tree.control   tree.depth tree.matrix
[28] tree.screens   treeco treepl

so try e.g. tree:::treeco.

On Thu, 12 May 2005, Alexander Sirotkin wrote:

 Hi.

 I have to make some minor modifications to the text.tree function - I
 don't like the way it prints the split labels (they are too long in my
 case and overlap). I tried to make s simple modification to the
 text.tree function so that it will limit the number of significant
 digits in tree labels, but could not - the original function uses some
 undocumented treeco function, which I can not find.

 Any ideas ? Thanks.
 --
 Alexander Sirotkin

 __
 R-help@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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] programming conventions

2005-04-01 Thread Brian D Ripley
On Thu, 31 Mar 2005, Sebastian Luque wrote:

 I'm trying to make my R scripts more readable by others, so I searched for
 some R programming conventions and found the following two:

 - http://www.ci.tuwien.ac.at/Conferences/useR-2004/Keynotes/Maechler.pdf
 - http://www.maths.lth.se/help/R/RCC

 the latter being quite extensive. Are there some other sources that might
 be useful?

`Writing R Extensions'.

Layout is by far the most common cause of hard-to-read code.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] about get stdout from other program

2005-04-01 Thread Brian D Ripley
On Fri, 1 Apr 2005, Michael S wrote:

 if I want to use stdout from other language as my R program input ,which is
 the best way for design the API,using Pipe function or produce a temporary
 file,using scan function to read the file ?

A file for portability, since pipes do not work well on Windows 9x.

A pipe or fifo if you want to wait on output from another program.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


RE: [R] how i can get input from user input

2005-03-31 Thread Brian D Ripley
On Thu, 31 Mar 2005, Martin Maechler wrote:

  BertG == Berton Gunter [EMAIL PROTECTED]
  on Wed, 30 Mar 2005 10:09:38 -0800 writes:

 BertG If you are on Windows and want to go GUI, see
 BertG ?choose.files, ?winMenuAdd, ?winDialog, ?select.list

 with the big drawback that it will only work on Windows.

I don't think that a `big' drawback if you `want to go GUI', as GUI
conventions are so different between platforms (and tcltk being different
from the `native' one on each platform).  But we are beginning to attempt
to add platform-independent wrappers to GUI widgets.

 As Uwe says below, it depends on your context;
 for relative simple things, however please consider a portable
 solution, using
 menu(), readline(), ..

 BTW, menu() has been improved in R 2.1.0 (alpha -- please test!),
 and is now connected with select.list() which should work on all
 platforms (and uses tcltk on Linux when available).

To be a bit more specific,

menu() has a 'graphics' argument that uses a listbox on Windows, MacOS or
tcltk (where available).

select.list() works on all platforms, graphically as for
menu(graphics=TRUE), otherwise in text mode.

I intend to add a tcltk-based version of choose.files().  (One of the
problems with tcltk is that its widgets are OS-specific, and getting
select.list to choose a reasonable height tooks ages: there needs to a
fudge factor of 3 pixels/line on Unix and 1 pixel/line on Windows.)

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] pictex graphics device and color

2005-03-31 Thread Brian D Ripley
On Thu, 31 Mar 2005 [EMAIL PROTECTED] wrote:

 Is the pictex graphics device known not to support color?

Yes, amongst other settings like lwd and metric info for character output.

If you read the code you will see that the arguments fg and bg are
ignored.  In any case, there is no obligation for a graphics device to
support transparency, and in particular pictex() predates its introduction
into R.

As far as I am aware, pictex is a plain TeX package (that also
more-or-less works in LaTeX: it is barely mentioned in the LaTeX Companion
referred to on the help page, nor covered in any detail in the LaTeX
Graphics Companion), and plain TeX per se does not support colour.

 In R 2.0.1 Patched (2004-11-17), it produced very pretty output:

 ## pictex(file = modern-metatheonomy.tex, bg = transparent);
 ## plotData(data);
 ## dev.off()

 ... but it appears to have ignored all color information.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] [R-help] install problem

2005-03-22 Thread Brian D Ripley
On Mon, 21 Mar 2005, Tae-Young Goo wrote:

 Hello.

 I've tried to install R to IBM AIX(v.5.1) machine.
 I've used compile options indicated by R-admin.

There are several sets there, so which exactly?

 Then, I met following error messages.

 /home/local/R_2.0.1/lib/R/bin/exec/R is unchanged
 /home/local/R_2.0.1/lib/R/modules/R_X11.so is unchanged
 /home/local/R_2.0.1/lib/R/modules/internet.so is unchanged

Those are not error messages.

 cp: lapack.so: file was not found.

So there were some earlier error messages about that.

 This error has broken out at the last stage of make install
 Please let me know what is wrong.

Please let us know what you did.  In particular AIX is tricky, and you
need to follow the instructions in the R-admin.html manual very
carefully.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] save (was cl$cluster of kmeans)

2005-03-07 Thread Brian D Ripley
On Mon, 7 Mar 2005, XP Sun wrote:

 hi, all,

   i had a problem when i used kmeans as follow:

No, when you used save()!

pp - scan(m0028.data, quiet= TRUE)
x - matrix(pp, nc=3, byrow=TRUE)
cl-kmeans(x, 4, 20)
plot(x, col=cl$cluster)
save(cl$cluster, file=m0028.ks, ascii=TRUE)
   Error in save(cl$cluster, file = m0028.ks, ascii = TRUE) :
 Object cl$cluster not found

   when i wanted to save the vector of cluster only, a reflection
   was thrown out as that.

   could i save cl$cluster only? how?
   thank you in advance.

You can only save() named objects, not a single element, as its help page
says.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] R-etiquette

2005-01-09 Thread Brian D Ripley
On Sun, 9 Jan 2005, Gabor Grothendieck wrote:

 Prof Brian Ripley ripley at stats.ox.ac.uk writes:

 :
 : On Sun, 9 Jan 2005, Anne wrote:
 :
 :  I'm about to present a report (for internal use of governmental agency).
 :  I used extensively R , contibuted packages, as well as communications on
 :  the R-list
 : 
 :  As well as citing R, I would like to know how to cite the contributed
 :  packages (it is not so easy, as some have been used exensively, other
 :  marginally, some are called from another package and some were not used
 :  as softwares but gave me insight of how to proceed), as well as thank
 :  the persons who generously responded to my demands on the list...
 : 
 :  Is there an established way of doing that?
 :
 : See the citation() function, which works for packages too and a few
 : authors have taken advantage of the means of customizing it.

 Could someone point out a few packages that have a CITATION file
 to use as examples.  In a search I did I only found one.

It seems you need to learn how to search, as there are *4* in a basic
installation of R.

gannet% find . -name CITATION
./lmtest/inst/CITATION
./geoR/inst/CITATION
./geoRglm/inst/CITATION
./flexmix/inst/CITATION
./strucchange/inst/CITATION
./dse/dse1/inst/CITATION
./VR/class/inst/CITATION
./VR/MASS/inst/CITATION
./VR/nnet/inst/CITATION
./VR/spatial/inst/CITATION
./limma/inst/CITATION

Note too that citation() works without a CITATION file and provides a
basis for customization.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@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


Re: [R] Lazy-loading db setup in the R build process

2004-12-16 Thread Brian D Ripley
On 16 Dec 2004, Peter Dalgaard wrote:

 Simon Pickering [EMAIL PROTECTED] writes:

  Hi All,
 
  I have read the article on lazy-loading in the September R news letter, and
  think I have at least a vague grasp on what is happening.
 
  Am I right in thinking that, assuming I were using the same packages, I
  could copy the .rdb  .rdx files from one installation of R (2.0.0) to
  another?
 
  I ask this as I'm trying to cross-compile R (for ARM), and need to use R
  itself to perform the lazy-loading db setup (and probably other things) as
  part of the build process. Therefore I build a native version of R (x86) and
  pass the path of the native R binary as R_EXE in the arm cross-build
  Makefiles (in src/library and its sub-directories).
 
  This fails with the following error:
 
  | make[3]: Entering directory
  `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library/base'
  | building package 'base'
  | mkdir -p -- ../../../library/base/demo mkdir -p --
  | ../../../library/base/man Error in eval(expr, envir, enclos) : may
  | already be using lazy loading on base Execution halted
  | make[3]: *** [all] Error 1
  | make[3]: Leaving directory
  `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library/base'
  | make[2]: *** [R] Error 1
  | make[2]: Leaving directory
  `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library'
  | make[1]: *** [R] Error 1
  | make[1]: Leaving directory
  `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src'
  | make: *** [R] Error 1
 
  My guess is that as the native version has already been built (and enabled
  lazy-loading, etc.), it's not happy that I'm trying to enable it again.
  Might this be the case?
 
  If so I can see a couple of possible options and I wonder if someone could
  comment on what may or may not be possible to remedy the problem:
 
  * Run the native binary without loading its various database files (is this
  is possible)

No.

  * Delete the native database files so they can't be used and will be rebuilt
  for the arm version without complaint

No.

  * Simply copy the database files from the native build to the appropriate
  locations in the cross-build (after patching the Makefiles to remove the
  references to R_EXE), assuming that they should be portable across
  architectures?

 The last one might work (try it and see). A little experiment,
 replacing Opteron base.rdb/rdx files with i386 counterparts indicated
 no immediate (!) ill effects.

That should certainly work: I would expect them to be identical for most
packages.

 The (first) thing that seems to bite your cross compile is in
 src/library/base/makebasedb.R:

 baseFileBase - file.path(.Library,base,R,base)

 if (file.info(baseFileBase)[size]  2) # crude heuristic
 stop(may already be using lazy loading on base);

 in which .Library refers to the running R process, and you probably
 want the cross-build library instead. I'm not sure that is the only
 place that needs changing though. (It *looks* like the tools for
 non-base packages take an argument that would allow the build library
 to be distinct from the the one used by the running R).

Take a look at cross-compiling (Windows under Linux).  We have failed to
make lazy loading of base work under cross-compilation, but do this for
all other packages.

I thought about endian differences (which I gather you have here), but I
don't think they matter as we use XDR format for the databases.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with postscript graphics device driver

2004-12-16 Thread Brian D Ripley
If you mean R 2.0.1, your installation is broken.  Here's a quick check of
where it should be:

 ls(asNamespace(grDevices), all=TRUE)
 [1] .PSenv   .Quartzenv   .X11env
 [4] .__NAMESPACE__.  .__S3MethodsTable__. .packageName


On Thu, 16 Dec 2004, Jeffrey Freedman wrote:

 I recently installed R version 2.01 for OS X (version 10.3.6). I now
 get the following error message when I try to use the postscript
 function:

 Error in get(name.opt, envir = envir) : Object .PSenv not found

 This did not happen in previous versions of R (i.e. 1.9). I do not get
 this error message when using the pdf graphics device driver.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Detecting incomplete commands

2004-12-16 Thread Brian D Ripley
On 16 Dec 2004, Peter Dalgaard wrote:

 Philippe Grosjean [EMAIL PROTECTED] writes:

  Thank you Thomas for your answer. This is of course what I intend to do
  (indeed, to use a tryCatch(), instead of I try(). However, I would like to
  have a different behaviour depending if the synthax is incorrect ls()) for
  instance, or incomplete ls( for instance. Indeed, exactly like the
  distinction made at the command line:
 
   ls()) # This generates an error
  Error: syntax error
   ls( # This is not an error, but a multiline command
  +
 
  If you use parse() within a try(), you got the same error message in both
  cases: Error in parse(file, n, text, prompt) : parse error. So, it is not
  possible to discriminate between the two situation in this context. Is it a
  way to cope with that?

 Here's one idea:

  grep(line 2,try(parse(textConnection(ls))),silent=T))
 numeric(0)
  grep(line 2,try(parse(textConnection(ls()),silent=T))
 [1] 1

This is a lot easier at C level: see R_ext/Parse.h and `Writing R
Extensions'.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R does not support UTF-8 (was german umlaut problem under MacOS)

2004-12-15 Thread Brian D Ripley
You wrote your mail in UTF-8.  R does not support UTF-8, and that is both
documented and announced on startup in such a locale (at least on OSes
with standard-conforming implementations):

gannet% env LANG=en_GB.utf8 R

R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0
...
WARNING: UTF-8 locales are not currently supported

Solution: do not use an unsupported locale.


On Wed, 15 Dec 2004, joerg van den hoff wrote:

 I did not find this in the archive (hope it isn't there...):

 the current release of R (2.0.1) for MacOS (10.3.6) seems not to handle
 german special characters like 'ü' correctly:

I get two characters (Atilde quarter) here.

   f - 'ü'

 can be entered at the prompt, but echoing the variable yields

You mean printing the contents, I presume.

 [1] \303\274  (I think the unicode of the character)

 and inserting, for instance

 text(1,2,f)

 in some plot seems to insert two characters (ü) (probably an
 interpretation of the first and second group of the unicode?).

 I believe, this is a R problem or is there a simple configuration switch?


 thanks

 joerg

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plot with dates

2004-12-14 Thread Brian D Ripley
On Tue, 14 Dec 2004, [ISO-8859-1] Halldor Björnsson wrote:


 Hi,
 I am trying to understand the behaviour of the plot function.
 If I have

   novdate - as.Date(2001/11/1) + (0:29)
   y - 1:30
   b - data.frame(novdate,y)

 then plot(b$novdate,b$y) will produce a plot where the x-ticmarks are
 given as dates (Nov 04, Nov 09 etc), but plot(b) will produce a plot
 where the x-tickmars are integer values (#day since Jan 1st 1970)

 In the first case plot is getting a an x-vector of class Date, and
 y-vector of class integer.  In the second case plot gets an object of
 class data.frame (but with components of class Date and integer).


 I am new to R so I may be wrong about this, but it seems to me that
 different plotting methods are invoked. methods(plot) yields a list of
 plot methods, but I cannot access most of them.

You would be able to had you read the help page for methods().  E.g. use
getS3method(plot, data.frame)  Or try ?plot.data.frame.

 Is there a way to guide plot(b) to using the method used by
 plot(b$novdate,b$y), - or is that a bad idea?...

It's the natural way to do so.  The plot method for data frames is really
designed for a quick look at multi-column numeric data frames.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R 2.0.1 and RODBC install problem

2004-12-13 Thread Brian D Ripley
From the DESCRIPTION file:

SystemRequirements:   An ODBC driver manager and drivers. See README.

PLEASE do as it asks.

On Mon, 13 Dec 2004, doktora v wrote:

 Hi all,

 I try to install the RODBC to no avail. Where is sql.h and sqltext.h
 supposed to come from? I don't have such files anywhere on my hdd!

[...]

 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Please do as we ask.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] bootstrap package

2004-12-13 Thread Brian D Ripley
On Mon, 13 Dec 2004, Kjetil Brinchmann Halvorsen wrote:

 Fredrik Lundgren wrote:

  Hello R'ers
 
  In previous versions of R (I now use 2.0.1) there was a package
  bootstrap. I wrote some programs that depended heavily on this
  package but can unfortunately not find it on Cran today. Is there any
  way to find an older version of bootstrap and use it with the new
  version - 2.0.1?

 Bootstrap should have been in the Orphaned subdierctory on CRAN, but
 is'nt there?
 What happened?

Things are not done retrospectively.  Package bootstrap (and multiv) was
orphaned before the Orphaned subdirectory was instituted.

More a question of `what didn't happen' 

 It can be found in the Archive subdirectory, thoug.

The fact that it is no longer in the main area indicates that it probably
does not pass R CMD check with 2.0.x.

Note to Fredrik Lundgren: it is open to you to take over as maintainer:
see Orphaned/README.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Porting optimisation setup from Excel Solver to R

2004-12-10 Thread Brian D Ripley
On Fri, 10 Dec 2004, Puneet Singh wrote:

 Hi all,

 I am currently optimising a small portfolio I have
 created as a part of my research project in Excel. I
 am unable to find the appropriate package to port this
 into R. My problem set up is as follows

 Minimise ABS(Sum(Xi-Xi')+10*Sum(XiMi)/Mavg)

 Subject to:
 0 = Xi = 0.05
 ABS(Sum(Xi)) = 0.2

But Sum(Xi) = 0, so the ABS is unneeded.
So I presume the minimization is over (Xi), but you have not said.

 where
 Mi - Market Cap of Stock i
 Xi - Initial weight of Stock i
 Xi' - New weight of Stock i
 Mavg = Average weighted market cap of portfolio.

I suspect you have the meanings of Xi and Xi' reversed here.

 My portfolio has a long as well as a short side,
 therefore the ABS. The minimisation function is
 basically a penalty on the change from initial weight
 and the distance from the Average market cap.

That's quite a long way from the formula you gave us.

 My problem is that I need to optimise a vector X with
 the weights instead of one weight at a time... i.e. I
 need to be able to change all the stocks in the
 portfolio simultaneously. I am able to do this EASILY
 in Excel, but have not found any straightforward
 application/formulation in R.

R is not a spreadsheet nor a general-purpose optimizer: Excel will find it
very hard to do most of the things R can do.  So why not use Excel?

It's actually easy to solve this problem theoretically, especially once
you notice that you are minimizing

ABS(0.2 + 10*Sum(XiMi)/Mavg - Sum(Xi'))

and the last term is a constant.  But I suspect you have made several
mistakes in specifying it, and will leave it to you to sort this out.

It is likely that you can set up your intended problem as a linear
program, and although R is not the obvious program to solve an LP, it does
have at least three packages that can do so.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Returning to normal after call to layout()

2004-12-10 Thread Brian D Ripley
On Fri, 10 Dec 2004, michael watson (IAH-C) wrote:

 Hi Petr

 Yes thanks I did get your response and it was helpful.  However, I have
 now resorted to using barplot() to draw a legend (as all I wanted was
 colored boxes and text) and it works very well for my needs.

 Basically, with layout() I'm not getting what I would expect, which may
 be a problem with my expectation rather than anything else.  Like I say,
 I have a function which draws a plot, using layout to divide the
 plotting region into top and bottom.  Fine.  If the user calls my
 function, and then another plotting function, I would expect the new
 plotting function to overwrite the whole of the old plot - but it
 doesn't, it draws the new plot in the top half of the old plot, and
 clears the bottom plot.  So what I want is something which says, after
 calling layout(), OK, I'm done plotting in two different regions, I
 want you to treat the current device as a single region again.

Please look at the example in ?layout, which does exactly that.
Or look at ?par, especially mfrow and mfcol.  You need to reset the
appropriate par()s.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] system() and file names with spaces

2004-12-09 Thread Brian D Ripley
The normal way to do this is to quote the string, here filename.  See
?shQuote.

Your comments really are not fair: a lot of work has been put into
supporting paths containing spaces on both Windows and Unix by the R
developers (or warning that they are not supported), but not by users.
That includes researching and writing functions like shQuote.

On Thu, 9 Dec 2004, Richard A. O'Keefe wrote:

 Consider the question we had recently:  how do I count the lines in a file
 without reading it into R?  The solution I suggested was

 as.numeric(system(paste(wc -l , filename), TRUE))

 Unfortunately, it doesn't work, or at least, not all the time.
 If you already know all about that, and don't care, or already have
 a solution, stop reading now.  Otherwise, let me try to undo any
 harm I may have done by providing a fuller solution.

 We've had several reports in this list about problems caused by Windows
 file names with spaces in them.  File names with spaces are also common
 in MacOS X, so common, in fact, that file name completion in a Terminal
 actually works (if you have a file name Foo Bar, and type F, o, TAB
 you get Foo\ Bar).  File names with spaces are possible in other Unix
 systems too, and always have been, though they are less likely.

That's been a feature of Unix shells with file completion (e.g. tcsh) for
at least a decade -- credit where credit is due, please.

 So suppose there is a file Foo Bar you want to find the size of.
  file.name - Foo Bar
  system(paste(wc -l , File.name)
 executes the command
wc -l  Foo Bar
 which gives you the size of Bar if there is one, or fails if there is not,
 and ignores Foo (should there be one) and of course ignores Foo Bar.

 What can we do about it?  Well, we can try this:

 for.system - function (s) gsub( ,  , s)

 system(paste(wc -l , for.system(file.name)), TRUE)

 Great.  Works for files with spaces in their names.  Now we try some other
 file names.  (File names like this are abundant in MacOS X.)

 file.name - Black  White Minstrels/1972

   Whoops.  wc -l  Black\ \ White\ Minstrels/1972
   forks off wc -l Black\  and then tries to run
   \ White\ Minstrels/1972.

 file.name - Quake(R)/scores

   Whoops.  Badly placed ()'s.

 file.name - Drunkard's walk/log-1'

   Whoops.  Unmatched '

 So try again.

 for.system -
   function (s) gsub(([][)(}{'\;! \t]), \\1, s)

 line.count -
   function (s) as.numeric(system(paste(wc -l , for.system(s)), TRUE))

 This _still_ isn't perfect, but it is a whole lot better than the naive
 version.  The major remaining problem is that the set of special characters
 and the quoting mechanism need to be changed for Windows.  I _think_ the
 Windows version should be something like

 for.system - function (s) {
   i - grep([^-_:.A-Za-z0-9/], s)
   s[i] - sapply(s[i], function (s) paste(\, s, \, sep=))
   s
 }

 But what if a file name contains a double quote?  Until someone tells me,
 I'm just going to hope it doesn't happen.  Putting the pieces together,

 f% cat Foo Bar
 a b c
 d e
 f
 EOF


 for.system -
 if (.Platform$OS.type == windows) {
 function (s) {
 i - grep([^-_:.A-Za-z0-9/], s)
 s[i] - sapply(s[i], function (s) paste(\, s, \, sep=))
 s
 }
 } else {
 function (s) gsub(([][)(}{'\;! \t\n]), \\1, s)
 }

 wc - function (s) {
 r - scan(pipe(paste(wc , for.system(s)), open=r), n=3, quiet=TRUE)
 names(r) - c(lines, words, chars)
 r
 }

  wc(Foo Bar)
 lines words chars
 3 612
  system(cp $HOME/.login Drunkard\\'s\\ Walk)
  wc(Drunkard's Walk)[chars]
 chars
  3633
 

 If there's already something like for.system() built into R, I'd be very
 happy to know about it.  (It's a little odd that system() and pipe()
 don't already support something like this; in a multi-element character
 vector the first could be taken literally and the remaining ones could be
 taken quoted with leading spaces.)

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] POSIX

2004-12-09 Thread Brian D Ripley
On Thu, 9 Dec 2004, Omar Lakkis wrote:

 if I have a variable of type POSIXt  POSIXct like 1969-12-31
 19:00:01 EST how can I dynamicly get the year (or years if vector)
 and month?

See ?months, or any other official documentation on dates in R.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] install bug with specific JPEG library by exporting CPPFLAGS variable

2004-12-08 Thread Brian D Ripley
On 8 Dec 2004, Yves Magliulo wrote:

 Hi there,
 I think I have found a small problem in the
 /my/path/R-2.0.1/src/modules/X11/MakeFile generation.
 During the configure step, I have specified a specific JPEG library by
 exporting CPPFLAGS variable.

That only specifies a set of headers, not the library.
It is up to you to ensure that the library paths you need are also
specified, e.g. in LIBS.

To be definite, this is not a bug/problem in R.

 All compilation works well for individual files in the src/modules/X11/
 directory, but when linking, the -ljpeg option doesn't work.
 I obtain the following message (in french sorry):

 --
 make[4]: Entre dans le repertoire `/mnt/softs/R/R-2.0.1/src/modules/X11'
 gcc -shared -L/usr/local/lib -o R_X11.so  dataentry.lo devX11.lo
 rotated.lo rbitmap.lo  -lSM -lICE -L/usr/X11R6/lib -lX11  -ljpeg
 -lpng -lz  -lreadline -ldl -lncurses -lm
 /usr/bin/ld: ne peut trouver -ljpeg
 collect2: ld a retourne 1 code d'?tat d'ex?cution

[...]

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] install bug with specific JPEG library by exporting CPPFLAGS variable

2004-12-08 Thread Brian D Ripley
On Wed, 8 Dec 2004, Brian D Ripley wrote:

 On 8 Dec 2004, Yves Magliulo wrote:

  Hi there,
  I think I have found a small problem in the
  /my/path/R-2.0.1/src/modules/X11/MakeFile generation.
  During the configure step, I have specified a specific JPEG library by
  exporting CPPFLAGS variable.

 That only specifies a set of headers, not the library.
 It is up to you to ensure that the library paths you need are also
 specified, e.g. in LIBS.

It's best to set these in LDFLAGS: see config.site and the documentation
in R-admin.html.

 To be definite, this is not a bug/problem in R.

especially as how to do it is documented in the appropriate manual.

[...]

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] RODBC on linux

2004-12-08 Thread Brian D Ripley
If you look in the RODBC help pages for odbcConnect you will see this
mentioned with respect to Oracle and Sybase.  Try the fix mentioned there.

On Wed, 8 Dec 2004, Omar Lakkis wrote:

 I am using RODBC 1.1-2 with R 2.0.0 on a Debian box with a singel
 Pentium processor. My database is Informix 7.32.
 When  I run a sql query I get the table header back but no data is
 selected. Please note this example:

 Table t1 has two columns, a and b.  The table is populated with
 three rows.

 Thi si the definition of the table:
 Column name  TypeNulls
 a smallintyes
 b integer yes


  sqlQuery(pricedb, select * from t1)
 [1] a b
 0 rows (or 0-length row.names)
  class(a$a)
 [1] integer
  class(a$b)
 [1] integer

 using my C code on the same box, utalizing teh same odbc installation I get:
 12
 34
 56

 Does anyone have an idea why I get the table header but no data?

 Also, sqlTables() return no rows.

  sqlTables(pricedb)
 [1] TABLE_QUALIFIER TABLE_OWNER TABLE_NAME  TABLE_TYPE
 [5] REMARKS
 0 rows (or 0-length row.names)

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Strange error from R CMD INSTALL

2004-12-08 Thread Brian D Ripley
On Thu, 9 Dec 2004, Ray Brownrigg wrote:

  Date: Wed, 08 Dec 2004 09:33:22 -0400
  From: Kjetil Brinchmann Halvorsen [EMAIL PROTECTED]
 
  I am trying to install a local package and get this unexpected
  error:
 
  -- Making package UMSA 
adding build stamp to DESCRIPTION
installing R files
installing data files
installing man source files
installing indices
  Error: couldn't find function na.omit
  Execution halted
 
  na.omit of course is in package stats, and that is listed in the
  Depends field in the DESCRIPTION file.
 
 Check what is in your data directory.  Does something in there use
 (implicitly) na.omit?

 I have seen something like this (since 2.0.0) where a .R file in the
 data/ directory used a function within the package, but that function
 was not 'available' at the installing indices phase of the
 check/build.

(INSTALL, actually.) That's a plausible explanation.  From 200update.txt
on developer.r-project.org

2) data/*.R files must be self-sufficient, and in particular not
   depend on the package or standard packages other than base.  (This
   has always been documented, but is now enforced.)

and see also `Writing R Extensions'.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Spare some CPU cycles for testing lme?

2004-09-14 Thread Prof Brian D Ripley
As others have said, this needs tools not CPU cycles: gctorture or valgrind.

Valgrind found (after a few seconds and on the first pass)

==23057== Invalid read of size 4
==23057==at 0x3CF4E645: ssc_symbolic_permute (Mutils.c:373)
==23057==by 0x3CF5BF75: ssclme_create (ssclme.c:168)
==23057==by 0x80AF5E8: do_dotcall
(/users/ripley/R/svn/R-devel/src/main/dotcode.c:640)
==23057==by 0x80CFA84: Rf_eval
(/users/ripley/R/svn/R-devel/src/main/eval.c:399)
==23057==  Address 0x3C7F3BD0 is 4 bytes before a block of size 524 alloc'd
==23057==at 0x3C01CB56: calloc (in
/opt/local/lib/valgrind/vgpreload_memcheck.so)
==23057==by 0x80F9EBE: R_chk_calloc
(/users/ripley/R/svn/R-devel/src/main/memory.c:2151)
==23057==by 0x3CF4E515: ssc_symbolic_permute (Mutils.c:352)
==23057==by 0x3CF5BF75: ssclme_create (ssclme.c:168)
==23057==
==23057== Use of uninitialised value of size 8
==23057==at 0x80C0137: Rf_duplicate
(/users/ripley/R/svn/R-devel/src/main/duplicate.c:160)
==23057==by 0x80BFA85: Rf_duplicate
(/users/ripley/R/svn/R-devel/src/main/duplicate.c:101)
==23057==by 0x80BFEB3: Rf_duplicate
(/users/ripley/R/svn/R-devel/src/main/duplicate.c:154)
==23057==by 0x816ED96: do_subset2_dflt
(/users/ripley/R/svn/R-devel/src/main/subset.c:816)
==23057==
==23057== Conditional jump or move depends on uninitialised value(s)
==23057==at 0x3CF62229: ssclme_fitted (ssclme.c:1587)
==23057==by 0x80AF646: do_dotcall
(/users/ripley/R/svn/R-devel/src/main/dotcode.c:646)
==23057==by 0x80CFA84: Rf_eval
(/users/ripley/R/svn/R-devel/src/main/eval.c:399)
==23057==by 0x80D1D80: do_set
(/users/ripley/R/svn/R-devel/src/main/eval.c:1280)

which is pretty definitive evidence of a problem (possibly 2) in the code.

I strongly recommend valgrind (http://valgrind.kde.org/) if you are using
x86 Linux.  It has found quite a few errors in R and in certain packages
recently.  The only thing to watch is that optimized BLASes will probably
crash it.


On Mon, 13 Sep 2004, Frank Samuelson wrote:

 If anyone has a few extra CPU cycles to spare,
 I'd appreciate it if you could verify a problem that I
 have encountered.  Run the code
 below and tell me if it crashes your R before
 completion.

 library(lme4)
 data(bdf)
 dump-sapply( 1:5, function(i) {
  fm - lme(langPOST ~ IQ.ver.cen + avg.IQ.ver.cen, data = bdf,
random = ~ IQ.ver.cen | schoolNR);
  cat(  ,i,\r)
  0
 })

 The above code simply reruns the example from the
 lme help page a large number of times and returns a bunch
 of 0's, so you'll need to have the lme4 and Matrix
 packages installed.  It might take a while to complete,
 but you can always nice it and let it run.

 I'm attempting to bootstrap lme() from the lme4 package,
 but it causes a
 segfault after a couple hundred iterations.  This happens on
 my Linux x86 RedHat 7.3, 8.0, 9.0, FC1 systems w/ 1.9.1
 and devel 2.0.0 (not all possible combinations actually
 tested.)
 I've communicated w/ Douglas Bates about this and he
 doesn't appear to have the problem.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] linking .lib and/or .dll files

2004-07-01 Thread Prof Brian D Ripley
On Thu, 1 Jul 2004, Samuel Kemp wrote:

 Linking C++ dynamic libraries has become the bane of my R life.  I have a
 piece of C++ code that I would like to make into a .dll (to call into R).
 However, this piece of C++ code needs to be linked with a .dll or .lib -
 which I have been created in Visual C++. Is it possible to link this for use
 in R?

Yes with .lib, if it is a recent VC++.  You need to make a mingw import
library, and you can use a tool called reimp to convert a VC++6.0 .lib (but
not earlier).

Alternatively, a tool called pexports can be used to create an exports file
and dlltool can be used to make an import library from that.

Finally, it is supposedly possible to link against a .dll, but I have found
that to be really buggy.

 If so, how do I go about doing this is MINGW?

Create an import library and link against it, and make sure the dlls are in
your path.

CAVEAT: if the C++ code you are calling contains name-mangled symbols you
will be in trouble as VC++ name-mangles in a unique way.  In that case you
need to write a piece of C++ glue code that you can compile in VC++ and
that has C entry points that you can call from R.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to sort the contents of a list-object?

2004-05-12 Thread Prof Brian D Ripley
On Wed, 12 May 2004, Martin Kerick wrote:

 I have a list-object RGList named RG containing two vectors (RG$R and RG$G)
 and a data.frame(RG$genes) with 8 variables. Each of the variables of the
 data.frame have the same length as the two vectors. I think the data in the
 RGList is structured in such a way, that the first entry in the vector RG$R
 belongs to the first entry in the data.frame variable e.g. RG$genes$Row.
 Now my question:

 Is it possible to sort the RGList object by the values of one variable of my
 data.frame e.g. RG$genes$Row without loosing the ties between the different
 parts of the list ?

Yes.  Did you also want to know how?  If so, see later.

But why?  It looks like R and G should be additional columns of the data
frame and if you had a better data organization you would *know* what
matched what and operations like this would be obvious.





















ord - sort.list(RG$genes$Row)
RG - lapply(RG, function(x) if(is.data.frame) x[ord,] else x[ord])

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Size of R user base

2004-04-20 Thread Prof Brian D Ripley
On 20 Apr 2004, Peter Dalgaard wrote:

 [EMAIL PROTECTED] writes:

  On 20 Apr 2004 at 10:47, Philippe Grosjean wrote:

   Of course, this will only work with computers connected to the
   internet,... but at least, it could be one way to evaluate the number
   of R users. Would that be an infringment of Open Source, or any other
   rule of freedom? I don't know, but it does seem to be quite widespread
   (at least for commercial software). so, why an Open Source software
   would not be able to monitor the number of users?
 
  That would make R into spyware, and there exist software to monitore
  and warn aganst/automatically remove spyware, and some users have
  such installed (and it will grow).

 Not quite spyware. Spyware generally works in more covert ways and
 tries to hide itself from the user.

 However, quite a few people think that having programs connecting to
 places on the internet without being asked is annoying and a potential
 invasion of privacy and it may even cost people money if they're on a
 dialup non-flat-fee connection.

It is possible to ask: I mentioned pine, which does, and so do some perl
installers.

I don't think people would mind if the rw1091.exe installer had an option
(ticked by default) to `call home', but I don't think we would learn enough
for this to be worth setting up.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] loading into a list

2004-04-20 Thread Prof Brian D Ripley
Try .saveRDS/.readRDS which enable you to save and load unnamed objects (in
your case list(A, B, C)).

On Tue, 20 Apr 2004, Tamas Papp wrote:

 I have the following problem.

 Use the same algorithm (with different parameters) to generate
 simulation results.  I store these in variables, eg A, B, C, which I
 save into a file with

 save(A, B, C, file=solution001.Rdata)

 I do this many times.  Then I would like to load the above, but in
 such a manner that A, B, C woule be part of a list, eg

 sol001 - loadIntoList(solution001.Rdata)

 so that sol001 is a list with elements A, B, C.

 I am looking for a way to implement the above function.  The variables
 are very large and I need a lot of time to compute them, so saving 
 loading the results is the only viable alternative.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] New unique name

2004-04-19 Thread Prof Brian D Ripley
On Mon, 19 Apr 2004, Barry Rowlingson wrote:

 (Ted Harding) wrote:

  A bit sledgehammer for nut, but as least it meets your needs!

   You could even use uuidgen to create a universally unique ID, and then
 use make.names to R-ify it:

   make.names(system(uuidgen,intern=T))
 [1] aa33d26c.88a5.4eab.94ba.5073c4718ffe
   make.names(system(uuidgen,intern=T))
 [1] d5aea7a0.81e9.4690.8d48.d74fd2b50a83
   make.names(system(uuidgen,intern=T))
 [1] X2570d3e0.6b07.42be.a9c6.3701ac82b4f0

   Of course the requirement was to make an object with a name that
 didn't already exist, and there's no guarantee that you haven't already
 created an object called X2570d3e0.6b07.42be.a9c6.3701ac82b4f0 for
 some reason.

   So that's no good.

   How about getting an alphabetically-sorted list of all the current
 objects and then using the last one augmented with something:

 makeUnique - function(){
   allObjects=sort(ls(pos=seq(1:length(search()
   paste(allObjects[length(allObjects)],-temp,sep='')
 }

   I'm sure someone can come up with a bigger sledgehammer, or a reason
 why this wont always be unique. What's the longest name of an object in
 R? That'll break it... Pah.

There is more to the environment than the search path, which is what makes
this tricky.  I suspect Erich really only wanted to avoid objects in the
current frame (which is not on the search path except for interactive use
of R), but he didn't tell us too precisely.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R][S] library question

2004-03-24 Thread Prof Brian D Ripley
In some cases it is possible to port an R *package* to S-PLUS: people have
done both that and the reverse.

If you have some specific examples in mind we may be able to help you
further.  Since you are on Windows, it may not be easy unless you have the
requisite tools (e.g. Visuall C++ and Fortran).


On Wed, 24 Mar 2004, Erin Hodgess wrote:

 Is it possible to take one of the R libraries and put it
 into S+ please?

 R Windows XP 1.8.1
 S+ Version 6.2


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] rstandard does not produce standardized residuals

2004-02-24 Thread Prof Brian D Ripley
This has laready been changed in the R-devel version (1.9.0 to be).
Pre-test versions of that for Windows are available on CRAN.

From the NEWS file


o   rstandard() was wrongly scaled for cases where
summary(model)$dispersion != 1.

and that ought to mention glm somewhere 


On Tue, 24 Feb 2004, Ulrich Halekoh wrote:

 Dear all,


 the application of the function rstandard() in the base package
  to a glm object does not produce  residuals standardized to
 have variance one:

 the reason is that the deviance residuals are  divided
 by the dispersion estimate and not by the
 square root of the estimate for the dispersion.

 Should the function not be changed to produce residuals
 with a variance about 1?


 R 1.8.1 on windows 2000

 ulrich


 ==
 Ulrich Halekoh,  PhD Phone: +45 8999 1825
 Biometry Research Unit   Fax:   +45 8999 1300
 Danish Institute of Agricultural SciencesE-mail: [EMAIL PROTECTED]
 Research Centre Foulum, DK-8830 Tjele, Denmark

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Latin 2 encoding + fonts

2004-02-04 Thread Prof Brian D Ripley
On Wed, 4 Feb 2004, Miha STAUT wrote:

 Hi,

 In the FAQ I read about options to specify different fonts than the default
 ones for the console (in the file Rprofile) and for the graphical output
 (Rdevga). I would however like to replace Latin 1 with Latin 2 enconding for
 both (console and graphical) output in Windows and just graphical output in
 Linux.

You are confusing fonts with encodings.

Windows does not use either Latin 1 or Latin 2, and R for Windows does not
encode for the console or the graphical device.  Just use the Windows
version of a ISO-8859-2 locale and a font supported by your locale (almost
all under NT, fewer under Win9x).

 I guess it is possible but I did not find the way.

 How can I use the fonts (*.afm) and the (presumably) encondings (*.enc) in
 R/rw1081/afm? How do I know what are the real font names. Are those only the
 ones listed in the man page for Hershey?

This is nothing to do with Hershey.  All the information you need is on the
help page for postscript().

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Winedit and R

2003-12-16 Thread Prof Brian D Ripley
You are using mismatched versions of R and the packages, as the warnings
say. Please update your version of R.

On Tue, 16 Dec 2003, Patrick Giraudoux wrote:

 Hi all,

 I am trying to install add-on in R (rw1070) to work with WinEdit. Libraries 
 Swinregistry and Rwinedt have been installed via Install Package(s) from local zip 
 files from R. However, when I run library(Rwinedt) I get the following messages:

  library(Rwinedt)
 Loading required package: SWinRegistry
 Error in loadNamespace(name) : package `methods' does not have a name space
 In addition: Warning messages:
 1: package RWinEdt was built under R version 1.8.0
 2: package SWinRegistry was built under R version 1.8.0
 Error in eval(expr, envir, enclos) :
 Package SWinRegistry is not available.
 Either install it or install R-WinEdt manually, as described in ReadMe.txt

 Intalling manually looking quite complicated, I am not tempted to take this 
 direction...

 Can anybody give me a hint?


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Calling C function in R

2003-12-16 Thread Prof Brian D Ripley
On Tue, 16 Dec 2003, Manoj - Hachibushu Capital wrote:

 Hi All,
   I am trying to write a c function to optimize loop processing.
 Having read the R extension and trying out a few samples I was pretty
 comfortable with the basics.

   However, I am wondering if there is anyway to call tseries
 functions like adf.test or po.test from within c function. Any pointers/
 code sample would be greatly appreciated.

Yes, this is described with code samples in `Writing R Extensions', in the
section `Evaluating R expressions from C'.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] WinMenus - is there a way of knowing if a WinMenu or WinMenuItem already exists?

2003-12-08 Thread Prof Brian D Ripley
On Mon, 8 Dec 2003, Finn Sando wrote:

 I am developing a menusystem using the functions WinMenuAdd and
 WinMenuAddItem etc.

 I want to be able to shift between different interfaces (ie. different sets of 
 menu-trees).
 Therefore I would like to be able to ask whether a specific menu already exists in 
 order
 to remove or add it Without errors. That is I am looking for something like:

 WinMenuExist(menuname) and WinMenuExistItem(menuname,itemname)

 Are there any way asking such question of R?

No.  But you could contribute such functionality.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R]: GLIM PROBLEMS

2003-12-02 Thread Prof Brian D Ripley
)  -0.778630.04020  -19.37   2e-16 ***
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 1837.4  on 47  degrees of freedom
Residual deviance:  883.8  on 44  degrees of freedom
AIC: 1228.4

Number of Fisher Scoring iterations: 4

The Genstat output is displayed below.  (well only some of it!!!)


* Regression Analysis *

Response variate: claims_r
Binomial totals: exp_n
Distribution: Binomial
Link function: Logit
Fitted terms: Constant, age


*** Summary of analysis ***

mean  deviance approx
  d.f. deviance deviance ratio chi pr
Regression   31298.   432.70432.70  .001
Residual441136.25.83
Total   472434.51.80
* MESSAGE: ratios are based on dispersion parameter with value 1

Dispersion parameter is fixed at 1.00


*** Estimates of parameters ***
 antilog of
  estimate s.e.  t(*)  t pr.   estimate
Constant   -1.1992   0.0211-56.90  .001 0.3014
age (23-26)-0.4302   0.0326-13.20  .001 0.6504
age (27-65)-0.7999   0.0224-35.75  .001 0.4494
age (66-80)-0.9297   0.0407-22.86  .001 0.3947
* MESSAGE: s.e.s are based on dispersion parameter with value 1

Parameters for factors are differences compared with the reference
level:
  Factor  Reference level
 age  (17-22)
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Rd Files?

2003-12-01 Thread Prof Brian D Ripley
On Mon, 1 Dec 2003, Wolski wrote:

 Hi!


 Seems to me that package.skeleton(...) does not like assignment functions.
 System: Windows 2000

And that's your problem!  It's a problem with your OS, not
package.skeleton. And it is known.



 package.skeleton(name=testpack,list=ls(),path=c:/home/wolski/devel,force=T)
 Creating directories ...
 Creating DESCRIPTION ...
 Creating READMEs ...
 Saving functions and data ...
 Error in file(file, ifelse(append, a, w)) :
   unable to open connection
 In addition: Warning message:
 cannot open file `c:/home/wolski/devel/testpack/R/[[-.caliblist.R'

 Eryk


 *** REPLY SEPARATOR  ***

 On 12/1/2003 at 1:08 PM Prof Brian Ripley wrote:

 ?prompt
 ?package.skeleton
 
 and do read `Writing R Extensions'
 
 
 On Mon, 1 Dec 2003, Wolski wrote:
 
  Hi Kjetil!
 
  I have an *.R file with a lot of functions and I am looking for a script
  which would generate the skeleton of an Rd file for all functions found
  in the R file. It will be nice if the can already generate the
  name,usage and the arguments field from the source so that i have
  to edit only the description and examples
 
  Eryk
 
 
 
  *** REPLY SEPARATOR  ***
 
  On 12/1/2003 at 8:44 AM [EMAIL PROTECTED] wrote:
 
  On 1 Dec 2003 at 13:21, Wolski wrote:
  
  It is not entirely clear what you want, but if you want to translate
  S[-Plus] help files to Rd format, there is [windows]
  Rcmd Sd2Rd
  [unix]
  R cmd Sd2Rd
  
  Kjetil Halvorsen
  
   Hi!
  
   Are there scripts or packages for generating Rd files out of S3 code
   on cran? Has any one written such scripts (e.g. in Perl?) and are
   willing to share them?
  
   Thanks in advance.
  
   Eryk.
  
   Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate
   Genomics Ihnestrasse 73 14195 Berlin  'v' tel:
   0049-30-84131285   /   \ mail: [EMAIL PROTECTED]
   ---W-W
  
  
[[alternative HTML version deleted]]
  
   __
   [EMAIL PROTECTED] mailing list
   https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 
 
 
  Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate
 Genomics
  Ihnestrasse 73 14195 Berlin  'v'
  tel: 0049-30-84131285   /   \
  mail: [EMAIL PROTECTED]---W-W
 http://www.molgen.mpg.de/~wolski
 
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 
 
 
 --
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595



 Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics
 Ihnestrasse 73 14195 Berlin  'v'
 tel: 0049-30-84131285   /   \
 mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski




-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] howto improve sharpeness of fonts in a jpg-image produced by R ?

2003-11-18 Thread Prof Brian D Ripley
On Tue, 18 Nov 2003, Niels Steen Krogh wrote:

 I used an expression like this:

 bitmap(file=barplotx.jpg,type=jpeg)

So that was nothing to do with R, as reading the help page would have told
you.  Your subject line is false: the `jpg-image' was produced by gs and
you should look into fixing your problems with that.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] confint: which method attached?

2003-11-17 Thread Prof Brian D Ripley
On Mon, 17 Nov 2003, Ulrich Halekoh wrote:

 the function
 confint
 uses the profiling method of the function of the package MASS

 confint.glm

 even after the package has been detached!

Why the exclamation mark?  Note profile.glm is not actually in package:MASS
(sic).  Try looking for it:

 getAnywhere(profile.glm)
A single object matching 'profile.glm' was found
It was found in the following places
  registered S3 method for profile from namespace MASS
  namespace:MASS
with value
   ...

 1: might this be the intenden behavior?

The accurate description is the intended behaviour.

 2. How does the function remember its 'MASS' functionality after
 detaching the package?

It isn't in the package 


There is currently no way to remove registered S3 methods like confint.glm
in an R session.  Nor is there likely to be in the near future,


General comment: R has changed quite a lot recently, and older
preconceptions do need to be checked against current information.
The article `Name Space Management for R' in R-news 2003/1 may help
(although it may tell you mor ethan you want to know).

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Problem with parser and if/else

2003-11-13 Thread Prof Brian D Ripley
On Thu, 13 Nov 2003, Ben Bolker wrote:


   In the second case, R stops when it has a syntactically complete clause:

 if (...) {
   ...
 }

 is complete since an else{} clause is not required.  R evaluates it, then
 moves onto

 else { ... }

 which is a syntax error (since it doesn't have an if {} in front of it,
 since that has already been evaluated)

   One way to see this illustrated is to enter these commands a line at a
 time in interactive mode.

   I don't know exactly where this appears in the documentation, probably
 someone will point to it in another message.

help(if), for example (the most obvious place to look?)
MASS4, p.58



 On Thu, 13 Nov 2003, Brown, Simon wrote:

  Dear r-help people,
 
  could you confirm that this is correct behaviour for R?  I am using RH9.
 
  the code:
  x1 - 1:6
  t1 - 5
  if (length(x1) = t1) {
  cat(in the if \n)
  } else {
  cat(in the else\n)
  }
 
  runs fine:
   source(test_if_else.R)
  in the if
  
 
  but the code:
  x1 - 1:6
  t1 - 5
  if (length(x1) = t1) {
  cat(in the if 2\n)
  }
  else {
  cat(in the else\n)
  }
 
  fails with the error:
   source(test_if_else2.R)
  Error in parse(file, n, text, prompt) : syntax error on line 6
  
 
  Could someone explain this to me please?
 
  Thanks,
 
  Simon.
 

 --
 620B Bartram Hall[EMAIL PROTECTED]
 Zoology Department, University of Floridahttp://www.zoo.ufl.edu/bolker
 Box 118525   (ph)  352-392-5697
 Gainesville, FL 32611-8525   (fax) 352-392-3704

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] GDB under windows

2003-11-06 Thread Prof Brian D Ripley
It's in the rw-FAQ! That describes this as `fraught' with good reason.

On Thu, 6 Nov 2003, Marsland, John wrote:

 Does anybody have some simple instructions to get me going using the GNU
 debugger GDB under windows with R?

 The R Extensions manual mentions briefly debugging under unix, but I've seen
 seen GDB mention in the Bloodshed Dev C++ IDE so it should be possible to
 use it with R?

 Regards,

 John

 [Using R-1.8.0 under Windows NT 4.0]

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] map does not display maps, MacOSX

2003-11-05 Thread Prof Brian D Ripley
Notice the // in the path

/Users/glaziou/Library/R/maps/mapdata//world.N

Some Windows filesystems do not like that, and my guess is that some MacOS
X ones may not either.

On Wed, 5 Nov 2003, Philippe Glaziou wrote:

 Hi,

 I installed the maps and mapdata libraries on my R-1.8.0 on
 MacOSX 10.2.8 (jaguar on a powerbook G4), and failed to make the
 map function work properly:


 R : Copyright 2003, The R Development Core Team
 Version 1.8.0  (2003-10-08)
 [...]

  library(maps)
  map()
 Error in file(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file `/Users/glaziou/Library/R/maps/mapdata//world.N'
  map('usa')
 Error in file(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file `/Users/glaziou/Library/R/maps/mapdata//usa.N'
  system('ls -l /Users/glaziou/Library/R/maps/mapdata')
 total 1796
 -rw-r--r--   1 root staff  143902 Oct 14 11:30 county.G
 -rw-r--r--   1 root staff  690260 Oct 14 11:30 county.L
 -rw-r--r--   1 root staff 618 Oct 14 11:30 nz.G
 -rw-r--r--   1 root staff   13040 Oct 14 11:30 nz.L
 -rw-r--r--   1 root staff2642 Oct 14 11:30 state.G
 -rw-r--r--   1 root staff   96892 Oct 14 11:30 state.L
 -rw-r--r--   1 root staff 282 Oct 14 11:30 usa.G
 -rw-r--r--   1 root staff   58232 Oct 14 11:30 usa.L
 -rw-r--r--   1 root staff   74434 Oct 14 11:30 world.G
 -rw-r--r--   1 root staff  295152 Oct 14 11:30 world.L
 -rw-r--r--   1 root staff   74434 Oct 14 11:30 world2.G
 -rw-r--r--   1 root staff  295152 Oct 14 11:30 world2.L
 -rw-r--r--   1 root staff   54832 Oct 14 11:30 world2.N

 Most of contributed libraries are installed in ~/Library/R
 because I am the only user of that mac and this simplifies
 backup. I checked the access rights of relevant files and
 directories and they all seem correct (these are owned by root
 but are world readable and directories are world cd'able).
 Compilation of both libraries maps and mapdata went ok.  I have
 the same libraries installed on a linux server where they work
 perfectly well.

 A similar error message occurs whether R is started in an xterm,
 within emacs/ESS on X11, or using the RAqua interface.

 Any hint appreciated,

 --
 Philippe Glaziou

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] run R under linux

2003-10-22 Thread Prof Brian D Ripley
On Wed, 22 Oct 2003, Zhen Pang wrote:

 Thank you for your help. But try() seems to only allow for an expression. My
 simulation have serveral expressions which possibly have problem. Is there
 any possibility to include them all in the try()? If not, I seem to use
 several try().

{line1
line2
line3}

*is* a single expression.

As in the example on the help page for try, you can also wrap the
computation in a function call, and that is usually a good idea.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] png() and/or jpeg(): line missing by using box(which=outer)

2003-10-21 Thread Prof Brian D Ripley
It is probably a bug: does it happen when you copy from the screen in png?
I would expect not, hence that may be a workaround for you.

When I have both time and access to a Windows machine I may be able it take
a closer look: meanwhile you do have access and have the source code so
please investigate it yourself and submit a patch.

On Tue, 21 Oct 2003, Pfaff, Bernhard wrote:

 Dear R list,

 I do encounter the following problem by generating either a png-file
 (example below) or a jpeg-file:
 By employing 'box(which=outer)' a box is drawn, except for the right line.
 If I generate the plot without the 'box(which=outer)', a line at the
 bottom in the graphics file still appears. However, both plots are displayed
 correctly in the R Graphics Device Window, i.e  with a box including the
 right side or one without any lines at the outer margins of the plot. Now, I
 want either a file - including the right side of box or one that has none on
 all sides.

 test - rnorm(100)
 par(mar=c(6,4,6,4), oma=c(1,1,1,1))
 png(test1.png)
 plot(test)
 grid()
 box(which=outer)
 box(which=plot)
 dev.off()

 png(test2.png)
 plot(test)
 grid()
 box(which=plot)
 dev.off()

 Incidentally, both functions are calling .Internal(devga()). I have not
 encountered this problem with version R 1.7.1 (for which I used the binary
 distribution on CRAN). Now, I have source compiled R 1.8.0. Although,
 everything passed 'make check', I am wondering if it could be possible that
 'devga.c' or any other necessary file for running png() or jpeg() have not
 been compiled 'correctly', or do I have simply to adjust a par()-argument?

 Any pointers or help is appreciated.


 Bernhard


 platform: i386-pc-mingw32
 arch: i386
 os: mingw32
 system: i386, mingw32
 major: 1
 minor: 8.0
 Windows NT 5.0



 
 The information contained herein is confidential and is intended solely for the
 addressee. Access by any other party is unauthorised without the express
 written permission of the sender. If you are not the intended recipient, please
 contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
 via e-mail return. If you have received this e-mail in error or wish to read our
 e-mail disclaimer statement and monitoring policy, please refer to
 http://www.drkw.com/disc/email/ or contact the sender.

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] ks.test()

2003-08-28 Thread Prof Brian D Ripley
On Thu, 28 Aug 2003, franck allaire wrote:

 With the Shifted Exponential test, H_0 is data is a sample coming from a
 Shifted Exponential distribution with shift=30 and lambda = 0.001566907

You got that after looking at the data.  H_0 has to be specified before
looking at the data.

 You appear to be applying the KS test after estimating parameters.

 I do in order to define H_0 as explained above

That's invalid.

 The distribution theory is for an iid sample from a known continuous
 distribution (and does not otherwise depend on the distribution).

 That's what I thougth but this is not what I understand reading:

Learn not to believe everything you read on the Web.

 Since your H_0 is not pre-specified, that distribution theory is not
 correct.

 please see above

Rather, please take careful note yourself.

 (Some corrections have been worked out for say ML fitting of exponential
 and normal distributions -- by Michael Stephens as I recall.)
 Also, your `truncated LogNormal' does not appear to be truncated, rather
 to be shifted.  That's the same thing for an exponential (for a positive
 shift), but not for any other distribution.

 Thanks for this clarification

 And what is the H_0 and H_1 used in the article?

 H_1 is that the sample is not coming from the specified distribution in H_0

Not so: perhaps an iid sample from some other continuous distribution?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Marginal (type II) SS for powers of continuous variables ina linear model?

2003-08-14 Thread Prof Brian D Ripley
On Tue, 12 Aug 2003, [iso-8859-1] Bjørn-Helge Mevik wrote:

 Prof Brian Ripley [EMAIL PROTECTED] writes:

  drop1 is the part of R that does type II sum of squares, and it works in
  your example.  So does Anova in the current car:

 I'm sorry, I should have included an example to clarify what I meant
 (or point out my misunderstandings :-).  I'll do that below, but first
 a comment:

  And in summary.aov() those *are* marginal SS, as balance is assumed
  for aov models. (That is not to say the software does not work otherwise,
  but the interpretability depends on balance.)

 Maybe I've misunderstood, but in the documentation for aov, it says
 (under Details):
  This provides a wrapper to `lm' for fitting linear models to
  balanced or unbalanced experimental designs.

 Also, is this example (lm(y~x+I(x^2), Df)) really balanced?  I think

No, and I did not use summary,aov on it!

 of balance as the property that there is an equal number of
 observations for every combination of the factors.  With x and x^2,
 this doesn't happen.  For instance, x=1 and x^2=1 occurs once, but x=1
 and x^2=4 never occurs (naturally).  Or have I misunderstood something?

Yes. summary.aov(split=) and model.tables and the like are designed for
balanced data.  They may or may not work in the unbalanced case.  The
comment you quote is for aov(), not those other functions.

 Now, the example:

  Df2 - expand.grid (A=factor(1:2), B=factor(1:2), x=1:5)
  Df2$y - codes(Df2$A) + 2*codes(Df2$B) + 0.05*codes(Df2$A)*codes(Df2$B) +
 +   Df2$x + 0.1*Df2$x^2 + 0.1*(0:4)
  Df2 - Df2[-1,]# Remove one observation to make it unbalanced

codes is deprecated!

  ABx2.lm - lm(y~A*B + x + I(x^2), data=Df2)

 The SSs I call marginal are R(A | B, x, x^2), R(B | A, x, x^2),
 R(A:B | A, B, x, x^2), R(x | A, B, A:B) and R(x^2 | A, B, A:B, x).

That's not what most other people call marginal, though.

 (Here, for instance, R(x | A, B, A:B) means the reduction of SSE due
 to including x in a model when A, B and A:B (and the mean) are already
 in the model. I've omitted the mean from the notation.)

  anova(ABx2.lm)
 Analysis of Variance Table

 Response: y
   Df Sum Sq Mean Sq   F valuePr(F)
 A  1  1.737   1.737   66.5700 1.801e-06 ***
 B  1 13.647  13.647  523.0292 6.953e-12 ***
 x  1 93.677  93.677 3590.1703  2.2e-16 ***
 I(x^2) 1  0.583   0.583   22.3302 0.0003966 ***
 A:B1  0.011   0.0110.4238 0.5263772
 Residuals 13  0.339   0.026
 ---
 Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

 This gives SSs on the form R(A), R(B | A), R(x | A, B) etc.  (If the
 design had been balanced (in A, B and x), this would have been the
 same as the marginal SSs above.)

  drop1(ABx2.lm)
 Single term deletions

 Model:
 y ~ A * B + x + I(x^2)
Df Sum of Sq RSS AIC
 none0.339 -64.486
 x   1 1.188   1.527 -37.901
 I(x^2)  1 0.592   0.931 -47.294
 A:B 1 0.011   0.350 -65.877

 This gives the SSs R(x | A, B, A:B, x^2), R(x^2 | A, B, A:B, x) and
 R(A:B | A, B, x, x^2).  The SS for x is not marginal as defined
 above.

But that *is* how `marginal' is usually defined.  Why should I(x^2) be
regarded as subservient to x?  It is just another function of x.  Suppose
we have x and log(x)?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] label chemical formulas

2003-08-04 Thread Prof Brian D Ripley
On Mon, 4 Aug 2003, Roberto Canteri wrote:

[This is a repeat of a post earlier today.]

 Dear r-help,
 the prcomp matrix (x$rotation) I have, has the columns labels as chemical
 formulas (i.e: C2H3, 37Cl,...,C10H24N3O3).
 Plotting them as plain text I do the following with success:

 xlabs - dimnames(y$rotation)[[1]]

That extracts the *row* names.

  xlabs - as.character(xlabs)

They are already character.  You want to convert them to expressions.
Here's one way to get you started.

 xx - C[2]*H[3]
 parse(text=xx)
expression(C[2] * H[3])

It's probably easiest to plot the labels one at a time, but

xx - c(C[2]*H[3], phantom()[37]*C[1])
parse(text=paste(xx, collapse=\n))

works.


  plot(y$rotation[,1],y$rotation[,2], ann=FALSE, type=p, col=red, pch=20)
  text(y$rotation[,1],y$rotation[,2], labels=xlabs, cex=0.7, font=1, pos=4,
 offset=0.2)

  I do not succed to plot the labels with subscripts and superscripts. I
 did many attempt trying the use of expression() or substitute() but
 without success. I can write the labels in the data matrix as needed
 (i.e.: C[2]*H[3]) to plot properly if I would know how.

 I peg your pardon if this is probably a silly problem, I am new user of R (I am
 using R 1.7.0 on win2k).

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] rterm

2003-07-18 Thread Prof Brian D Ripley
Well, there's a file  README.rterm in the top-level (binary) installation
directory, and the section `Invoking R under Windows' in `An Introduction
to R' applies equally to RGui and Rterm.  All the information is in one of
those two places.

On Fri, 18 Jul 2003, Manuel Lopez Coello wrote:

 I would like to use Rterm but i don`t know its parameters. I have
 searched about this issue but i haven´t found anything. thank you.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] sample function

2003-06-27 Thread Prof Brian D Ripley
R is not S-PLUS, and you need Modern Applied Statistics in S (4th ed) for a
description including R.

sample in R used a PRNG: see ?RNG in R for the details of PRNGs in R.

On Fri, 27 Jun 2003, [iso-8859-1] Ramzi Feghali wrote:

 i have a question about the sample function used in R, does it work as
 a pseudo-dandom number generator programmed with C, like it is described
 in Modern Applied Statics with S-Plus 3d edition chapter 5 section 2?


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] using R as a script; getting the output to display on screen

2003-06-27 Thread Prof Brian D Ripley
On Fri, 27 Jun 2003, Nick Helseth wrote:

So, you are using Windows: please say so up front.

 I'm trying to run R from the command line using a function as an input; it
 seems to run ok when I use Rterm --vanilla  name_of_R_function.R (by ok,
 I mean that it will say that it's reading in the correct items) but the
 graphics won't display on screen.

The default graphics device in non-interactive use is postscript().

 Do I need to explicitly define an output
 device?  Like Rterm --vanilla  name_of_R_function.R 
 standard_display_device?  If that is the case, I don't suppose anyone
 happens to know the name of the screen display device in Windows, do they?

Yes, lots of people do as it is in the README.RW1071:  windows().  Just add
an explicit call to see graphics on-screen.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Can't save a graph to pdf in R for MacOS

2003-06-26 Thread Prof Brian D Ripley
On Thu, 26 Jun 2003, p.b.pynsent wrote:

 I do not have an R solution but use eps2pdf (a Perl script)
 This can be installed by Fink
 http://sourceforge.net/projects/fink/.

eps2pdf runs GhostScript: so does the R device driver bitmap().  Does the
latter work on your system?  If so it would save you some steps.

 On Wednesday, June 25, 2003, at 03:41  am, Sébastien Plante wrote:

  Hi,
 
  I am using R 1.7.1 (carbon) for MacOS and I am running it on MacOS X
  10.2.6. When I send a graph to the pdf device (or any other devices),
  I get a zero KB file name Rplots.pdf.
 
  Before sending my graph to the output, I did:
 
   dev.off()
   pdf()
   boxplot(... my graph commands...)
   dev.off()
 
  Is this the correct procedure?  I did the same procedure on another PC
  running Linux (R 1.6) and it work well.
 
  Please help!
 
  Thanks,
 
  Sébastien Plante
 
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] outlier

2003-06-18 Thread Prof Brian D Ripley
Please do read the help page. which explains this is a random algorithm.
In your example you can try cov.rob(ap, cor=TRUE, nsamp=exact)


On Wed, 18 Jun 2003, kan Liu wrote:

 I wrote a .R file (see below)to calculate robust
 measure of correlation using cov.rob. I got different
 correlation coefficients (0.70, 0.79, 0.63, ...) when
 I run the file different times. Can you tell me what
 this means or what is wrong in using cov.rob?
 -

 library(lqs)
 a -
 c(5.41,4.67,5.88,2.38,4.79,5.30,1.94,3.40,5.05,3.31,5.88,4.92,5.08,4.58,4.59,4.77,5.25,3.77,2.88,5.30,5.32,2.56,4.29,5.54,4.53,3.51,4.93,2.49,2.85,5.04,2.51,2.60,3.58,2.11,1.70,5.20,5.08,4.48,3.96,4.87,4.98,2.56,1.69,4.28,1.70,2.91,5.37,2.16,3.04,1.69,1.88,5.36,1.70,3.81,1.70,5.88,3.52)
 p -
 c(5.30,4.78,4.79,0.62,4.32,2.33,0.64,3.14,3.06,4.73,5.72,2.21,4.81,1.74,4.93,4.74,5.81,3.88,3.03,4.72,5.79,3.43,4.07,5.93,2.26,3.70,5.32,4.56,1.52,2.54,0.26,2.79,3.67,4.44,1.46,4.26,4.49,5.29,3.26,3.87,3.12,3.97,3.49,0.45,0.76,4.49,5.29,1.94,4.69,2.80,2.75,5.16,0.74,5.81,1.46,5.24,4.00)
 ap - cbind(a,p)
 cov.rob(ap, cor=TRUE)

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] dyn.load() function problem help!

2003-06-18 Thread Prof Brian D Ripley
On Wed, 18 Jun 2003, Mu Yunming wrote:

 Hi!

 I would like to call a Fortran subroutine within R. For doing this, I first
 built a shared library for loading into R under Unix and it was successful.

How did you do this?  Did you use R CMD SHLIB?

 But when I tried to load a shared library using dyn.load() function for use in
 .Fortran(), I got an error message.
 The command I input below in R is:
 dyn.load(aaa.so)
 The reslut is:

 error in dyn.load(x,as.logical(local),as.logical(now)):
 unable to load shared library /home/user/fortran/aaa.so:
 ld.so.1: /usr/local/lib/R/bin/R.bin: fatal: relocation error: file
 /home/ymu/ft/aaa.so: symbol _F90free: referenced symbol not found.

 Does this mean that the shared library was not built successfully or my
 fortran subroutine has some errors?

The former.  You appear to have used different Fortran compilers to build R
and your shared object, since your Fortran support libraries are not being
linked against.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] filtering ts with arima

2003-04-09 Thread Prof Brian D Ripley
I know that there is no direct equivalent to arima.filt in R.  I also know
that your R calls are *not* equivalent to the S-PLUS ones.

I would use S-PLUS to run S-PLUS code: you are a commercial operation and
should be able to afford it, Or you could employ an S programmer to convert
the code for you.

As `_' is strongly deprecated in both S-PLUS and R, it should to be used in
postings.

On Wed, 9 Apr 2003, Samak, Vele [EQRE] wrote:

 Anyone know how to do this? Thanks,

 -Original Message-
 From: Samak, Vele [EQRE]
 Sent: Monday, April 07, 2003 11:30 AM
 To: '[EMAIL PROTECTED]'
 Subject: [R] filtering ts with arima


 Hi,

 I have the following code from Splus that I'd like to migrate to R. So far,
 the only problem is the arima.filt function. This function allows me to
 filter an existing time-series through a previously estimated arima model,
 and obtain the residuals for further use. Here's the Splus code:

 # x is the estimation time series, new.infl is a timeseries that contains
 new information
 # a.mle is estimated result (list) from arima.mle, (1,0,1) x (1,0,1)12
 seasonal model
 mdl   _ list(list(order=c(1,0,1)), list(order=c(1,0,1), period=12))
 a.mle _ arima.mle(x, model = mdl)

 # then, we get regular residuals:
 new.pred_ arima.filt(new.infl, a.mle$model)$pred
 new.res _ new.infl - new.pred

 The R code from library(ts) would be:

 # new.infl is a timeseries
 # a.mle is estimated result (list) from arima.mle, (1,0,1) x (1,0,1)12
 seasonal model
 a2.mle _ arima(x, order=c(1,0,1), seasonal=list(order=c(1,0,1), period=12),
 include.mean=F, method=ML)

 new.infl 
 new.res _ new.infl - new.pred

 What's the arima.filt equivalent in R: filter doesn't seem to take the
 coefficients for a seasonal model correctly, also predict isn't quite the
 answer? Help is appreciated. Thanks,


  Vele Samak
  Vice President
  Global Quantitative Research Group
  CITIGROUP / Smith Barney
  388 Greenwich St. 29th Floor
  New York, NY 10013
  (212) 816-0379

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] command line limit?

2003-03-25 Thread Prof Brian D Ripley
On Tue, 25 Mar 2003, dederderian wrote:

 Very insightful.  Thanks Martin.

 Maybe, I need to explain my problem a little better.

Yes, please do: you seem to be talking about console input lines, not the
command line at all.

 I am creating an R comfile within a perl script.

 When I run this R comfile using:
 source(Rcomfile.txt)
 It works fine.

 When I run it from within my perl script using:
 R --no-save  Rcomfile.txt
 It does not work.
 I receive this error message in the middle of a long command line:
 Error: syntax error
 Execution halted

 I only see this problem when I have really long command lines within the comfile.
 I don't really have a work around for getting rid of my long command lines so I 
 would like to find a way to make this work.

Why can't you call source() in Rcomfile.txt?

AFAIK there is a 1022 char limit on input lines at the console, including
redirected.  From src/unix/system.txt

 *  2. CONSOLE I/O
 *
 *  The first group of functions is concerned with reading and
 *  writing to the system console.
 *
 *int   R_ReadConsole(char *prompt, char *buf, int buflen, int hist)
 *
 *  This function prints the given prompt at the console and then
 *  does a gets(3)-like operation, transferring up to buflen characters
 *  into the buffer buf.  The last two characters are set to \n\0
 *  to preserve sanity.

and buflen is 1024 in src/main/main.c


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] na.action in model.tables and TukeyHSD

2003-02-28 Thread Prof Brian D Ripley
ndata - na.omit(led1t7sts) and work with ndata.

Why is that difficult?

On Fri, 28 Feb 2003, CG Pettersson wrote:

 In 27/2, I got the following answer from Prof. Ripley: (The question is at the 
 bottom)

 This ia already fixed in R-devel.  The answer is the same: don't use
 na.omit implicitly: use it explicitly.

 I feel rather stupid for the moment, as I don´t understand an answer that looks very 
 simple.
 What´s the code to do the trick using na.omit explicitly? (Preferably starting with 
 my code in the question)
 I can´t get it to work, so my tries are not worth printing here...

 Thanks
 /CG

 On Wed, 26 Feb 2003, CG Pettersson wrote:  Hello everybody!
 
  I use R 1.6.2 in Windows, and have a problem controlling the na.action.
 
  In a dataset with twelve trials, one of the trials lack any readings of the 
  variable STS.SH (standing power at harvest)
 
  Fitting an aov() object with the call:
  led1t7sts.aov - aov(STS.SH ~ Trial/Block + Treatment + Treatment:Trial, data = 
  led1t7, na.action=na.exclude)
  seems to work as it produces an object with 10 df for the factor Trial.
 
  But when I use model.tables or TukeyHSD on the object I get this:
   model.tables(led1t7sts.aov, means)
  Error in replications(paste(~, paste(names(tables), collapse = +)),  :
  na.action must be a function
 
  I have tried to use na.action=na.exclude inside the model.tables call as well, 
  without any bettering.
 
  I can naturally cope with the problem by taking the whole trial away from the 
  dataset, but it doesn´t feel very sophisticated...;-)
  (Prof. Ripley answered a similar question from me two weeks ago. The answer was 
  good but didn´t work as the reason of the error was the same as this time: a
 whole
  trial with only na:s in it).
 
  Thanks
  /CG
  CG Pettersson
  [EMAIL PROTECTED]
 CG Pettersson
 [EMAIL PROTECTED]

 __
 [EMAIL PROTECTED] mailing list
 http://www.stat.math.ethz.ch/mailman/listinfo/r-help


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Why does 'exists' need a quoted argument?

2003-02-20 Thread Prof Brian D Ripley
foo - bar
exists(foo)

asks if the object whose name is bar exists, not that whose name is foo
exists.  There is a distinction between operating on objects (rm and is.na)
and names of objects (get, exists, help).

The one exception in your list is help.  That should really be help(rm)
(which works), but help has special semantics (as do library, require and a
few others).


On Thu, 20 Feb 2003, Wright, Kevin wrote:

 Some functions in R need quoted arguments.  Consider this list:

 help(rm)
 rm(a)
 is.na(a)
 get(rm)
 exists(rm)

 Can someone explain why 'get' and 'exists' require quoted object names?

 Would it make sense (more consistency) to have these functions check to see if the 
first argument is a string, and if not, then 'substitute' it?Intuitively, 
'exists' is checking to see if an object exists, not to see if a character string 
exists.  Evidently my intuition is wrong.

 I can see that 'get' might need to have the option of using quotes, for example, 
get(?) or get(*).  However, look at this:

  is.function(?)
 Error: syntax error
  is.function(?)
 [1] FALSE

 I grow used to not quoting things and then stumble over 'exists' from time to time.

 Looking forward to clarity or maybe a request for change.

Get used to quoting things 


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] multivariate sampling question again

2003-02-17 Thread Prof Brian D Ripley
R-devel already contains rmultinom.

I don't see why rejection sampling on (m, n) should be slow unless m-n is
very small or far out in the tails, in which case why do you want this?
In any case, inversion will be a perfectly adequate method as you have
pbeta and qbeta.

On Mon, 17 Feb 2003, Peng Zhang wrote:

 Dr. Bolker

 I just wrote it yesterday. Thank you anyway. However do you have some
 ideas about sampling from restricted beta distribution. say from beta(a,
 b) but value between m and n. Now I generate lots of samples from beta(a,
 b) and then choose value between m and n, but it is very time-consuming.
 Do you have some good ideas? Thanks again!

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] multilm for simseg/acm

2003-02-10 Thread Prof Brian D Ripley
On Mon, 10 Feb 2003, Christian Schulz wrote:

 hi,
 for working with the simseg/acm approach i need multilm and it seems
 that the last version  is 0.1-4.tar ?
 What's wrong in the description file, if i attempt  install the package ?

 c:\DataMining\rw1062\binRcmd Install multilm
 Malformed DCF file (file multilm/DESCRIPTION, line 6)

 [R1.6.2 /W2K]
 P.S.
  ..hmm a solution might be import the functions from multilm
 in my .Rprofile, but i would like understand the package problem !

It appears to have an empty Depends: line, so delete it.
Also, the wrapping on the Description: line is wrong, and there is no
Maintainer field.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] postgres/R access problems

2003-02-09 Thread Prof Brian D Ripley
On 10 Feb 2003, Brendan Murray wrote:

 I have a problem that has exhausted my ingenuity and would like pointers
 to a solution, or at least where to debug.

 - I am using R and postgresql.

And which R package are you using, which version, from which repository?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] floating point question

2003-01-31 Thread Prof Brian D Ripley
It's a difference in the `libc'.  Asking for more precision than the
arithmetic has is asking for fairly random results.  The differences are as
likely to be in the *printing* as in the computations.

On Fri, 31 Jan 2003, Bob Gray wrote:

 Does anyone know precisely what is different about the arithmetic
 and/or storage of double precision floating point to produce the
 following differences between the Sun and Windows versions (Splus 6
 on the same Windows 2000 machine gives the same results as Solaris)?

 R 1.6.1, Sun Solaris, gcc + an old Sun f77
  options(digits=20)
  1+(1/2^53+1/2^106)
 [1] 1
  1+(1/2^53+1/2^105)
 [1] 1.0002
  1+(1/2^53+1/2^64)
 [1] 1.0002
  1+(1/2^53+1/2^63)
 [1] 1.0002

 R 1.6.1, Windows 2000, binary downloaded from CRAN
  options(digits=20)
  1+(1/2^53+1/2^106)
 [1] 1
  1+(1/2^53+1/2^105)
 [1] 1
  1+(1/2^53+1/2^64)
 [1] 1
  1+(1/2^53+1/2^63)
 [1] 1.0002

 (This may be frivolous, but I have been using the first 2 lines as an
 example in a course.)

 Thanks
 --
 Bob Gray

 __
 [EMAIL PROTECTED] mailing list
 http://www.stat.math.ethz.ch/mailman/listinfo/r-help


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] printing reals from C with digits

2003-01-29 Thread Prof Brian D Ripley
On Wed, 29 Jan 2003, Ott Toomet wrote:

 I want to print real numbers in C code with different values for
 digits.  How to do that?

Use Rprintf or PrintValue.  You'll need to work hard to convince me that
Rprintf is not adequate.

 As I have understood, what I should do is to call

 StringFromReal()

That's a coercion, not a printing routine.

 which calls FormatReal(), that one suggests the parameters (width,
 decimal places and exponential form).  FormatReal() includes

 eps = pow(10.0, -(double)R_print.digits);

 So I guess I have to change the value of R_print.digits.
 R_print.digits is defined in include/Print.h in the package source,
 but unfortunately the installed version (in /usr/lib/R/include/R_ext) is
 quite a different.

R_ext/Print.h and Print.h are not the same thing: one is not a version of
the other.  The routines you mention are not documented in R-exts, and are
not part of the API.

 I guess that is because the structure is not meant
 to be accessible by user, although some system routines alter
 R_print.digits directly.

(Only the coercion and print routines!)

 So are there any good way to achieve it?

Temporarily change the options(digits) and call PrintValue().  You are not
meant to (and it is not safe to) mess with R's printing internals, and
these structures change even at patch releases.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] Logistic regression: At times correlation matrix ofcoefficients gets messed up

2003-01-21 Thread Prof Brian D Ripley
It's not messed up, just someone's idea of a compact display.

Options are

1) Use vcov(fit) instead

2) Use print(summary(fit), symbolic.cor=FALSE)

Does anyone think that the current arrangement (use this scheme for more
than 4 coefficients) is sensible?  Surely the abbreviations are not
(( for intercept?), and why is the diagonal being shown but the top row
and last column have been omitted?   If the whole matrix was shown, the
column labels could be omitted.

I'd much prefer symbolic.cor=FALSE to be the default.

On Mon, 20 Jan 2003, Pankaj Choudhary wrote:


 Hi,

 When I include a categorical variable (RACE with 3 levels - white,
 black and other) in my logistic regression model, the correlation
 matrix of the coefficients gets messed up. I get something like:

 -
 Correlation of Coefficients:
   ( A L RACEb
 AGE   , 1
 LWT   ,   1
 RACEblack   1
 RACEother . .
 attr(,legend)
 [1] 0 ` ' 0.3 `.' 0.6 `,' 0.8 `+' 0.9 `*' 0.95 `B' 1
 -

 I couldn't figure out how to interpret it. Here is the sequence of
 commands and the complete output. (I am using R 1.6.2)

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] read.table(file=clipboard,...) for R?

2003-01-20 Thread Prof Brian D Ripley
On Mon, 20 Jan 2003, Prof Brian D Ripley wrote:

 On Mon, 20 Jan 2003, David Parkhurst wrote:

  I use read.table(file=clipboard,...) a lot in s-plus (under windows 2000), but it
  does not seem to work in R (and is not in the help screen for read.table).   Am I
  missing something?  Would this ability be hard to add?

 Yes, it was hard to add, but it already there in R-devel (to be 1.7.0). In
 1.6.2 you can use

 read.table(textConnection(readClipboard), ...)

Oops, the cut-and-paste failed:

read.table(textConnection(readClipboard()), ...)

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help