[R] Generic distributions

2007-03-06 Thread Alberto Monteiro
Is there any class that generalizes distributions?

For example, I could say 
x - generic_distribution(normal, list(mean=1, sigma=0.5))
and then use it like 
rgeneric_distribution(100, x) to get a sample of 100, or
pgeneric_distribution(0.5, x) to get the pdf at (x = 0.5).

In the openbugs/winbugs package, that uses a language that
looks like R/S, we can do things like x ~ dnorm(mu, tau),
forget that x is a normal with mean mu and variance 1/tau,
and then treat it generically.

Alberto Monteiro

PS: this is noise... but due to spam invasion, anything that
increases the nonspam/spam ratio should be welcome :-)

__
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] Subseting data frame based on column names

2007-03-06 Thread Li, Aiguo \(NIH/NCI\) [C]
Hello all,

 

I have a data frame containing 170 columns and would like to generate a
new data frame containing all rows but only 67 columns selected
according to column names.  How can I do this?

 

Thanks in advance,

 

AG Lee


[[alternative HTML version deleted]]

__
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] R and SAS proc format

2007-03-06 Thread John Kane

--- lamack lamack [EMAIL PROTECTED] wrote:

 Dear all, Is there an R equivalent to SAS's proc
 format?

What does the SAS PROC FORMAT do?

__
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] R and SAS proc format

2007-03-06 Thread Frank E Harrell Jr
Ulrike Grömping wrote:
 The down side to R's factor solution: 
 The numerical values of factors are always 1 to number of levels. Thus, it
 can be tough and requires great care to work with studies that have both
 numerical values different from this and value labels. This situation is
 currently not well-supported by R.

You can add an attribute to a variable.  In the sas.get function in the 
Hmisc package for example, when importing SAS variables that have PROC 
FORMAT value labels, an attribute 'sas.codes' keeps the original codes; 
these can be retrieved using sas.codes(variable name).  This could be 
done outside the SAS import context also.

Frank

 
 Regards, Ulrike
 
 P.S.: I fully agree with Frank regarding the annoyance one sometimes
 encounters with formats in SAS! 
 
 
 lamack lamack wrote:
 Dear all, Is there an R equivalent to SAS's proc format?

 Best regards

 J. Lamack

 _
 O Windows Live Spaces é seu espaço na internet com fotos (500 por mês),
 blog 
 e agora com rede social http://spaces.live.com/

 __
 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.


 


-- 
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] Recalling and printing multiple graphs. Is there something in the HISTORY menu that will help?

2007-03-06 Thread John Sorkin
I am re-sending this Email message as it does not appear to have been
received my the R mail list Daemon. My apologies of you receive two
copies of this message. If you do, it will mean that the first message
finally made it through cyberspace to the list server. 
 
I have written an R function that produces multiple graphs. I use
par(ask=TRUE) to allow for the inspection of each graph before the next
graph is drawn. I am looking for a way to recall all graphs drawn in an
R session, and a method that can be used to print all the graphs at one
time. I know that I could simply print each graph after I inspect the
graph, but this gets tiresome if one's function produces tens of graphs.
I suspect that if I knew more about the history menu (which currently
has an entry RECORDING) I could get the graphs to be replayed and
printed, but alas I have not been able to find instructions for using
the HISTORY menu. Please take pity on my  when you let me know that some
easy search or command could get me the information I needed. I have
looked, but clearly in the wrong places.
John 
 
 
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC,
University of Maryland School of Medicine Claude D. Pepper OAIC,
University of Maryland Clinical Nutrition Research Unit, and
Baltimore VA Center Stroke of Excellence

University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524

(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
[EMAIL PROTECTED]
Confidentiality Statement:
This email message, including any attachments, is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.  Any unauthorized use, disclosure or distribution is
prohibited.  If you are not the intended recipient, please contact the
sender by reply email and destroy all copies of the original message. 

[[alternative HTML version deleted]]


__
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] optim(), nlminb() and starting values

2007-03-06 Thread Gabor Grothendieck
If your problem is small enough just use a grid of starting values
and run your optimization on each one and then take the best.


On 3/6/07, Dae-Jin Lee [EMAIL PROTECTED] wrote:
 Hi all !

 I've been trying to maximize a likelihood using optim( ) function, but it
 seems that the function has several local maxima. I've tried in my algorithm
 with different starting values and depending on them optim obtains
 different results...

 I use the L-BFGS-B method setting the lower values as 1e-06, because my
 parameters must be strictly positive. Also tried a log() transformation to
 ensure that my parameters are positive. Don't know if this is useful in this
 case... (also with notLog and notExp functions of mgcv package)

 the function nlminb( ) also have the same problems.


 ¿Is there any thing I'm not considering? I mean other methods instead of
 L-BFGS-B?

 How can I do to take a strategy to begin with good starting values?


 Thanks in advance

 Dae-Jin

 PS: I'm trying to fit a mixed model with REML and several random effects, so
 I maximize over several parameters...

[[alternative HTML version deleted]]


 __
 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] Obtaining figures with exactly placed points

2007-03-06 Thread Scionforbai
Dear list,

I have to plot some geometrical shape given as list of points. My need
is the following: let's say my shape is a 1 inch large square; how can
I plot it with R in a graphic format that gives me an image *exactly*
1 inch large? I tried to set oma, mar and fin parameters, but with no
success.

I'm currently using the xfig driver for the final images are to be
included in latex documents, so I can easily add latex mathematical
text and other things; however, other formats (pdf, eps) will do.

The piece of code:

xfig(R2fig.fig)
par(mar=c(0,0,0,0),oma=c(0,0,0,0),fin=c(1,1))#no margin, figure
dimension 1x1 inch
plot(0,0,n,xlim=c(0,1),ylim=c(0,1),axes=F,ann=F)
rect(0,0,1,1)
dev.off()

