Re: [R] postgres

2003-02-12 Thread ripley
RPgSQL etc seem now to be unsupported.

As for ODBC, there is some information in the README *but* setting up ODBC 
is not an R question.  Once you have a working connection (tested by say 
isql -v foo), then odbcConnect(foo) will work too.  There is lots of 
documentation on the unixODBC site.  Where I would be critical is of the 
Postrgres ODBC documentation: there are several drivers, no documentation 
and most of them are broken.  The one place you will find how to do it is 
in the RODBC README.  So I do resent your comments.

From that README:

  One quirk to be watched is the use of connections to the DBMS via the
  Unix sockets vs ports.  The PostgreSQL driver bundled with unixODBC
  will use Unix sockets to `localhost', but this driver seems unreliable
  (see the ChangeLog).  The current driver will only use a TCP/IP port,
  and to use that needs postmaster started with the -i flag (which is
  not the default) and with tcp/ip enables in the configuration file
  (which is the default).  The PostgreSQL drivers are seriously
  under-documented!


On 11 Feb 2003, Joshua Gramlich wrote:

 Right, but you see, I'm not trying to make a connection in R yet, I'm
 trying to get the right tools installed.  I have found zero coherent
 documentation for any of this stuff.  Yes, there's the import/export
 guide, and that's helpful and all but it doesn't tell me what I need to
 do with these files:
 
 DBI.RPgSQL_0.1-2.tar.gz
 Rdbi_0.1-2.tar.gz
 Rdbi.PgSQL_0.1-2.tar.gz
 
 None of these files contains any documentation either.
 
 ...now, when I go to 
 
 http://rpgsql.sourceforge.net/
 
 There's no documentation there either.  In fact, there's only a message
 saying that this project has been deprecated in favor of Rdbi.  If you
 click on the download link, you get an error from sourceforge, so you
 cannot even get the code through the sourceforge website.  If you go to
 the Rdbi page, there isn't anything there either...and on the
 sourceforge page the download is for version 0.1.2.
 
 ...and that just covers the postgres specific stuff.
 
 
 As to how RODBC works, I don't know, because I haven't found any
 documentation specifically about that either.  Again, there's the
 import/export guide, but that's only about how to use it, not how to get
 one's system set up to use it.   All I've figured out to do is run
 install.packages(RODBC)...which begins the installation process, but
 because the driver manager apparently isn't set up correctly, it tells
 me I must install a driver manageror no ODBC driver manager found.

Quote from the README:

  The RODBC package is installed in the standard way (R CMD
  INSTALL RODBC) and needs the ODBC driver manager library (-lodbc or
  -lodbc32 or -liodbc) to be in the library search path (and library run
  path).

It is just telling you that you have not done that 

 I have unixODBC installed...
 
 Ugh.  I'm giving up on this for today.  I just found out that there is
 no odbc rpm for postgres 7.3.1, so i'm gonna have to go back to 7.2.4 to
 get that functionality in rpm format...which means blowing out my
 database...which means tomorrow.
 
 
 Thanks for all the help so far folks.
 
 
 Josh
 Chicago
 
 
 
 
 
 
 
 On Tue, 2003-02-11 at 16:11, Jason W. Martinez wrote:
  Josh,
  
  It sounds like part of your problem is that you're not reading all of the 
  documentation. The first step is to _understand_ what an ODBC Manager is AND 
  what it is supposed to be doing.
  
  You have to configure your manager (among other things) before you can even 
  begin to make a connection from R with (RODBC).
  
  Don't get discouraged. ODBC is beautiful thing! Further, I make connections 
  with RODBC to postgresql databases all the time. It is possible, just be 
  patient and read the docs.
  
  Jason
  
  On Tuesday 11 February 2003 01:48 pm, Joshua Gramlich wrote:
   I'm actually looking at that exact page in the import/export manual
   right now.  I'm trying to install RODBC via CRAN, but I get this:
  
   blahblahblah...
   checking for library containing SQLTables... no
   configure: error: no ODBC driver manager found
   ERROR: configuration failed for package 'RODBC'
  
   Delete downloaded files (y/N)? y
  
   Warning message:
   Installation of package RODBC had non-zero exit status in:
   install.packages(RODBC)
  
  
  
   I tried installing unixODBC, but that didn't seem to solve the problem.
  
   Thoughts?
  
  
  
   Josh
   Chicago
  
   On Tue, 2003-02-11 at 15:31, John Fox wrote:
Dear David and Joshua,
   
One can also access PostgreSQL via the RODBC package. There's more
information in section 4 of the R Data Import/Export manual, which is
part of the R distribution and is also available on CRAN.
   
John
   
At 04:08 PM 2/11/2003 -0500, David Forrest wrote:
On 11 Feb 2003, Joshua Gramlich wrote:
  Is anyone using R with postgres?  I'd like to do so, but cannot seem
  to find any reasonable explanation of how to do so.

Re: [R] rpart v. lda classification.

2003-02-12 Thread ripley
On Tue, 11 Feb 2003, Rolf Turner wrote:

 
 I've been groping my way through a classification/discrimination
 problem, from a consulting client.  There are 26 observations, with 4
 possible categories and 24 (!!!) potential predictor variables.
 
 I tried using lda() on the first 7 predictor variables and got 24 of
 the 26 observations correctly classified.  (Training and testing both
 on the complete data set --- just to get started.)
 
 I then tried rpart() for comparison and was somewhat surprised when
 rpart() only managed to classify 14 of the 26 observations correctly.
 (I got the same classification using just the first 7 predictors as I
 did using all of the predictors.)
 
 I would have thought that rpart(), being unconstrained by a parametric
 model, would have a tendency to over-fit and therefore to appear to
 do better than lda() when the test data and training data are the
 same.
 
 Am I being silly, or is there something weird going on?  I can
 give more detail on what I actually did, if anyone is interested.

The first.  rpart is seriously constrained by having so few observations,
and its model is much more restricted than lda: axis-parallel splits only.
There is a similar example, with pictures, in MASS (on Cushings).

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



[R] multinomial conditional logit models

2003-02-12 Thread John Hendrickx
A little while ago, I asked for some help in estimating multinomial
conditional logit models. If you restructure your data, you can
estimate a multinomial logit as a conditional logit model. This gives
flexibility in imposing constraints on your dependent variable. One
application is to estimate a loglinear model for square tables such
as quasi-independence or quasi-symmetry with covariates.

Anyhow, I think I've sorted out most of the problems and I've posted
a sample program at
http://www.xs4all.nl/~jhckx/mcl/R/

There's also a sample program there on how to estimate models for
square tables, aka mobility models. Comments and suggestions on how
to do things more efficiently or elegantly in R are most welcome.

One problem that remains is that clogit in R doesn't produce the same
estimates as other programs like Stata. I've estimated this sample
model in several packages and they all have the same estimates to 3
decimal places accuracy. I've tried different convergence settings in
clogit but to no effect. I'd appreciate it if anyone could clarify
this.

Best regards,
John Hendrickx

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



[R] Receiving Rnews by mail

2003-02-12 Thread Ronaldo Reis Jr.
Hi all,

I possible to receive Rnews automatically in my E-mail?

Thanks
Ronaldo
-- 
O cerebro e um orgao maravilhoso. Comeca a funcionar assim 
que voce se levanta da cama e nao p ra ate voce chegar ao 
escritorio.
-- Robert Frost 
--
|   //|\\   [*][***]
|| ( õ õ )  [Ronaldo Reis Júnior  ][PentiumIII-600 ]
| V [ESALQ/USP-Entomologia, CP-09 ][HD: 30 + 10 Gb ]
||  / l \   [13418-900 Piracicaba - SP][RAM: 128 Mb]
|  /(lin)\  [Fone: 19-429-4199 r.229  ][Video: SiS620-8Mb  ]
||/(linux)\ [[EMAIL PROTECTED]  ][Modem: Pctel-onboar]
|/ (linux) \[ICQ#: 5692561][Kernel: 2.4.18 ]
||  ( x )   [*][***]
||| _/ \_Powered by Gnu/Debian Woody D+:) | Lxuser#: 205366

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



Re[2]: [R] Interpolation

2003-02-12 Thread Remigijus Lapinskas
Many thanks to all who replied to my e-mail. My problem was that I
had not known about the approx function.

By the way, if I have  x - c(1990,1994,1995,1997), is there an
automated way to fill in the gaps, i.e., to get
c(1991,1992,1993,1996)?

Cheers,
Remigijus


Wednesday, February 12, 2003, 12:09:33 PM, you wrote:

PDB Remigijus Lapinskas [EMAIL PROTECTED] writes:

 Dear all,

 I have two vectors and connect the points by line segments:

 x - c(1990,1994,1995,1997)
 y - c(30,40,80,20)
 plot(x,y,type=l)

 I want to get the values of y's on these lines at missing x's,
 i.e., at 1991,1992,1993,and 1996. Is there a simple way to do this?


PDB approx(x,y,c(1991,1992,1993,1996))
PDB plot(x,y,type=l)
PDB points(approx(x,y,c(1991,1992,1993,1996)),pch=*,col=red,cex=5)

PDB --
PDBO__   Peter Dalgaard Blegdamsvej 3
PDB   c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
PDB  (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
PDB ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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



[R] models for square tables

2003-02-12 Thread John Hendrickx
I've posted a sample file for estimating loglinear models for square
tables (mobility models) at http://www.xs4all.nl/~jhckx/mcl/R/
Comments and suggestions are welcome.

John Hendrickx

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



Re: [R] Interpolation

2003-02-12 Thread Sundar Dorai-Raj


Remigijus Lapinskas wrote:

Many thanks to all who replied to my e-mail. My problem was that I
had not known about the approx function.

By the way, if I have  x - c(1990,1994,1995,1997), is there an
automated way to fill in the gaps, i.e., to get
c(1991,1992,1993,1996)?



Try this:

R x - c(1990, 1994, 1995, 1997)
R all.x - seq(min(x), max(x))
R missing.x - all.x[!all.x %in% x]
R missing.x
[1] 1991 1992 1993 1996
R

Regards,
Sundar

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



[R] GLMMGibbs crashes R

2003-02-12 Thread Stefano Calza
Hi everybody.

I'm trying to use the GLMMGibbs package (R 1.6.2, Linux/Debian 3.0) with the data 
scottish.lip.cancer, as described in the paper by J.Miles and D. Clayton. The problem 
is 
that the code at pag 18 crasches R:

***sparse_rd***too few elements (column 32) /n
Process R exited abnormally with code 1 ...

Has anyone experienced the same problem?

TIA,
Stefano

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



[R] rbind.data.frame: character comverted to factor

2003-02-12 Thread Markus Jäntti
Dear All,

on rbind:ing together a number of data.frames, I found that
character variables are converted into factors. Since this
occurred for a data identifier, it was a little inconvenient
and, to me, unexpected. (The help page explains the
general procedure used. I also found that on forming 
a data frame, character variables are converted to factors.

The help page on read.table has the 'as.is' argument, which
I suppose kind of suggests that character variables  tend to
get converted into factors. Is there such a preference for 
factors and should this behaviour be expected?

Example code

 d1 - data.frame(id =letters[1:20], x = runif(20))
d2 - data.frame(id =paste(letters[1:20],letters[1:20], sep = ),  x =
rexp(20))
d3 - rbind(d1, d2)
str(d1) # - id is factor
str(d2) # - id is factor
str(d3) # - id is factor
d1[[id]] - as.character(d1[[id]])
d2[[id]] - as.character(d2[[id]])
d3 - rbind(d1, d2)
str(d1) # - id is character
str(d2) # - id is character
str(d3) # - id is factor

Regards,

Markus
-- 
Markus Jäntti [EMAIL PROTECTED]
Statistics Finland

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



RE: [R] Dynamic Linear Models for Times Series - Implemented?

2003-02-12 Thread Thomas Lumley
On Wed, 12 Feb 2003, Gavin Simpson wrote:

 Hi,

 Following an off-list reply to my original post, I realised that I hadn't
 really provided very much information for you to work with.  So here's a
 second attempt:

 Following West  Harrison (1989) and Pole et al. (1994) a DLM is defined as:

 Y[t] = F'[t]theta[t] + v[t],  v[t] ~ N[0,V] #Observation equation
 theta[t] = G[t]theta[t-1] + w[t],  w[t] ~ N[0,W] #system equation

 The system equation is a first order Markov process, where G[t] is a matrix
 of known coefficients that defines the systematic evolution of the state
 vector (theta[t]) across time, and w[t] is an unobservable stochastic error
 term having a normal distribution with zero mean and covariance matrix.

 Y[t] denotes the observation series at time t
 F[t] is a vector of known constants (the regression vector)
 theta[t] denotes the vector of model state parameters
 v[t] is a stochastic error term having zero mean and variance V[t]

 If I have understood Brockwell and Davis (1991) correctly, the DLM can be
 considered from the point of view of State-space models (although I am
 venturing some way out of my statistical depth here, all the papers I have
 collected are applied examples and they all refer to dynamic Linear Models,
 not State-space models).


There are some models of this form in the ts package, see eg StructTS. It
may be possible to use some of the underlying Kalman filter machinery to
fit more models.

I'm trying to fit a model of this sort where F[t] contains a linear
regression term, and having some difficulty with optimisation. (Brian
Ripley has noted that parameter estimation is more difficult in this
models than is generally realised).

-thomas

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



[R] `UNPROTECT' and `return'