gives me not what I want:
$ cat R2fig.fig
#FIG 3.2
Landscape
Flush left
Inches
A4
100.00
Single
-2
1200 2
# End of XFig header
2 2 0 1 0 -1 100 0 -1 4.000 0 0 -1 0 0 5
 0  0 0  0   0 

And this is what it should be (drawn by Xfig itself):
$ cat Xfig.fig
#FIG 3.2
Landscape
Flush left
Inches
A4
100.00
Single
-2
1200 2
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
 0 0 1200 0 1200 1200 0 1200 0 0

The interesting part is the last line; 1200 is replaced by  in the
R ouput. Why is the R ouput still scaled? Do I miss some graphic
parameter?

Any tip is appreciated,
marco

__
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] Question about the smooth.Pspline

2007-03-06 Thread Petr Klasterecky
Xuhong Zhu napsal(a):
 Hello, Everyone,
 
 I want to use the smooth.Pspline to smooth my data but R give me the
 error message as follows:
 
 Error in smooth.Pspline(sort.e$time, sort.e$cuff, method = 3) :
 X not strictly increasing
 
 my data looks like the following:
 
 id   cuff   time patient
 ...
 2783 13.229608  478   6
 3472 20.904825  478   7
 4155 15.033727  478   8
 4845 19.342963  478   9
 715   8.00  479   3
 1422 22.052385  479   4
 2110 15.393063  479   5
 2784 13.200922  479   6
 3473 20.900132  479   7
 ...
 
 my R codes is:
 
 e - rbind(patient.1,patient.2,patient.3,...)
 attach(e)
 sort.e - e[order(time),]
 plot(sort.e$time, sort.e$cuff, xlab=Time, ylab=Cuff,type=p, col=3,
 xlim=c(c[2],d[2]) , ylim=c(c[1], d[1]) , main=one Smooth Curve for 10
 Patients)
 fm - smooth.Pspline(sort.e$time, sort.e$cuff, method=3)
 lines(fm$x, fm$y, lty=1,col=1)
 
 
 What I am doing here is to combine the data together and find a smooth
 curve. My question is if the smooth.Pspline could not be used in my
 data since the variable time has repeated values.

Quoted from your error message:
  Error in smooth.Pspline(sort.e$time, sort.e$cuff, method = 3) :
  X not strictly increasing

Quoted from help of smooth.Pspline (which, as you should have told us by 
the way, is contained in package pspline):

Arguments:
x   values of the predictor variable. These must be strictly increasing, 
and there must be at least 2*norder + 1 of them.
sm.spline provides a simplified interface, in which the x values can be 
unsorted, or a list with components x and y or a two-column matrix 
or a complex vector.

Strictly increasing = no repeated values...
Petr

 
 Xuhong
 
 __
 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.
 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

__
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] qr decomposition issue inside lm

2007-03-06 Thread Horace Tso
Dear list,

It's never happened to me before in such a simple exercise but is not going 
away and I've checked my data are good. I want a simple lm model with one 
response and one predictor, where N is about 4,200 * data set not exactly 
small. Both x and y are nice, continuous variables having NA filtered out with 
a call to na.omit. So I did

mod = lm( y ~ x, data=x1)

Then the error,

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
NA/NaN/Inf in foreign function call (arg 4)

I did a trace back and it turned out it's an error thrown by the Fortran 
subroutine that seems to be trying a QR decomposition,

traceback()
3: .Fortran(dqrls, qr = x, n = n, p = p, y = y, ny = ny, tol = 
as.double(tol), 
   coefficients = mat.or.vec(p, ny), residuals = y, effects = y, 
   rank = integer(1), pivot = 1:p, qraux = double(p), work = double(2 * 
   p), PACKAGE = base)
2: lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...)
1: lm(log.p.sales ~ log.mktcap, data = x1)

My question is why would QR fail since the default in lm.fit is 'singular.ok' ? 
Furthermore, is there a way to get around presumably a singularity in my design 
matrix? 

Thanks in advance.

Horace W. Tso

__
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] Memory Limits in Ubuntu Linux

2007-03-06 Thread Uwe Ligges


[EMAIL PROTECTED] wrote:
 I am an R user trying to get around the 2Gig memory limit in Windows, so 
 here I am days later with a working Ubuntu, and R under Ubuntu. But - the 
 memory problems seem worse than ever. R code that worked under 
 windows fails, unable to allocate memory.
 
 Searching around the web, it appears that the problem may be the ability to 
 find contguous memory for my big vectors, but a fresh boot of Ubuntu does 
 not help either.
 
 Which way to go?
 
 1) Try to install 64-bit version for bigger address space. Would this help? 
 Is 
 this workable for my Athlon 64 Dual-core? (the live cd seems to work but I 
 never got it to boot after a disk install, but then the 386 version was no 
 better 
 until I learned more about Grub...I could try again if this might solve the 
 problem)

If you really have got such amounts of RAM in that machine, it should be 
worth trying.

Uwe Ligges


 2) Recompile R to get bigger memory capability? (I'll have to cross-post to 
 some R forums too)
 This will be a challenge for a Linux newbie...like me.
 
 3) Any other suggestions? My goal is to create a bigger neural network than 
 fits in my Windows R version.

__
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] Subseting data frame based on column names

2007-03-06 Thread Uwe Ligges


Li, Aiguo (NIH/NCI) [C] wrote:
 Hello all,
 
  
 
 I have a data frame containing 170 columns and would like to generate a
 new data frame containing all rows but only 67 columns selected
 according to column names.  How can I do this?

For date.frame d and column names in vector cn:

d[,cn]

Uwe Ligges



  
 
 Thanks in advance,
 
  
 
 AG Lee
 
 
   [[alternative HTML version deleted]]
 
 __
 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] Substituting functions in package - Lattice