2003-02-12 Thread Timur Elzhov
Dear R experts,

In all R functions written in C one must unprotect
result before returning them:

  {
  ...
  UNPROTECT(1)  /* unprotecting `ans' */

  return ans;
  }

Why does one shure that memory occupied by `ans'
won't be used by R immediately after unprotecting?

Ok, is the next construction also absolutely safe?
  {
  ...
  UNPROTECT(1)  /* unprotecting `ans' */

  PROTECT( val = ans )
  ...
  }

Thanks a lot!


--
WBR,
Timur.

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



Re: [R] Dynamic Linear Models for Times Series - Implemented?

2003-02-12 Thread Paul Gilbert
Gavin

I am not familiar with the two texts you mention that define DLM, but I think
since at least twenty years prior to those texts, the term has been used to mean
the state-space model you describe, and also ARMA models, transfer function
models, and possibly some other representations of linear models in time series
(and continuous time too, which is not always consider time series). 

There are several packages on CRAN that implement ARMA and/or state-space
models, including my dse (Dynamic Systems Estimation) which handles both
multivariate ARMA and the state-space model you describe. For estimation
purposes I would suggest you consider the innovations form state-space model
rather than the non-innovations form you have indicated. If you use the
non-innovations form you will need to worry much more about identification
problems.