2007-03-06 Thread Saptarshi Guha
Hi,
I'm trying to learn how a package works but substituting a  
parituclart function with my own (basically the original one with  
some debug statements).
The package is lattice and the method is print.trellis which is a  
S3 method and is not visible.
To replace this, i sourced a file with the rewritten print.trellis,  
and the old one was replaced.
However, i get this error when I attempt to print a trellis object  
(e.g an xyplot)

Error in assign(last.object, x, env = .LatticeEnv) :
object .LatticeEnv not found

I notice that .LatticeEnv is defined in zzz.R (in the R folder of  
the lattice source).

My question, how does one do development on the lattice package  
without having to recompile everything and install a package?

I read something about emacs and development (i use emacs) in the  
zzz.R file
## .First.lib will be used if the NAMESPACE file is missing.  This is
## useful during development, thanks to C-c C-l in Emacs/ESS. It won't
## be used if a NAMESPACE file is present.  Note: Due to registration
## of C functions done in the NAMESPACE file, wireframe (and possibly
## cloud) won't work in this scenario.

But couldn't quite figure it out.
Thanks for any help provided.
Saptarshi


Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


[[alternative HTML version deleted]]

__
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] Generate random numbers up to one

2007-03-06 Thread Ted Harding
On 06-Mar-07 Alberto Monteiro wrote:
 Ted Harding wrote:
 
 And, specifically (to take just 2 RVs X and Y), while U = X/(X+Y)
 and V = Y/(A+Y) are two RVs which summ to 1, the distribution of U
 is not the same as the distribution of X conditional on (X+Y = 1).
 
 This question

Which question? There are (implicitly) two questions there!

 appeared in October 2006, and the answer

To the second question (X conditional on X+Y=1)

 was the Dirichlet distribution with parameters (1,1,1...1):
 
 http://en.wikipedia.org/wiki/Dirichlet_distribution
 
 It's the distribution of uniform U1, U2, ... Un with the
 restriction that U1 + U2 + ... + Un = 1.

Indeed, and the resulting (U1,U2,...,Un) is uniformly distributed
on the simplex U1+U2+...+Un=1. For n2, however, the resulting
marginal distribution of (say) U1 conditional on (U1+U2+...+Un=1)
is no longer uniform (that only holds for n=2, as in my example).
For n=3 this is easy to see: P[U1  u1] is the area of the triangular
simplex between its vertex at (1,0,0) and the line from (u1,1-u1,0)
to (u1,0,0), and this is equal to (1 - u1)^2, so the density of U1
is f(u1) = 2*(1-u1).  In general, the marginal density of U1
in the n-dimensional Dirichlet is (n-1)*(1-u1)^(n-2).

But the aim was to illustrate Petr Klasterecky's point that

  sum(x) is a random variable as well and dividing by
   sum(x) does not preserve the original distribution
   data were generated from.

namely to show two ways of generating RVs distributed on
U1 + U2 + ... + Un = 1, starting from independent RVs, which
result on two different distributions, and to give an example
where dividing by sum(x) can be seen to not preserve the
distribution.

Indeed, I think there is sometimes a confusion between this
question and the really unrelated question: Given non-negative
numbers V1, V2, ..., Vn, how can we convert then to a probability
distribution? To which the answer is, of course, divide by their
sum.

With best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 06-Mar-07   Time: 22:01:34
-- XFMail --

__
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] Generic distributions

2007-03-06 Thread Greg Snow
I think the distr package does this.  There are also packages that link
to winbugs if that is what you really want to do.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Alberto Monteiro
 Sent: Tuesday, March 06, 2007 1:38 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Generic distributions
 
 Is there any class that generalizes distributions?
 
 For example, I could say
 x - generic_distribution(normal, list(mean=1, sigma=0.5)) 
 and then use it like rgeneric_distribution(100, x) to get a 
 sample of 100, or pgeneric_distribution(0.5, x) to get the 
 pdf at (x = 0.5).
 
 In the openbugs/winbugs package, that uses a language that 
 looks like R/S, we can do things like x ~ dnorm(mu, tau), 
 forget that x is a normal with mean mu and variance 1/tau, 
 and then treat it generically.
 
 Alberto Monteiro
 
 PS: this is noise... but due to spam invasion, anything that 
 increases the nonspam/spam ratio should be welcome :-)
 
 __
 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] Stangle and annotate

2007-03-06 Thread Brett Presnell

How exactly should I go about turning off annotation when running
Stangle (Rtangle) with R CMD Stangle myfile.Rnw?

Ideally I would like to be able to turn annotation off and on for
individual code chunks, or maybe better, to annotate only named
chunks.  Are either of these things easily done?

Is there some way to figure out this sort of thing without reading
through the source code in Sweave.R?

-- 
Brett Presnell
Department of Statistics
University of Florida

__
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] Recalling and printing multiple graphs. Is there something in the HISTORY menu that will help?

2007-03-06 Thread Mike Prager
John Sorkin [EMAIL PROTECTED] wrote:

 I have written an R function that produces multiple graphs. I use
 par(ask=TRUE) to allow for the inspection of each graph before the next
 graph is drawn. I am looking for a way to recall all graphs drawn in an
 R session, and a method that can be used to print all the graphs at one
 time. I know that I could simply print each graph after I inspect the
 graph, but this gets tiresome if one's function produces tens of graphs.
 I suspect that if I knew more about the history menu (which currently
 has an entry RECORDING) I could get the graphs to be replayed and
 printed, but alas I have not been able to find instructions for using
 the HISTORY menu. Please take pity on my  when you let me know that some
 easy search or command could get me the information I needed. I have
 looked, but clearly in the wrong places.
  
 John Sorkin M.D., Ph.D.

I assume you are on Windows (please give OS and R version in
future help requests).  

The code I use before starting such functions is

graphics.off()
windows(record=TRUE)
.SavedPlots - NULL

which closes existing graphics devices, opens a windows device
with recording on, and deletes any existing graphics history.

You can go through the history with PageUp and PageDown keys.

Within your function, you can call savePlot (q.v.) to save each
plot to a file just after it is generated.

HTH

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

__
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] Memory Limits in Ubuntu Linux

2007-03-06 Thread Christos Hatzis
Take a look at Windows FAQ 2.9.  Following the instructions there, I was
able to make WinXP use at least 3GB of RAM (physical RAM installed) with
Rgui.exe.

-Christos

Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 [EMAIL PROTECTED]
 Sent: Tuesday, March 06, 2007 3:44 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Memory Limits in Ubuntu Linux
 
 I am an R user trying to get around the 2Gig memory limit in 
 Windows, so here I am days later with a working Ubuntu, and R 
 under Ubuntu. But - the memory problems seem worse than ever. 
 R code that worked under windows fails, unable to allocate memory.
 
 Searching around the web, it appears that the problem may be 
 the ability to find contguous memory for my big vectors, but 
 a fresh boot of Ubuntu does not help either.
 
 Which way to go?
 
 1) Try to install 64-bit version for bigger address space. 
 Would this help? Is this workable for my Athlon 64 Dual-core? 
 (the live cd seems to work but I never got it to boot after a 
 disk install, but then the 386 version was no better until I 
 learned more about Grub...I could try again if this might solve the
 problem)
 
 2) Recompile R to get bigger memory capability? (I'll have to 
 cross-post to some R forums too) This will be a challenge for 
 a Linux newbie...like me.
 
 3) Any other suggestions? My goal is to create a bigger 
 neural network than fits in my Windows R version.
 --
 David Katz
  www.davidkatzconsulting.com
541 482-1137
 
   [[alternative HTML version deleted]]
 
 __
 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.


Re: [R] Obtaining figures with exactly placed points

2007-03-06 Thread Scionforbai
 plot(0,0,n,xlim=c(0,1),ylim=c(0,1),axes=F,ann=F,xaxs='i',yaxs='i')

It was exactly this!

 *8/100+
[1] 1199.88

Thanks,
Marco

__
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] Subseting data frame based on column names

2007-03-06 Thread Greg Snow
Use the subset function and the select argument of that function to
specify the columns.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Li, 
 Aiguo (NIH/NCI) [C]
 Sent: Tuesday, March 06, 2007 2:02 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Subseting data frame based on column names
 
 Hello all,
 
  
 
 I have a data frame containing 170 columns and would like to 
 generate a new data frame containing all rows but only 67 
 columns selected according to column names.  How can I do this?
 
  
 
 Thanks in advance,
 
  
 
 AG Lee
 
 
   [[alternative HTML version deleted]]
 
 __
 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.


Re: [R] Obtaining figures with exactly placed points

2007-03-06 Thread Greg Snow
Try:

plot(0,0,n,xlim=c(0,1),ylim=c(0,1),axes=F,ann=F,xaxs='i',yaxs='i')