Paul Gilbert

Gavin Simpson wrote:
 
 Hi,
 
 Following an off-list reply to my original post, I realised that I hadn't
 really provided very much information for you to work with.  So here's a
 second attempt:
 
 Following West  Harrison (1989) and Pole et al. (1994) a DLM is defined as:
 
 Y[t] = F'[t]theta[t] + v[t],v[t] ~ N[0,V] #Observation equation
 theta[t] = G[t]theta[t-1] + w[t],  w[t] ~ N[0,W] #system equation
 
 The system equation is a first order Markov process, where G[t] is a matrix
 of known coefficients that defines the systematic evolution of the state
 vector (theta[t]) across time, and w[t] is an unobservable stochastic error
 term having a normal distribution with zero mean and covariance matrix.
 
 Y[t] denotes the observation series at time t
 F[t] is a vector of known constants (the regression vector)
 theta[t] denotes the vector of model state parameters
 v[t] is a stochastic error term having zero mean and variance V[t]
 
 If I have understood Brockwell and Davis (1991) correctly, the DLM can be
 considered from the point of view of State-space models (although I am
 venturing some way out of my statistical depth here, all the papers I have
 collected are applied examples and they all refer to dynamic Linear Models,
 not State-space models).
 
 It seems that some of this has been done in S (for S-Plus), as I found the
 bts package by Harrison and Reed on StatLib
 (http://lib.stat.cmu.edu/DOS/S/),
 
 SPLUS for Windows functions and datasets for Bayesian forecasting based on
 the algorithms in Bayesian Forecasting and Dynamic Linear Models by West and
 Harrison
 
 So I was wondering whether anyone knew of existing R code that could fit
 such models?
 
 Many thanks
 
 Gavin Simpson
 
 Refs:
 Brockwell and Davis (1991).  Time Series: Theory and Methods.  Springer
 Pole, West and Harrison (1994).  Applied Bayesian Forecasting and Time
 Series Analysis.  Chapman  Hall/CRC
 West and Harrison (1989).  Bayesian Forecasting and Dynamic Models.
 Springer
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 On Behalf Of Gavin Simpson
 Sent: 11 February 2003 17:49
 To: r-help
 Subject: [R] Dynamic Linear Models for Times Series - Implemented?
 
 Hi,
 
 I was wondering whether a package that can perform dynamic linear models on
 times series data was available for R?
 
 Many Thanks,
 
 Gavin Simpson
 
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [T] +44 (0)20 7679 5522
 ENSIS Research Fellow [F] +44 (0)20 7679 7565
 ENSIS Ltd.  ECRC [E] [EMAIL PROTECTED]
 UCL Department of Geography
 26 Bedford Way
 London.  WC1H 0AP.
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 
 __
 [EMAIL PROTECTED] mailing list
 http://www.stat.math.ethz.ch/mailman/listinfo/r-help
 
 __
 [EMAIL PROTECTED] mailing list
 http://www.stat.math.ethz.ch/mailman/listinfo/r-help

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



Re: [R] `UNPROTECT' and `return'

2003-02-12 Thread ripley
This _is_ covered in `Writing R Extensions'.  What is unsafe is to allow a 
gc to occur.

On Wed, 12 Feb 2003, Timur Elzhov wrote:

 In all R functions written in C one must unprotect
 result before returning them:
 
   {
   ...
   UNPROTECT(1)  /* unprotecting `ans' */
 
   return ans;
   }
 
 Why does one shure that memory occupied by `ans'
 won't be used by R immediately after unprotecting?
 
 Ok, is the next construction also absolutely safe?
   {
   ...
   UNPROTECT(1)  /* unprotecting `ans' */
 
   PROTECT( val = ans )
   ...
   }

-- 
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] rbind.data.frame: character comverted to factor

2003-02-12 Thread Rolf Turner
Brian Ripley wrote:

 d1 - data.frame(id=I(letters[1:20]), x = runif(20))
 d2 - data.frame(id=I(paste(letters[1:20],letters[1:20],sep=)),
   x=rexp(20))
 d3 - rbind(d1, d2)
 
 which of course works!

Why ``of course''?  It seems to me that there is no ``of course''
about it.  It is completely counter-intuitive.  What appears
to be going on is that the I() operator NOT ONLY puts its argument
into the data frame ``as is'', but it ALSO tacks a class ``AsIs''
onto that argument which prevents it from being mucked around with
thereafter.

This is a neat trick, but is fairly mysterious --- and could have
intricate ramifications.  How can one discern all the impacts of
an object's having ``AsIs'' as a class?  (It would appear that
objects of any structure and class can ``inherit from'' AsIs.)

It would be highly preferable not to have to use the I() operator, or
the ``AsIs'' class at all.  I.e. to have character vectors stay
character vectors unless the user explicitly asks them to be
converted to factors.  However Splus introduced the contrary policy
years ago, and R is stuck with it for compatibility reasons.


cheers,

Rolf Turner
[EMAIL PROTECTED]

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



[R] Poesia

2003-02-12 Thread kjetil brinchmann halvorsen
Hola!

Sorry for going off-topic, but here are
something I found on the web 
yesterday - an explanation of 
statistics in poetic form:



 First, you see your data for what they seem to be
 Then, you ask them for the truth  - are you what you seem to me?

You see with broad expanse
   you ask with narrowed power
   you see and ask and see
   and ask and see...and ask

With brush you paint the possibilities
 with pen you scribe the probabilities

For in pictures we find insight
while in numbers we find strengt


(author is probably Forrest Young)

Kjetil Halvorsen

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



[R] Three questions - loading(sourcing a file??), summaries to bitmaps,and error messages

2003-02-12 Thread Tony Vargas
R helpers,