To see if that fixes it for you (without the xaxs and yaxs arguments it
adds 4% of the range to each side so that any points plotted do not fall
to close to the axes.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Scionforbai
 Sent: Tuesday, March 06, 2007 2:42 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Obtaining figures with exactly placed points
 
 Dear list,
 
 I have to plot some geometrical shape given as list of 
 points. My need is the following: let's say my shape is a 1 
 inch large square; how can I plot it with R in a graphic 
 format that gives me an image *exactly*
 1 inch large? I tried to set oma, mar and fin parameters, but 
 with no success.
 
 I'm currently using the xfig driver for the final images are 
 to be included in latex documents, so I can easily add latex 
 mathematical text and other things; however, other formats 
 (pdf, eps) will do.
 
 The piece of code:
 
 xfig(R2fig.fig)
 par(mar=c(0,0,0,0),oma=c(0,0,0,0),fin=c(1,1))#no margin, 
 figure dimension 1x1 inch
 plot(0,0,n,xlim=c(0,1),ylim=c(0,1),axes=F,ann=F)
 rect(0,0,1,1)
 dev.off()
 
 gives me not what I want:
 $ cat R2fig.fig
 #FIG 3.2
 Landscape
 Flush left
 Inches
 A4
 100.00
 Single
 -2
 1200 2
 # End of XFig header
 2 2 0 1 0 -1 100 0 -1 4.000 0 0 -1 0 0 5
  0  0 0  0   0 
 
 And this is what it should be (drawn by Xfig itself):
 $ cat Xfig.fig
 #FIG 3.2
 Landscape
 Flush left
 Inches
 A4
 100.00
 Single
 -2
 1200 2
 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
  0 0 1200 0 1200 1200 0 1200 0 0
 
 The interesting part is the last line; 1200 is replaced by 
  in the R ouput. Why is the R ouput still scaled? Do I 
 miss some graphic parameter?
 
 Any tip is appreciated,
 marco
 
 __
 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.


Re: [R] Substituting functions in package - Lattice

2007-03-06 Thread Greg Snow
You need to set the environment on your version of print.trellis to
match that of the original (at least that is what has worked for me when
trying to do modified functions from the trellis package).  Try
something like:

 environment(print.trellis) - environment(lattice::print.trellis)

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Saptarshi Guha
 Sent: Tuesday, March 06, 2007 2:55 PM
 To: R-Help
 Subject: [R] Substituting functions in package - Lattice
 
 Hi,
   I'm trying to learn how a package works but 
 substituting a parituclart function with my own (basically 
 the original one with some debug statements).
   The package is lattice and the method is 
 print.trellis which is a
 S3 method and is not visible.
   To replace this, i sourced a file with the rewritten 
 print.trellis, and the old one was replaced.
   However, i get this error when I attempt to print a 
 trellis object (e.g an xyplot)
   
   Error in assign(last.object, x, env = .LatticeEnv) :
   object .LatticeEnv not found
   
   I notice that .LatticeEnv is defined in zzz.R (in the R 
 folder of the lattice source).
 
   My question, how does one do development on the lattice 
 package without having to recompile everything and install a package?
 
   I read something about emacs and development (i use 
 emacs) in the zzz.R file
   ## .First.lib will be used if the NAMESPACE file is 
 missing.  This is ## useful during development, thanks to C-c 
 C-l in Emacs/ESS. It won't ## be used if a NAMESPACE file is 
 present.  Note: Due to registration ## of C functions done in 
 the NAMESPACE file, wireframe (and possibly ## cloud) won't 
 work in this scenario.
 
   But couldn't quite figure it out.
   Thanks for any help provided.
   Saptarshi
 
 
 Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
 
 
   [[alternative HTML version deleted]]
 
 __
 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.


Re: [R] Substituting functions in package - Lattice

2007-03-06 Thread Saptarshi Guha
Hi,
Unfortunately, print.trellis is not exported .
 environment(print.trellis) - environment(lattice::print.trellis)

returns Error: 'print.trellis' is not an exported object from  
'namespace:lattice'

I then took the environment of lattice

search()
#package:lattice is the 2nd element
latt-as.environment(2)
environment(print.trellis)-latt

Yet, i get the same error as before when I run print(k), where k is  
a trellis object.

This is the line in NAMESPACE for lattice (from the source)
S3method(print,trellis)

Thanks
Saptarshi


Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


On Mar 6, 2007, at 5:29 PM, Greg Snow wrote:

 You need to set the environment on your version of print.trellis to
 match that of the original (at least that is what has worked for me  
 when
 trying to do modified functions from the trellis package).  Try
 something like:

 environment(print.trellis) - environment(lattice::print.trellis)

 Hope this helps,

 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 (801) 408-8111



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Saptarshi Guha
 Sent: Tuesday, March 06, 2007 2:55 PM
 To: R-Help
 Subject: [R] Substituting functions in package - Lattice

 Hi,
  I'm trying to learn how a package works but
 substituting a parituclart function with my own (basically
 the original one with some debug statements).
  The package is lattice and the method is
 print.trellis which is a
 S3 method and is not visible.
  To replace this, i sourced a file with the rewritten
 print.trellis, and the old one was replaced.
  However, i get this error when I attempt to print a
 trellis object (e.g an xyplot)
  
  Error in assign(last.object, x, env = .LatticeEnv) :
  object .LatticeEnv not found
  
  I notice that .LatticeEnv is defined in zzz.R (in the R
 folder of the lattice source).

  My question, how does one do development on the lattice
 package without having to recompile everything and install a package?

  I read something about emacs and development (i use
 emacs) in the zzz.R file
  ## .First.lib will be used if the NAMESPACE file is
 missing.  This is ## useful during development, thanks to C-c
 C-l in Emacs/ESS. It won't ## be used if a NAMESPACE file is
 present.  Note: Due to registration ## of C functions done in
 the NAMESPACE file, wireframe (and possibly ## cloud) won't
 work in this scenario.

  But couldn't quite figure it out.
  Thanks for any help provided.
  Saptarshi


 Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


  [[alternative HTML version deleted]]

 __
 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] qr decomposition issue inside lm (solved)

2007-03-06 Thread Horace Tso
Folks, apologize for such an obvious oversight on my part. The reason qr
fails is, one of the data points has value of -Inf (response is actually
the log of something, and I have a zero in the original set). That
explains the error message in call to dqrls. I should have taken the
mean of the response before proceeding and that would tell me right away
what's wrong. 

Thanks.

H.

 Horace Tso [EMAIL PROTECTED] 3/6/2007 1:45:28 PM 
Dear list,

It's never happened to me before in such a simple exercise but is not
going away and I've checked my data are good. I want a simple lm model
with one response and one predictor, where N is about 4,200 * data set
not exactly small. Both x and y are nice, continuous variables having NA
filtered out with a call to na.omit. So I did

mod = lm( y ~ x, data=x1)

Then the error,

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...)
: 
NA/NaN/Inf in foreign function call (arg 4)

I did a trace back and it turned out it's an error thrown by the
Fortran subroutine that seems to be trying a QR decomposition,

traceback()
3: .Fortran(dqrls, qr = x, n = n, p = p, y = y, ny = ny, tol =
as.double(tol), 
   coefficients = mat.or.vec(p, ny), residuals = y, effects = y, 
   rank = integer(1), pivot = 1:p, qraux = double(p), work =
double(2 * 
   p), PACKAGE = base)
2: lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...)
1: lm(log.p.sales ~ log.mktcap, data = x1)

My question is why would QR fail since the default in lm.fit is
'singular.ok' ? Furthermore, is there a way to get around presumably a
singularity in my design matrix? 

Thanks in advance.

Horace W. Tso

__
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.


Re: [R] Substituting functions in package - Lattice

2007-03-06 Thread Saptarshi Guha
Hi,
Got it. This worked
environment(print.trellis) - getNamespace(lattice)
where print.trellis is my modified print.trellis.

Thanks.
Regards
Saptarshi

Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha

On Mar 6, 2007, at 5:29 PM, Greg Snow wrote:

 You need to set the environment on your version of print.trellis to
 match that of the original (at least that is what has worked for me  
 when
 trying to do modified functions from the trellis package).  Try
 something like:

 environment(print.trellis) - environment(lattice::print.trellis)

 Hope this helps,

 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 (801) 408-8111



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Saptarshi Guha
 Sent: Tuesday, March 06, 2007 2:55 PM
 To: R-Help
 Subject: [R] Substituting functions in package - Lattice

 Hi,
  I'm trying to learn how a package works but
 substituting a parituclart function with my own (basically
 the original one with some debug statements).
  The package is lattice and the method is
 print.trellis which is a
 S3 method and is not visible.
  To replace this, i sourced a file with the rewritten
 print.trellis, and the old one was replaced.
  However, i get this error when I attempt to print a
 trellis object (e.g an xyplot)
  
  Error in assign(last.object, x, env = .LatticeEnv) :
  object .LatticeEnv not found
  
  I notice that .LatticeEnv is defined in zzz.R (in the R
 folder of the lattice source).

  My question, how does one do development on the lattice
 package without having to recompile everything and install a package?

  I read something about emacs and development (i use
 emacs) in the zzz.R file
  ## .First.lib will be used if the NAMESPACE file is
 missing.  This is ## useful during development, thanks to C-c
 C-l in Emacs/ESS. It won't ## be used if a NAMESPACE file is
 present.  Note: Due to registration ## of C functions done in
 the NAMESPACE file, wireframe (and possibly ## cloud) won't
 work in this scenario.

  But couldn't quite figure it out.
  Thanks for any help provided.
  Saptarshi


 Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


  [[alternative HTML version deleted]]

 __
 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.


Re: [R] Stangle and annotate

2007-03-06 Thread Duncan Murdoch
On 3/6/2007 5:20 PM, Brett Presnell wrote:
 How exactly should I go about turning off annotation when running
 Stangle (Rtangle) with R CMD Stangle myfile.Rnw?
 
 Ideally I would like to be able to turn annotation off and on for
 individual code chunks, or maybe better, to annotate only named
 chunks.  Are either of these things easily done?
 
 Is there some way to figure out this sort of thing without reading
 through the source code in Sweave.R?

I don't think R CMD Stangle has a way to pay attention to optional args 
to Stangle, but this works:

echo Stangle('myfile.Rnw', annotate=F) | Rterm --slave

Duncan Murdoch

__
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] R and SAS proc format

2007-03-06 Thread Jason Barnhart

- Original Message - 
From: John Kane [EMAIL PROTECTED]
To: lamack lamack [EMAIL PROTECTED]; R-help@stat.math.ethz.ch
Sent: Tuesday, March 06, 2007 2:13 PM
Subject: Re: [R] R and SAS proc format



 --- lamack lamack [EMAIL PROTECTED] wrote:

 Dear all, Is there an R equivalent to SAS's proc
 format?

 What does the SAS PROC FORMAT do?

It formats or reformats data in the SAS system.

It looks this:

proc format; value kanefmt 1='A' 2='B' 3='C' 4='X' 5='Throw me 
out';
data temp; do i=1 to 10; kanevar=put(i,kanefmt.); output; end;
proc print; run;

And produces this:

Obs i  kanevar
  1 1A
  2 2B
  3 3C
  4 4X
  5 5Throw me out
  6 6   6
  7 7   7
  8 8   8
  9 9   9
 1010  10


But it is more robust than what is shown here.




 __
 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] Waiting for Key input

2007-03-06 Thread Saptarshi Guha
Hi,
I have another question. Is there any command that waits for key input?
I am running R on OS X, so getGraphicsEvents doesn't work.
I have put some debug print messages in a function and would like to  
pause the code every time the message is printed and continue on a  
keypress.

Thank you
Saptarshi

Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha


[[alternative HTML version deleted]]

__
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] Question

2007-03-06 Thread Michael Kubovy
 How can I evaluate two or more expressions to return two or more  
 columns?

 eval(expression(with(bd,Var1*100),with(bd,Var2*200)))

 The execution is always for the last expression. I can't execute  
 the two expressions at the same time. It is possible?

How about something like this

with(bd, c(Var1 * 100, Var2 * 200))
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
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] Estimating parameters of 2 phase Coxian using optim

2007-03-06 Thread Gad Abraham
Andy Fugard wrote:
 Hi There,
 
 Perhaps the problem is the line
 
  loglik-log(p %*% expm(Q * y(i)) %*% q)
 
 You mention that y is a vector but here you're treating it as a  
 function.  Maybe try
 
  loglik-log(p %*% expm(Q * y[i]) %*% q)
 
 ?
 
 Don't have a clue about the correctness of the contents of cox2.lik...
 
 Andy
 
 
 On 6 Mar 2007, at 08:54, Laura Hill wrote:
 
 Hi,

 My name is Laura. I'm a PhD student at Queen's University Belfast  
 and have
 just started learning R. I was wondering if somebody could help me  
 to see
 where I am going wrong in my code for estimating the parameters  
 [mu1, mu2,
 lambda1] of a 2-phase Coxian Distribution.

 cox2.lik-function(theta, y){
 mu1-theta[1]

 mu2-theta[2]

 lambda1-theta[3]

 p-Matrix(c(1, 0), nrow=1, ncol=2)

 Q-Matrix(c(-(lambda1 + mu1), 0, lambda1, -mu2), nrow=2, ncol=2)

 q-Matrix(c(mu1, mu2), nrow=2, ncol=1)

 for (i in 1:length(y)){
 loglik-log(p %*% expm(Q * y(i)) %*% q)
 return(loglik)}

 sumloglik-sum(loglik)

 return(-sumloglik)
 }

Just to add my 2 AU cents regarding the for loop:

You're trying to create a vector of log likelihoods to sum up later, but 
that's not what's happening there. Instead, assign an empty vector of 
same length as y, then assign the loglik from each iteration to a 
different cell.

Lastly, there's no need to return anything from a for loop, it's not a 
function.

HTH,
Gad

-- 
Gad Abraham
Department of Mathematics and Statistics
The University of Melbourne
Parkville 3010, Victoria, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

__
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] R plug in for Eclipse

2007-03-06 Thread Harry Ho
Hi Dominik,

Yes, I am currently running

Version: 3.2.2
Build id: M20070212-1330


From: Dominik Holenstein [EMAIL PROTECTED]
To: Harry Ho [EMAIL PROTECTED]
Subject: Re: [R] R plug in for Eclipse
Date: Tue, 6 Mar 2007 23:00:29 +0100

Hi,
Are you using Eclipse 3.2?

semanticum

2007/3/6, Harry Ho [EMAIL PROTECTED]:
Hello,

Is there any R plug-in available for Eclipse other than StatET?

StatET doesn't seem to work with the latest release of Eclipse properly,
i.e. syntax highlighting isn't enabled for R commands. I already contacted
the author some time ago, but have not yet received a response.

Would also be great if somebody could tell me whether they have the same
problem. I already tried installing it on two different machines so I 
guess
it isn't a local problem, but you never know...


Thx a lot

_
Sie suchen E-Mails, Dokumente oder Fotos? Die neue MSN Suche Toolbar mit
Windows-Desktopsuche liefert in sekundenschnelle Ergebnisse. Jetzt neu!

__
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.


_
Sie suchen E-Mails, Dokumente oder Fotos? Die neue MSN Suche Toolbar mit 
Windows-Desktopsuche liefert in sekundenschnelle Ergebnisse. Jetzt neu!

__
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] Off topic:Spam on R-help increase?

2007-03-06 Thread Marc Schwartz
On Tue, 2007-03-06 at 12:36 -0600, Douglas Bates wrote:
 On 3/6/07, Peter Dalgaard [EMAIL PROTECTED] wrote:
  Bert Gunter wrote:
   Folks:
  
   In the past 2 days I have seen a large increase of  spam getting into
   R-help. Are others experiencing this problem? If so, has there been some
   change to the spam filters on the R-servers? If not, is the problem on my
   end?
  
   Feel free to reply privately.
  
  Martin Maechler is still walking about upside-down after the DSC, slated
  to return on March 8 (plus presumably a day or two to recover from the
  flight...).
 
 Actually he is walking around sideways at present.  He's in Dubai, not
 New Zealand.

LOLand hopefully having a great time.

It is at times like these, as Uwe noted, where it becomes clear the
extent and results of Martin's efforts in filtering this stuff from the
lists.

Martin deserves a hearty Well Done! for managing this great resource
in a superior fashion.

Regards,

Marc

__
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] Memory Limits in Ubuntu Linux

2007-03-06 Thread Dirk Eddelbuettel

On 6 March 2007 at 12:43, [EMAIL PROTECTED] wrote:
| I am an R user trying to get around the 2Gig memory limit in Windows, so 

The real limit on 32bit systems is a 3gb address space. R under Windows can
get there, see the R-Windows FAQ.

| here I am days later with a working Ubuntu, and R under Ubuntu. But - the 
| memory problems seem worse than ever. R code that worked under 
| windows fails, unable to allocate memory.

Well, maybe you had virtual memory enabled under Windows but not under
Ubuntu. Or maybe you had other memory-hungry applications up under Ubuntu.

There is only so much magic the OS can do.  You easiest remedy will be to
upgrade to 4gb.  And even 8gb can useful on 32bit system, despite the fact
that each individual address space can only max out at 3gb, as you may have
multi-core / multi-cpu systems that allow you to multitask better.  
 
| Which way to go?
| 
| 1) Try to install 64-bit version for bigger address space. Would this help?

Yes, but you'd probably would have to buy more ram to. The main advantage is
that your limit is now way above the 3gb -- and probably set by your hardware
or budget. Maybe it is as high as 16gb.

But again, on the _same_ box with the _same_ amount of ram that is already
constrained under 32bit, you will not see any improvement.  Rather the
opposite as the basic building block is now 8 bytes instead of 4, you will
need more memory for the same tasks.  No free lunch, as they say.

| 2) Recompile R to get bigger memory capability?

Nope. It's what you give your OS in terms of RAM what's binding here.

| 3) Any other suggestions? 

Different algorithms or approaches, tricks like the data.frame-in-sqlite or
biglm, ...

Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

__
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] Sigmoidal Fitting

2007-03-06 Thread Cressoni, Massimo \(NIH/NHLBI\) [F]

I want to thank professor Tura for his help but the function in some cases 
fails to converge and I am not able to
understand the reason :

 GAS
[1] 0.8108649 1.0386906 1.1638837 2.4144286
 PRESSURE
[1]  0  5 15 45
  model.1 - nls(GAS_PER_G ~ SSlogis(PRESSURE, ASym, xmid, scal))
 
 model.1 - nls(GAS_PER_G ~ SSlogis(PRESSURE, ASym, xmid, scal))