I have three questions about R and was wondering if I could get some help.

First, I am trying to send the output of a a summary command -
summary(info) to a bitmap file instead of the default device.  Anybody
know how to send a summary to a bitmap device?

Second - this question is more difficult.  What I am trying to do is have
Perl (because I already have the data structures loaded into
hashes) generate a gigantic R file that I can then have R source, and then
parse.  The output of the file(s) that I generate is below:




my.badger.Sep.2002.cpu.utilization -
read.table(file=/auto/solperf/tgu/ActiveParsedFiles/badger/Sep.2002/cpu.utilization,
sep==, header=TRUE) names(my.badger.Sep.2002.cpu.utilization)
attach(my.badger.Sep.2002.cpu.utilization) Tony Vargas Cisco Systems
Engineering Computing Services (408) 525-4113 [EMAIL PROTECTED]
my.balvenie.Sep.2002.cpu.utilization -
read.table(file=/auto/solperf/tgu/ActiveParsedFiles/balvenie/Sep.2002/cpu.utilization,
sep==, header=TRUE) names(my.balvenie.Sep.2002.cpu.utilization)
attach(my.balvenie.Sep.2002.cpu.utilization)
my.bobcat.Sep.2002.cpu.utilization -
read.table(file=/auto/solperf/tgu/ActiveParsedFiles/bobcat/Sep.2002/cpu.utilization,
sep==, header=TRUE) names(my.bobcat.Sep.2002.cpu.utilization)
attach(my.bobcat.Sep.2002.cpu.utilization)
my.bowmore.Sep.2002.cpu.utilization -
read.table(file=/auto/solperf/tgu/ActiveParsedFiles/bowmore/Sep.2002/cpu.utilization,
sep==, header=TRUE) names(my.bowmore.Sep.2002.cpu.utilization)
attach(my.bowmore.Sep.2002.cpu.utilization)

etc. . . .

My plotting file looks like this:

bitmap(file =
/auto/solperf/tgu/Images/badger.Sep.2002.usr.cpu.summary.thumbnail, type
= png256, height = 6, width = 6, res = 72)
summary(my.badger.Sep.2002.cpu.utilization) bitmap(file =
/auto/solperf/tgu/Images/badger.Sep.2002.usr.cpu.lines.thumbnail, type =
png256, height = 6, width = 6, res = 72)
 lines(usr.cpu ~ Time, xlab = Time, ylab = %Usr CPU Utilization, main
= badger's %Usr CPU Utilization Sep.2002)
 legend(0,0, usr.cpu) bitmap(file =
/auto/solperf/tgu/Images/badger.Sep.2002.usr.cpu.scatter.thumbnail, type
= png256, height = 6, width = 6, res = 72)
 plot(usr.cpu, main = Scatter plot of badger's %Usr CPU Utilization
Sep.2002)
 legend(0,0, usr.cpu) bitmap(file =
/auto/solperf/tgu/Images/badger.Sep.2002.usr.cpu.summary.large, type =
png256,


I tried having R do a load on my files, but I get the error messages
below:

 load(rgraphfileload)
Error: bad restore file magic number (file may be corrupted)-- no data
loaded

Any idea why I would get the message above?  I am using R version 1.6.1 on
a Solaris host.

Thanks,

Tony

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



[R] Various Errors using Survey Package

2003-02-12 Thread Thompson, Trevor
Hi,

I have been experimenting with the new Survey package.  Specifically, I was
trying to use some of the functions on the public-use survey data from NHIS
(2000 Sample Adult file).  

Error 1):  The first error I get is when I try to specify the complex survey
design.

nhis.design-svydesign(ids=~psu, probs=~probs, strata=~strata, data=nhis.df,
check.strata=TRUE)
Error in svydesign(ids = ~psu, probs = ~probs, strata = ~strata, data =
nhis.df,  : 
Clusters not nested in strata

My data are sorted by strata, psu.  Can someone tell me what the structure
has to be for a stratified sample with clustering?  Looking at the code, it
appears to me that it does not allow more than 1 observation per psu [i.e.
any(sc  1)].

Error 2).  If I go ahead and specify check.strata=FALSE, then svydesign runs
ok.  I then tried using the svymean function.  In the following example, if
I specify na.rm=TRUE, I get the error below:

 svymean(nhis.df$crc10yr, design=nhis.design, na.rm=TRUE)
Error in rowsum.default(x, strata) : Incorrect length for 'group'

I traced this to the svyCprod call within svymean.   SvyCprod calls rowsum
and the group argument (strata) appears to be the full length of that
column rather than the subset with non-missing data.  

Error 3).  I then tried svymean on another variable with na.rm=FALSE.  I got
the following error:

 svymean(nhis.df$age, design=nhis.design)
Error in drop(rval) : names attribute must be the same length as the vector 

I also traced this error to a call to rowsum within the function svyCprod.
I'm not sure what names attribute this is referring to because the arguments
to rowsum and the rval object do not appear to have a names attribute.  Does
anyone know what the problem here might be?

Has anyone else used the survey package on public-use survey datasets like
BRFSS or NHIS?  Was there anything special you had to do to those datasets
before specifying the survey design?  I know that's a pretty vague question.
If any of you are SUDAAN users, I basically mean does it have to be
structured differently that what you pass into a SUDAAN procedure.

Thanks in advance for any suggestions!  I am using R 1.6.2 on Windows 2000.

-Trevor

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



[R] Debugging in R

2003-02-12 Thread Charles Sugnet

Hello *,

Is it possible in R to set breakpoints and conditional breakpoints in the
browser mode? I've discovered debug() to debug functions, but I find
stepping throw loops or having to go back and put in browse() calls a
little tedious. I would really like to be able to set a breakpoint while
in the browser mode. Can anyone tell me how to do this? Any other pointers
to useful debugging tutorials/howtos in R would be greatly appreciated.

Thanks,
-Chuck Sugnet
http://www.cse.ucsc.edu/~sugnet/

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



[R] rl_callback_read_char error on Solaris 7

2003-02-12 Thread Yuelin Li
This question is about compiling R-1.6.2 from source on a 
Sparcstation-20 machine running Solaris 7, gcc-2.95.3 and 
readline-4.2 (both gcc and readline from sunfreeware.com).  

I searched the r-help archive and the FAQ.  The errors seem to be 
related to the binary readline libraries, and I have 
/usr/local/lib/libreadline.a,libreadline.so@, and 
libreadline.so.4.

The attached errors are from config.log.  ./configure finds 
readline header files in /usr/local/include/readline.  I can make 
and install R, but command line editing and savehistory() do not 
work.   

Suggestions are appreciated.

Yuelin Li.


configure:11366: checking for rl_callback_read_char in -lreadline
configure:11397: gcc -o conftest -g -O2 -I/usr/local/include 
-L/usr/local/lib conftest.c -lreadline  -ldl -lncurses -lm  5
ld: fatal: symbol `_init' is multiply-defined:
(file 
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crti.o and 
file /usr/local/lib/libreadline.so);
ld: fatal: symbol `_start' is multiply-defined:
(file 
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crt1.o and 
file /usr/local/lib/libreadline.so);
ld: fatal: symbol `_fini' is multiply-defined:
(file 
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crti.o and 
file /usr/local/lib/libreadline.so);
ld: fatal: symbol `_lib_version' is multiply-defined:
(file /usr/ccs/lib/values-Xa.o and file 
/usr/local/lib/libreadline.so);
ld: fatal: File processing errors. No output written to conftest
collect2: ld returned 1 exit status
configure:11400: $? = 1
configure: failed program was:
| #line 11373 configure
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME R
| #define PACKAGE_TARNAME r| #define PACKAGE_VERSION 1.6.2
| #define PACKAGE_STRING R 1.6.2
| #define PACKAGE_BUGREPORT [EMAIL PROTECTED]
| #define PACKAGE R
| #define VERSION 1.6.2
| #define R_PLATFORM sparc-sun-solaris2.7
| #define R_CPU sparc
| #define R_VENDOR sun
| #define R_OS solaris2.7
| #define Unix 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define HAVE_LIBM 1
| #define HAVE_LIBNCURSES 1
| #define HAVE_LIBDL 1
| /* end confdefs.h.  */
| 
| /* Override any gcc2 internal prototype to avoid an error.  */
| #ifdef __cplusplus
| extern C
| #endif
| /* We use char because int might match the return type of a 
gcc2
|builtin and then its argument prototype would still apply.  
*/
| char rl_callback_read_char ();
| int
| main ()
| {
| rl_callback_read_char ();
|   ;
|   return 0;
| }

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



[R] Matrix formatting

2003-02-12 Thread Tim Sharac
Hi R-users:

I have a data formatting question. I have a data set that looks something like this:

foo.dat - cbind(c(NA, 1, 2, 3, 4, 5), c(NA, NA, 0, 10 ,20, 30))

What I have:

 [,1] [,2]
[1,]   NA   NA
[2,]1   NA
[3,]20
[4,]3   10
[5,]4   20
[6,]5   30


I want to line up the columns by the first value that is not NA. Like so:

 [,1] [,2]
[1,]1   0
[2,]2   10
[3,]3   20
[4,]4   30
[5,]5   NA
[6,]NA  NA

Question is: Is there an elegant way to do this without a for loop?

I tried doing this with na.omit and na.exclude without success.

The real data is many hundreds of columns and many thousands of rows.

Thanks in advance, Tim

Sign up for Internet Service under $10 dollars a month, at http://isp.BlueLight.com

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



Re: [R] Three questions - loading(sourcing a file??), summaries to bitmaps, and error messages

2003-02-12 Thread Peter Dalgaard BSA
Tony Vargas [EMAIL PROTECTED] writes:

 R helpers,
 
 I have three questions about R and was wondering if I could get some help.
 
 First, I am trying to send the output of a a summary command -
 summary(info) to a bitmap file instead of the default device.  Anybody
 know how to send a summary to a bitmap device?

Eh? Bitmap as in GIF/JPEG/... or what? Print to file is sink() if
that's what you mean. You can also sink() to a text connection and use
text() to put that on the graphics display (ruins tabular output, though).
 
 Second - this question is more difficult.  What I am trying to do is have
 Perl (because I already have the data structures loaded into
 hashes) generate a gigantic R file that I can then have R source, and then
 parse.  The output of the file(s) that I generate is below:

 
 my.badger.Sep.2002.cpu.utilization -
 
read.table(file=/auto/solperf/tgu/ActiveParsedFiles/badger/Sep.2002/cpu.utilization,
 sep==, header=TRUE) names(my.badger.Sep.2002.cpu.utilization)
 attach(my.badger.Sep.2002.cpu.utilization) Tony Vargas Cisco Systems
 Engineering Computing Services (408) 525-4113 [EMAIL PROTECTED]
 my.balvenie.Sep.2002.cpu.utilization -
 
read.table(file=/auto/solperf/tgu/ActiveParsedFiles/balvenie/Sep.2002/cpu.utilization,
 sep==, header=TRUE) names(my.balvenie.Sep.2002.cpu.utilization)
 attach(my.balvenie.Sep.2002.cpu.utilization)

You seem to need semicolons or \n mefore names(...) I assume that your
address got in there with the aid of your emailer, not the Perl script?


 I tried having R do a load on my files, but I get the error messages
 below:
 
  load(rgraphfileload)
 Error: bad restore file magic number (file may be corrupted)-- no data
 loaded
 
 Any idea why I would get the message above?  I am using R version 1.6.1 on
 a Solaris host.

load() is for binary files made by save() or save.image(). Were you
looking for source()?

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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



Re: [R] Matrix formatting

2003-02-12 Thread Jerome Asselin

Would this do what you want?

Cheers,
Jerome

 foo.dat - cbind(c(NA, 1, 2, 3, 4, 5), c(NA, NA, 0, 10 ,20, 30))
 apply(foo.dat,2,function(x) x[order(as.logical(x))])
 [,1] [,2]
[1,]10
[2,]2   10
[3,]3   20
[4,]4   30
[5,]5   NA
[6,]   NA   NA


On Wednesday 12 February 2003 12:42, Tim Sharac wrote:
 Content-Length: 918
 Status: R
 X-Status: N

 Hi R-users:

 I have a data formatting question. I have a data set that looks something
 like this:

 foo.dat - cbind(c(NA, 1, 2, 3, 4, 5), c(NA, NA, 0, 10 ,20, 30))

 What I have:

  [,1] [,2]
 [1,]   NA   NA
 [2,]1   NA
 [3,]20
 [4,]3   10
 [5,]4   20
 [6,]5   30


 I want to line up the columns by the first value that is not NA. Like so:

  [,1] [,2]
 [1,]1   0
 [2,]2   10
 [3,]3   20
 [4,]4   30
 [5,]5   NA
 [6,]NA  NA

 Question is: Is there an elegant way to do this without a for loop?

 I tried doing this with na.omit and na.exclude without success.

 The real data is many hundreds of columns and many thousands of rows.

 Thanks in advance, Tim

 Sign up for Internet Service under $10 dollars a month, at
 http://isp.BlueLight.com

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

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



[R] R CMD check .

2003-02-12 Thread Robin Hankin
Hello everybody

I'm writing a package and am trying to get it past R CMD check .  It
has no C or Fortan code, just R code.

R CMD check .  reports that the examples don't work:


r:Davies% R CMD check .
* checking for working latex ... OK
* using log directory '/home/rksh/information/Davies/Davies.Rcheck'


[deleted]