Error in nls(y ~ 1/(1 + exp((xmid - x)/scal)), data = xy, start = list(xmid = 
aux[1],  : 
step factor 0.000488281 reduced below 'minFactor' of 0.000976562
 

Massimo Cressoni

__
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] Sweave issue: quotes in verbatim-like output print incorrectly

2007-03-06 Thread Peter Dunn
Hi all

I love Sweave; use it all the time.

But I recently received a new computer, and ever since I
have had a problem I've never seen before.

For example, I place the following in my Snw file:

=
sms - 
read.table(http://www.sci.usq.edu.au/staff/dunn/Datasets/applications/popular/smsspeed.dat;,
header=TRUE)
attach(sms)

sms.lm - lm( Time ~ Age*Phone, subset=(Age30) )
summary(sms.lm)
@

Standard stuff.   The output appears in the corresponding LaTeX
file as it should, in a verbatim-like environment as it should. 

But since I have had this new machine, this line of output:

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

appears in my resulting pdf document as

Signif. codes: 0 ^a˘A¨Y***^a˘A´Z0.001 ^a˘A¨Y**^a˘A´Z0.01 ^a˘A¨Y*^a
˘A´Z0.05 ^a˘A¨Y.^a˘A´Z0.1 ^a˘A¨Y^a˘A´Z1

In short, every quote is replaced by garbage.  This makes my
output looks incredibly bad.  (This is true for all cases; the above
is the output from my example.)

I also imagine (hope!) there is a very simple fix.  Can anyone help me?

Documents which used to produce the correct output document
now do this, so it must be something to do with my machine 
set up, or R set up, rather than the documents themselves, I guess.

Any help appreciated.  I have no idea where to look for the solution
(the FAQ. manuals and mailing archives were no help that I could see;
happy to be corrected).

P.


 version
   _
platform   i486-pc-linux-gnu
arch   i486
os linux-gnu
system i486, linux-gnu
status Patched
major  2
minor  4.0
year   2006
month  11
day25
svn rev39997
language   R
version.string R version 2.4.0 Patched (2006-11-25 r39997)

 sessionInfo()
R version 2.4.0 Patched (2006-11-25 r39997)
i486-pc-linux-gnu

locale:
LC_CTYPE=en_AU.UTF-8;LC_NUMERIC=C;LC_TIME=en_AU.UTF-8;LC_COLLATE=en_AU.UTF-8;LC_MONETARY=en_AU.UTF-8;LC_MESSAGES=en_AU.UTF-8;LC_PAPER=en_AU.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_AU.UTF-8;LC_IDENTIFICATION=C

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

-- 
Dr Peter Dunn  |  dunn at usq.edu.au
Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn
Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc

This email (including any attached files) is confidential an...{{dropped}}

__
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] Waiting for Key input

2007-03-06 Thread Petr Klasterecky
?browser
?readline

Petr

Saptarshi Guha napsal(a):
 Hi,
   I have another question. Is there any command that waits for key input?
   I am running R on OS X, so getGraphicsEvents doesn't work.
   I have put some debug print messages in a function and would like to  
 pause the code every time the message is printed and continue on a  
 keypress.
 
   Thank you
   Saptarshi
 
 Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
 
 
   [[alternative HTML version deleted]]
 
 __
 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.
 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

__
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] Generic distributions

2007-03-06 Thread Matthias Kohl
Hello Alberto, hello Greg,

in distr you can do:

library(distr)
N - Norm(mean = 1, sd = 2)
p(N)(0.5)
r(N)(100)

!!! not: p(N, 0.5) or r(N, 100) !!!
A detailed description of package distr is given in package distrDoc.

library(distrDoc)
vignette(distr)

hth
Matthias



- original message 

Subject: Re: [R] Generic distributions
Sent: Tue, 06 Mar 2007
From: Greg Snow[EMAIL PROTECTED]

 I think the distr package does this.  There are also packages that link
 to winbugs if that is what you really want to do.
 
 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 (801) 408-8111
  
  
 
  -Original Message-
  From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Alberto Monteiro
  Sent: Tuesday, March 06, 2007 1:38 PM
  To: r-help@stat.math.ethz.ch
  Subject: [R] Generic distributions
  
  Is there any class that generalizes distributions?
  
  For example, I could say
  x - generic_distribution(normal, list(mean=1, sigma=0.5)) 
  and then use it like rgeneric_distribution(100, x) to get a 
  sample of 100, or pgeneric_distribution(0.5, x) to get the 
  pdf at (x = 0.5).
  
  In the openbugs/winbugs package, that uses a language that 
  looks like R/S, we can do things like x ~ dnorm(mu, tau), 
  forget that x is a normal with mean mu and variance 1/tau, 
  and then treat it generically.
  
  Alberto Monteiro
  
  PS: this is noise... but due to spam invasion, anything that 
  increases the nonspam/spam ratio should be welcome :-)
  
  __
  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.
 

--- original message end 

__
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] Autogenerate tags in tag=value pairs for

2007-03-06 Thread Jon Olav Vik
Dear list,

Is there a way to programmatically specify tag names for the ... (ellipsis) 
part of the argument list to a function? In other words, a way to do this:

x - data.frame(A=1:5)

if the name A was not hardcoded but given by a variable, and without 
resorting to:

x - data.frame(1:5)
names(x) - A


A longer example describing my actual problem follows. Thanks in advance for 
any help.

Best regards,
Jon Olav


I want to use function transformBy() in package doBy. The key is that the ... 
Further arguments of the form tag=value require tag to be specified, 
otherwise the output does not include the results of my groupwise calculations.

Quoting the documentation:
 transformBy(doBy)
 Function to make groupwise transformations of data 
 by applying the transform function to subsets of data. 
 
 Usage
 transformBy(formula, data, ...)
 
 Arguments
 formula A formula with only a right hand side, see examples below 
 data A data frame 
 ... Further arguments of the form tag=value 

### example ###

# a function to replace NAs with the last non-NA value from above 
filldown - function(x) {
notna - !is.na(x) # elements with values
ix - cumsum(notna) # index to previous element (but zeros where we need NA)
ix[ix==0] - NA # use [NA] as index to produce NA in output
return(x[notna][ix]) # for each: return previous value if found, else NA
}
# illustration of how it works
tmp - c(NA,NA,1,NA,3,NA,NA)
cbind(tmp,filldown(tmp))

# I now want to apply filldown() to subsets of a data frame
# and I want it to work on several columns

# generate a data frame for illustration, 
# with a few non-NA values scattered round
set.seed(5) # repeatable example
x - data.frame(id = rep(1:4,each=6), v1=NA, v2=NA)
ix - which(runif(nrow(x))0.75)
x[ix,2] - rpois(length(ix),5)
ix - which(runif(nrow(x))0.75)
x[ix,3] - rpois(length(ix),5)
x

library(doBy)
# the hard way -- works as required, 
# but I would like not having to hardcode column names v1 etc.
transformBy(~id,data=x,v1.fd = filldown(v1),v2.fd = filldown(v2))

# does not work because
# output includes only columns explicitly mentioned in the ... argument
transformBy(~id,data=x,function(y) lapply(y,filldown))

__
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.


<    1   2