* checking for code/documentation mismatches ... OK
* checking for undocumented arguments in \usage ... OK
* checking for CRLF line endings in C sources/headers ... OK
* creating Davies-Ex.R ... OK
* checking examples ... ERROR
Running examples failed.
r:Davies%

Everything works fine with R CMD check --no-example .  

How do I tell which .Rd file is the problem?  (I suspect that the
examples aren't actually being executed because most of them take a
long time and the error is pretty much instantaneous).



Any clues?  


-- 

Robin Hankin, Lecturer,
School of Geography and Environmental Science
Tamaki Campus
Private Bag 92019 Auckland
New Zealand

[EMAIL PROTECTED]
tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042

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



Re: [R] Matrix formatting

2003-02-12 Thread Roger Peng
Is

apply(foo.dat, 2, sort, na.last = TRUE)

what you want?

-roger
___
UCLA Department of Statistics
[EMAIL PROTECTED]
http://www.stat.ucla.edu/~rpeng

On 12 Feb 2003, Tim Sharac wrote:

 Hi R-users:
 
 I have a data formatting question. I have a data set that looks something like this:
 
 foo.dat - cbind(c(NA, 1, 2, 3, 4, 5), c(NA, NA, 0, 10 ,20, 30))
 
 What I have:
 
  [,1] [,2]
 [1,]   NA   NA
 [2,]1   NA
 [3,]20
 [4,]3   10
 [5,]4   20
 [6,]5   30
 
 
 I want to line up the columns by the first value that is not NA. Like so:
 
  [,1] [,2]
 [1,]1   0
 [2,]2   10
 [3,]3   20
 [4,]4   30
 [5,]5   NA
 [6,]NA  NA
 
 Question is: Is there an elegant way to do this without a for loop?
 
 I tried doing this with na.omit and na.exclude without success.
 
 The real data is many hundreds of columns and many thousands of rows.
 
 Thanks in advance, Tim
 
 Sign up for Internet Service under $10 dollars a month, at http://isp.BlueLight.com
 
 __
 [EMAIL PROTECTED] mailing list
 http://www.stat.math.ethz.ch/mailman/listinfo/r-help


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



Re: [R] Matrix formatting

2003-02-12 Thread Jerome Asselin

Sorry, this is probably better if you want to preserve the order of the 
numbers in each column.

apply(foo.dat,2,function(x) x[order(is.na(x))])

Jerome

On Wednesday 12 February 2003 13:05, Jerome Asselin wrote:
 Would this do what you want?

 Cheers,
 Jerome

  foo.dat - cbind(c(NA, 1, 2, 3, 4, 5), c(NA, NA, 0, 10 ,20, 30))
  apply(foo.dat,2,function(x) x[order(as.logical(x))])

  [,1] [,2]
 [1,]10
 [2,]2   10
 [3,]3   20
 [4,]4   30
 [5,]5   NA
 [6,]   NA   NA

 On Wednesday 12 February 2003 12:42, Tim Sharac wrote:
  Content-Length: 918
  Status: R
  X-Status: N
 
  Hi R-users:
 
  I have a data formatting question. I have a data set that looks something
  like this:
 
  foo.dat - cbind(c(NA, 1, 2, 3, 4, 5), c(NA, NA, 0, 10 ,20, 30))
 
  What I have:
 
   [,1] [,2]
  [1,]   NA   NA
  [2,]1   NA
  [3,]20
  [4,]3   10
  [5,]4   20
  [6,]5   30
 
 
  I want to line up the columns by the first value that is not NA. Like so:
 
   [,1] [,2]
  [1,]1   0
  [2,]2   10
  [3,]3   20
  [4,]4   30
  [5,]5   NA
  [6,]NA  NA
 
  Question is: Is there an elegant way to do this without a for loop?
 
  I tried doing this with na.omit and na.exclude without success.
 
  The real data is many hundreds of columns and many thousands of rows.
 
  Thanks in advance, Tim
 
  Sign up for Internet Service under $10 dollars a month, at
  http://isp.BlueLight.com
 
  __
  [EMAIL PROTECTED] mailing list
  http://www.stat.math.ethz.ch/mailman/listinfo/r-help

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

-- 

Jerome Asselin (Jérôme)
Statistical Analyst
British Columbia Centre for Excellence in HIV/AIDS
St. Paul's Hospital
608 - 1081 Burrard Street
Vancouver, British Columbia
CANADA V6Z 1Y6

Email: [EMAIL PROTECTED]
Phone: 604 806-9112   Fax: 604 806-9044

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



Re: [R] R CMD check .

2003-02-12 Thread David Scott
On Thu, 13 Feb 2003, Robin Hankin wrote:

 Hello everybody
 
 I'm writing a package and am trying to get it past R CMD check .  It
 has no C or Fortan code, just R code.
 
 R CMD check .  reports that the examples don't work:
 
 
 r:Davies% R CMD check .
 * checking for working latex ... OK
 * using log directory '/home/rksh/information/Davies/Davies.Rcheck'
 
 
 [deleted]
 
 * checking for code/documentation mismatches ... OK
 * checking for undocumented arguments in \usage ... OK
 * checking for CRLF line endings in C sources/headers ... OK
 * creating Davies-Ex.R ... OK
 * checking examples ... ERROR
 Running examples failed.
 r:Davies%
 
 Everything works fine with R CMD check --no-example .  
 
 How do I tell which .Rd file is the problem?  (I suspect that the
 examples aren't actually being executed because most of them take a
 long time and the error is pretty much instantaneous).
 
Rcmd check makes a directory called libname.Rcheck. Inside that you will
find a .Rout file which gives a log of the examples. If I understand the
pattern it is called libname-Ed.Rout.

Look at that file to see where the running of your examples failed.

David Scott 
_
David Scott Department of Statistics, Tamaki Campus
The University of Auckland, PB 92019
AucklandNEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED] 

Webmaster, New Zealand Statistical Association:
http://www.stat.auckland.ac.nz/nzsa/

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



Re: [R] rl_callback_read_char error on Solaris 7

2003-02-12 Thread Don MacQueen
At 9:03 PM + 2/12/03, [EMAIL PROTECTED] wrote:

On Wed, 12 Feb 2003, Yuelin Li wrote:


 This question is about compiling R-1.6.2 from source on a
 Sparcstation-20 machine running Solaris 7, gcc-2.95.3 and
 readline-4.2 (both gcc and readline from sunfreeware.com). 

This is not an R question, but one for the maintainers of sunfreeware.com.
There is no problem with those tools if compiled from the sources
(although they are rather old versions).


 I searched the r-help archive and the FAQ.  The errors seem to be
 related to the binary readline libraries, and I have
 /usr/local/lib/libreadline.a,libreadline.so@, and
 libreadline.so.4.

 The attached errors are from config.log.  ./configure finds
 readline header files in /usr/local/include/readline.  I can make
 and install R, but command line editing and savehistory() do not
 work.  

 Suggestions are appreciated.

Compile libreadline yourself?


That is what I had to do.
I first tried a version from sunfreeware.com, without success.
(Also for png and jpeg support, though the pre-compiled versions may 
not have come from sunfreeware; I do not remember.)




 Yuelin Li.

 
 configure:11366: checking for rl_callback_read_char in -lreadline
 configure:11397: gcc -o conftest -g -O2 -I/usr/local/include
 -L/usr/local/lib conftest.c -lreadline  -ldl -lncurses -lm  5
 ld: fatal: symbol `_init' is multiply-defined:
 (file
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crti.o and
 file /usr/local/lib/libreadline.so);
 ld: fatal: symbol `_start' is multiply-defined:
 (file
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crt1.o and
 file /usr/local/lib/libreadline.so);
 ld: fatal: symbol `_fini' is multiply-defined:
 (file
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/crti.o and
 file /usr/local/lib/libreadline.so);
 ld: fatal: symbol `_lib_version' is multiply-defined:
 (file /usr/ccs/lib/values-Xa.o and file

  /usr/local/lib/libreadline.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
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
--

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



Re: [R] R CMD check .

2003-02-12 Thread Jeff Gentry
 * checking for CRLF line endings in C sources/headers ... OK
 * creating Davies-Ex.R ... OK
 * checking examples ... ERROR
 Running examples failed.
 r:Davies%
 How do I tell which .Rd file is the problem?  (I suspect that the
 examples aren't actually being executed because most of them take a
 long time and the error is pretty much instantaneous).

You should have a directory named pkgName.Rcheck, inside of that there
should be a file pkgname-Ex.Rout  that should give you a clue as to
what is happening (it is the R output from the examples running).

-Jeff

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



Re: [R] R CMD check .

2003-02-12 Thread David Scott

Sorry, there was a typo in my answer:

On Thu, 13 Feb 2003, David Scott wrote:
.
.
.
lots of stuff cut
.
.

  examples aren't actually being executed because most of them take a
  long time and the error is pretty much instantaneous).
  
 Rcmd check makes a directory called libname.Rcheck. Inside that you will
 find a .Rout file which gives a log of the examples. If I understand the
 pattern it is called libname-Ed.Rout.
 
^
Make that libname-Ex.Rout

David Scott

_
David Scott Department of Statistics, Tamaki Campus
The University of Auckland, PB 92019
AucklandNEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED] 

Webmaster, New Zealand Statistical Association:
http://www.stat.auckland.ac.nz/nzsa/

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



Re: [R] rl_callback_read_char error on Solaris 7

2003-02-12 Thread Peter Dalgaard BSA
Yuelin Li [EMAIL PROTECTED] writes:

 This question is about compiling R-1.6.2 from source on a 
 Sparcstation-20 machine running Solaris 7, gcc-2.95.3 and 
 readline-4.2 (both gcc and readline from sunfreeware.com).  

I had some problems with the sunfreeware readline too when I tried 1.5
years ago. Ended up removing the .so version.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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



[R] legend

2003-02-12 Thread Wilkinson, Mark

I think I'm missing something tonight in the usage of 'legend':

plot(0, type=n)
legend(locator(1), month.abb[1:5], pch=15, col=1:5)

gives me something similar to what I want. But

legend(locator(1), month.abb[1:5], fill=T, col=1:5)

gives me 5 black boxes.

What am I doing wrong?

Thank you, 


 version
 _
platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major1
minor6.1
year 2002
month11
day  01
language R


Mark Wilkinson
Informatics Analyst
St. Jude Children's Research Hospital
Department of Pharmaceutical Sciences

The opinions expressed here are my own and do not necessarily represent
those of St. Jude Children's Research Hospital.

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



Re: [R] R CMD check .

2003-02-12 Thread Robin Hankin
Hello everybody 

thanks for your help with my R CMD check problem.  The file
Davies-Ex.Rout does indeed contain a transcript of the examples.

I've found the .Rd file that contains the problem.  The relevant
command executes perfectly when I cut-and-paste it onto the R command
line, but not when executed by R CMD check.  How can this be?

[tail of Davies-Ex.Rout included below]

The first four lines work fine (including a function listing) but the
final line least.squares(rdavies(100,params)) fails, apparently
because the is.sorted argument doesn't take its default value of
FALSE.  Anyone got any ideas as to why not?


robin


r:Davies.Rcheck% tail -27 Davies-Ex.Rout
 ##___ Examples ___:

 params - c(10,0.1,-0.1)
 rdavies(n=5,params)
[1] 10.367054  9.068977  9.409128  8.326713  9.885775
 ddavies(10,params)
[1] 0.25
 least.squares
function (data, print = FALSE, is.sorted = FALSE, start.v = NULL)
{
if (is.sorted == FALSE) {
data - sort(data)
}
if (is.null(start.v)) {
start.v - start.davies(data)
}
jj - optim(start.v, objective, dataset = data, is.sorted = TRUE)
if (print != TRUE) {
return(jj$par)
}
else {
return(list(parameters = jj$par, error = jj$value))
}
}
 least.squares(rdavies(100,params))
Error in if (is.sorted == FALSE) { : missing value where logical needed
Execution halted
r:Davies.Rcheck%


-- 

Robin Hankin, Lecturer,
School of Geography and Environmental Science
Tamaki Campus
Private Bag 92019 Auckland
New Zealand

[EMAIL PROTECTED]
tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042

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



Re: [R] legend

2003-02-12 Thread Hedderik van Rijn
legend(locator(1), month.abb[1:5], fill=T, col=1:5)

gives me 5 black boxes.


Try:

legend(locator(1), month.abb[1:5], fill=1:5)


What am I doing wrong?


The T is interpreted as (equal to?) a 1, so you're requesting the 
boxes to be filled with color 1, which is black.

 - Hedderik.

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


[R] sorting in lmList object

2003-02-12 Thread emb7
Hi all,
Forgive me if this is an obvious one
I want to make a plot of confidence intervals from an lmList object with a 
collection of simple linear models (lm(y~x)) using:

plot(intervals(mylmList))

and sort the plot by increasing mean values for the intercept. Is there an easy 
way of doing this? I've tried the order() and sort.list() functions, but I 
suspect they only work for data frames? Can I sort directly when plotting, or 
do I have to sort the whole lmList object?

Thanks!

Martin




--
Sent through WebMail: http://webmail.st-andrews.ac.uk/

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



Re: [R] Various Errors using Survey Package

2003-02-12 Thread Thomas Lumley
On Wed, 12 Feb 2003, Thompson, Trevor wrote:

 Hi,

 I have been experimenting with the new Survey package.  Specifically, I was
 trying to use some of the functions on the public-use survey data from NHIS
 (2000 Sample Adult file).

 Error 1):  The first error I get is when I try to specify the complex survey
 design.

 nhis.design-svydesign(ids=~psu, probs=~probs, strata=~strata, data=nhis.df,
 check.strata=TRUE)
 Error in svydesign(ids = ~psu, probs = ~probs, strata = ~strata, data =
 nhis.df,  :
 Clusters not nested in strata

 My data are sorted by strata, psu.  Can someone tell me what the structure
 has to be for a stratified sample with clustering?  Looking at the code, it
 appears to me that it does not allow more than 1 observation per psu [i.e.
 any(sc  1)].

  The problem is probably that your id numbers for PSU start up again in
each stratum (eg you have a PSU numbered 1 in each stratum).  If so, you
need the nest=TRUE option to tell svydesign() that all the PSUs numbered 1
in different strata are really different PSUs


 Error 2).  If I go ahead and specify check.strata=FALSE, then svydesign runs
 ok.  I then tried using the svymean function.  In the following example, if
 I specify na.rm=TRUE, I get the error below:

No, it doesn't run ok, it just doesn't report an error.

  svymean(nhis.df$crc10yr, design=nhis.design, na.rm=TRUE)
 Error in rowsum.default(x, strata) : Incorrect length for 'group'

 I traced this to the svyCprod call within svymean.   SvyCprod calls rowsum
 and the group argument (strata) appears to be the full length of that
 column rather than the subset with non-missing data.

With missing data you do need to use the data stored in the design object,
not a separate data frame, otherwise it will get confused. That is, you
want
  svymean(~crc10yr, design=nhis.design, na.rm=TRUE)


 Error 3).  I then tried svymean on another variable with na.rm=FALSE.  I got
 the following error:

  svymean(nhis.df$age, design=nhis.design)
 Error in drop(rval) : names attribute must be the same length as the vector

 I also traced this error to a call to rowsum within the function svyCprod.
 I'm not sure what names attribute this is referring to because the arguments
 to rowsum and the rval object do not appear to have a names attribute.  Does
 anyone know what the problem here might be?

This might be the same problem, in which case
svymean(~age, design=nhis.design)
should work.  You should also make sure you have version 1.0 of `survey'
rather than any of them 0.9-x versions that went up briefly on CRAN.

If you tell me where to find the NHIS data I will look at them. There
shouldn't be any special requirements on the format (other than using
nest=TRUE if PSUs don't have globally unique ids).  I've looked at data
from some NCHS studies that are used as examples by Stata, and I don't
have any of these problems.

Incidentally, you should try writing to the package maintainer first,
rather than the list. In this case it doesn't matter, since I read the
list frequently, but it might in other cases.

-thomas

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



[R] multi-color plot

2003-02-12 Thread Saurav Pathak
hi all,

i am trying to make multi-color plots.  that is, i generally use,

plot(x, y, type=n)
text(x, y, labels=class)

here, the vector class denotes the class of each point.  there are
usually 3-4 classes of points.  how may i display the different
classes in different colors?

thanks for any help.

-- 
saurav

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



Re: [R] multi-color plot

2003-02-12 Thread Sundar Dorai-Raj


Saurav Pathak wrote:

hi all,

i am trying to make multi-color plots.  that is, i generally use,

	plot(x, y, type=n)
	text(x, y, labels=class)

here, the vector class denotes the class of each point.  there are
usually 3-4 classes of points.  how may i display the different
classes in different colors?



Use the col argument in text, as in:

R plot(x=1:26,y=rep(0:1,13),type=n)
R text(x=1:26,y=0.5,labels=letters,col=terrain.colors(26))
R

where terrain.colors(26) is:

R terrain.colors(26)
 [1] #00A600 #0EAB00 #1DB000
 [4] #2DB600 #3EBB00 #50C000
 [7] #63C600 #76CB00 #8BD000
[10] #A0D600 #B6DB00 #CEE000
[13] #E6E600 #E6D612 #E7C924
[16] #E8BF36 #E9B848 #EAB35A
[19] #EBB16D #ECB27F #EDB592
[22] #EEBCA5 #EFC5B8 #F0D1CB
[25] #F1E0DF #F2F2F2

Also, I would avoid using `class' as a variable name since it has a 
special definition in R.


Hope this helps,
Sundar

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


Re: [R] multi-color plot

2003-02-12 Thread Saurav Pathak



Thus spake Sundar Dorai-Raj:

+  R plot(x=1:26,y=rep(0:1,13),type=n)
+  R text(x=1:26,y=0.5,labels=letters,col=terrain.colors(26))

now i get it.  what i am doing now is:

R mycol - cls
R mycol[mycol==0] - red
R mycol[mycol==1] - blue
R mycol[mycol==2] - green
R plot(x, y, type=n)
R text(x, y, labels=cls, col=mycol)

which is exactly what i wanted.

thanks!!
saurav

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



[R] Urgent Help on Cumulant computation on two R.V's

2003-02-12 Thread Feng Zhang
Hey

Now I am going to check the independence of random variables using cumulant
function.

So if R has such package or functions to calculate
the sample cumulant of a random vector?

Thanks a lot.

Fred

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



Re: [R] k- means cluster analysis

2003-02-12 Thread ripley
On Wed, 12 Feb 2003, Sundar Dorai-Raj wrote:

 Ngayee J Law wrote:
  Hi all,
  
  I am trying to run the k-means cluster analysis using the function kmeans
  in the package cluster.

I think it's the one in package mva.

[...]

 However, choosing bad starting values could cause kmeans to crash, as in:
 
 kmeans(x, centers = c(0, 0))

Really?  That does not crash here, but correctly reports an error message:

 kmeans(x, c(0,0))
Error in switch(Z$ifault, stop(empty cluster: try a better set of initial 
centers),  : 
empty cluster: try a better set of initial centers

If you actually have a crash, please report to R-bugs.

There is an increasing trend for people to describe informative error 
messages describing their errors as `crashes', but that is confusing at 
best.

-- 
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] Interpolation

2003-02-12 Thread Adaikalavan Ramasamy
Here is another way of doing it:

x - c(1990, 1994, 1995, 1997)
all.x - seq(min(x), max(x))
complementary.x - setdiff(all.x, x)



-Original Message-
From: Sundar Dorai-Raj [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, February 12, 2003 9:39 PM
To: Remigijus Lapinskas
Cc: [EMAIL PROTECTED]
Subject: Re: [R] Interpolation




Remigijus Lapinskas wrote:
 Many thanks to all who replied to my e-mail. My problem was that I had

 not known about the approx function.
 
 By the way, if I have  x - c(1990,1994,1995,1997), is there an 
 automated way to fill in the gaps, i.e., to get 
 c(1991,1992,1993,1996)?
 

Try this:

R x - c(1990, 1994, 1995, 1997)
R all.x - seq(min(x), max(x))
R missing.x - all.x[!all.x %in% x]
R missing.x
[1] 1991 1992 1993 1996
R

Regards,
Sundar

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

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