[R] ts function

2003-04-04 Thread Martin Wegmann
hello

I read Practical Time Series (Gareth Janacek; 2001) and they presented
e.g the
smoothing functions msmooth(x,k) or the bivariate function
crosscorr(x,y,k),
but both didn't work on my machine.  I only load the ts library, is
another
library necessary or did this function change since 2001? Is there a
more recent and detailed manual for ts?

thanks, cheers Martin


--
Martin Wegmann
Department of Animal Ecology and Tropical Biology
Zoology III, Biocenter
Am Hubland
97074 Würzburg
Germany
0931/888-4378
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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


[R] cdf function: inverse to quantile?

2003-04-04 Thread DED (David George Edwards)
Is there a function in R for calculating empirical cumulative distribution
functions, i.e. the inverse of the quantile function? Perhaps in some
library? I'd hate to have to re-invent the wheel.


David Edwards, Biostatistics, 
Novo Nordisk A/S, Bagsværd, Denmark.
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Tlf: +45 44 42 62 35. Fax: +45 44 42 14 80


[[alternate HTML version deleted]]

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


Re: [R] normalized frequency histogram

2003-04-04 Thread Spencer Graves
Have you considered truehist in library(mass)?

Spencer Graves
p.s.  This is discussed in Venables and Ripley (2002) Modern Applied 
Statistics with S, 4th ed., which I recommend highly for anyone who uses 
S-Plus or R.  I only wish I had gotten the first edition when it 
appeared.

Jim McLoughlin wrote:
Hi folks

I'm trying to plot a normalized frequency histogram of some data.  After 
checking the docs, it seems there is no built in feature for this.

from the definition for normalized frequency, I need to divide the 
relative frequency by the size of the intervals being used.

So I could divide the series by this interval length, and then plot the 
relative frequency.

The problem is determining the interval length that will be used in 
advance.  I'm supposed to manually pick the # of intervals between 20 
and 40 (not use sturges).  However, when I try different values for the 
nbreaks parameters, incrementing from 20 - 40, the histogram only 
changes at a couple of points on that interval.

Anyone have any suggestions as to how I should create this plot?  Or an 
explanation as to why my nbreaks parameter does not seem to force the 
number of intervals, but rather suggests a ballpark to be in?

thanks

Jim M

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


Re: [R] lme parameterization question

2003-04-04 Thread Spencer Graves
Have you looked at Pinheiro and Bates (2000) Mixed Effects Models in S 
and s-Plus?  lme is great, but I couldn't make it work until I spent 
some time with that book.

Hope this helps.
Spencer Graves
John Fieberg wrote:
Hi,

I am trying to parameterize the following mixed model (following Piepho
and Ogutu 2002), to test for a trend over time, using multiple sites:
y[ij]=mu+b[j]+a[i]+w[j]*(beta +t[i])+c[ij]

where:
y[ij]= a response variable at site i and year j
mu = fixed intercept
Beta=fixed slope
w[j]=constant representing the jth year (covariate) 
b[j]=random effect of jth year, iid N(0,sigma2[b])
a[i]=random effect of the ith site, iid N(0, sigma2[a])
t[i]=random effect of ith site, iid N(0, sigma2[t])
c[ij]=random error associated with ith site and jth year

I would like to assume that an unstructured relationship applies to
a[i] and t[i] (i.e., I would like to assume that the random effects a[i]
and t[i] are drawn from a multivariate normal distribution with non-zero
covariance parameter).  These random effects are assumed to be
independent from the b[j]'s and from the c[ij]'s.  I have tried several
approaches, but cannot seem to duplicate the results presented in Piepho
and Ogutu using R's lme function (but I can reproduce the results using
SAS proc mixed).
In SAS, the model is fit using:

proc mixed method=REML nobound;
   class year site;
   model y=w site/ddfm=satterth s;
   random int/sub=year;
   random int w/sub=site type=un;
run;
Any help would be greatly appreciated!

Reference:
Piepho, H-P. and J.O.Ogutu. 2002.  A simple mixed model for trend
analysis in wildlife populations.  Journal of Agricultural, Biological,
and Environmental Statistics, 7(3):350-360.
Thanks,

John

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


Re: [R] ace with mon=0

2003-04-04 Thread Frank E Harrell Jr
---
 
 I was wondering whether someone can help me understand the
 following behavior of the ace-function:
 
 When ace is called with mon-parameter set to zero, R gives the
 message response spec can only be lin or ordered
 (default) and returns immediately. However, according to the help
 file mon=0 requires the response transformations to be limited
 to monotonic transformations.
 
 For instance, the following call of the ace-function will not be
 evaluated if one gives mon=0
 
  TWOPI - 8*atan(1)
  x - runif(200,0,TWOPI)
  y - exp(sin(x)+rnorm(200)/2)
  a - ace(x,y, mon=0)
 
 Why does mon=0 not work and how should one interpret the message
 the response spec can only be lin or ordered ?
 
 Any help will be greatly appreciated,
   Christof
 
 Christof Schuster
 University of Notre Dame
 Department of Psychology   
 103 Haggar Hall
 Notre Dame, IN 46556

I use ace and avas quite a bit and have found a few tiny bugs such as 
that one.  I reported these bugs to the R bug list about a year ago 
and await corrections.  As you said, ace does handle nonmonotonic 
transformations of Y; you just have to turn off that error message.

Frank Harrell

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


[R] SVM module: scaling data applied to new test set without using SVMagain

2003-04-04 Thread seidel
Hello!

We are new in  using R.  We use the SVM module from the library 'e1071' 
for training. 

Problem formulation:

a classification has been performed using SVM module (linear kernel). 
Later, a new data set (test set) comparable to the training data shall be 
scaled in the same way  as the training set (using the same scaling 
parameter set, but without using the SVM again to save time). We found the 
scaling matrices, but we do not know, how to apply them. 

How must the scaling parameter matrices (scaled:center and scaled:scale) 
be applied to the test data set to receive the same scaling as it would 
have been done by the SVM module?

Thanx very much in advance!
[[alternate HTML version deleted]]

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Peter Dalgaard BSA
John Miyamoto [EMAIL PROTECTED] writes:

 Dear Help,
Suppose I have a character vector.
 
 x - c(Bob, loves, Sally)
 
 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally

Like this:

 paste(x,collapse= )
[1] Bob loves Sally

-- 
   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
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Combining the components of a character vector

2003-04-04 Thread strumila network systems
paste(x,collapse= )

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of John Miyamoto
Sent: Thursday, 3 April 2003 9:54 AM
To: R discussion group
Subject: [R] Combining the components of a character vector


Dear Help,
   Suppose I have a character vector.

x - c(Bob, loves, Sally)

I want to combine it into a single string:  Bob loves Sally .
paste(x) yields:
paste(x)
[1] Bob   loves Sally

The following function combines the character vector into a string in the
way that I want, but it seems somewhat inelegant.

paste.vector - function(x, ...) {
output - NULL
for (i in 1:length(x)) output - paste(output, x[i], ...)
output  } #end of function definition

paste.vector(x)
[1]  Bob loves Sally

Is there a more natural (no loop) way to do this in R?

John Miyamoto


John Miyamoto, Dept. of Psychology, Box 351525
University of Washington, Seattle, WA 98195-1525
Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
Homepage http://faculty.washington.edu/jmiyamot/


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

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Torsten Hothorn
 Dear Help,
Suppose I have a character vector.

 x - c(Bob, loves, Sally)

 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally


R x - c(Bob, loves, Sally)
R paste(x, collapse= )
[1] Bob loves Sally

best,

Torsten


 The following function combines the character vector into a string in the
 way that I want, but it seems somewhat inelegant.

 paste.vector - function(x, ...) {
   output - NULL
   for (i in 1:length(x)) output - paste(output, x[i], ...)
   output  } #end of function definition

 paste.vector(x)
 [1]  Bob loves Sally

 Is there a more natural (no loop) way to do this in R?

 John Miyamoto

 
 John Miyamoto, Dept. of Psychology, Box 351525
 University of Washington, Seattle, WA 98195-1525
 Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
 Homepage http://faculty.washington.edu/jmiyamot/
 

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



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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Ido M. Tamir
On Thursday 03 Apr 2003 1:54 am, John Miyamoto wrote:
 Dear Help,
Suppose I have a character vector.

 x - c(Bob, loves, Sally)

 I want to combine it into a single string:  Bob loves Sally .

y - paste(c, collapse= )

best wishes

Ido

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread vito muggeo
 x - c(Bob, loves, Sally)
 paste(x,collapse= )
[1] Bob loves Sally

best,
vito


- Original Message - 
From: John Miyamoto [EMAIL PROTECTED]
To: R discussion group [EMAIL PROTECTED]
Sent: Thursday, April 03, 2003 1:54 AM
Subject: [R] Combining the components of a character vector


 Dear Help,
Suppose I have a character vector.
 
 x - c(Bob, loves, Sally)
 
 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally
 
 The following function combines the character vector into a string in the
 way that I want, but it seems somewhat inelegant.
 
 paste.vector - function(x, ...) {
 output - NULL
 for (i in 1:length(x)) output - paste(output, x[i], ...)
 output } #end of function definition
 
 paste.vector(x)
 [1]  Bob loves Sally
 
 Is there a more natural (no loop) way to do this in R?
 
 John Miyamoto
 
 
 John Miyamoto, Dept. of Psychology, Box 351525
 University of Washington, Seattle, WA 98195-1525
 Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
 Homepage http://faculty.washington.edu/jmiyamot/
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Stephen C. Upton
John,

Try paste with collapse argument:
 x - c(Bob, loves, Sally)
 paste(x,collapse= )
[1] Bob loves Sally

HTH
steve

John Miyamoto wrote:

 Dear Help,
Suppose I have a character vector.

 x - c(Bob, loves, Sally)

 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally

 The following function combines the character vector into a string in the
 way that I want, but it seems somewhat inelegant.

 paste.vector - function(x, ...) {
 output - NULL
 for (i in 1:length(x)) output - paste(output, x[i], ...)
 output  } #end of function definition

 paste.vector(x)
 [1]  Bob loves Sally

 Is there a more natural (no loop) way to do this in R?

 John Miyamoto

 
 John Miyamoto, Dept. of Psychology, Box 351525
 University of Washington, Seattle, WA 98195-1525
 Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
 Homepage http://faculty.washington.edu/jmiyamot/
 

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

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


Re:[R] Combining the components of a character vector

2003-04-04 Thread Peter Wolf
John Miyamoto wrote:

 Suppose I have a character vector.
 x - c(Bob, loves, Sally)

 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally

 

Try:

 paste(x,collapse= )

and

 help(paste)

--Peter

---
 Peter Wolf,   Statistik/Informatik,   Fak.f.Wiwi,   Uni Bielefeld
 [EMAIL PROTECTED], http://www.wiwi.uni-bielefeld.de/~wolf/wolf.html
---



[[alternate HTML version deleted]]

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


RE: [R] Combining the components of a character vector

2003-04-04 Thread Wiener, Matthew
The collapse argument does what you want:

x - c(Bob, loves, Sally)
paste(c, collapse =  )

Hope this helps,

Matt Wiener

-Original Message-
From: John Miyamoto [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 02, 2003 6:54 PM
To: R discussion group
Subject: [R] Combining the components of a character vector


Dear Help,
   Suppose I have a character vector.

x - c(Bob, loves, Sally)

I want to combine it into a single string:  Bob loves Sally .
paste(x) yields:
paste(x)
[1] Bob   loves Sally

The following function combines the character vector into a string in the
way that I want, but it seems somewhat inelegant.

paste.vector - function(x, ...) {
output - NULL
for (i in 1:length(x)) output - paste(output, x[i], ...)
output  } #end of function definition

paste.vector(x)
[1]  Bob loves Sally

Is there a more natural (no loop) way to do this in R?

John Miyamoto


John Miyamoto, Dept. of Psychology, Box 351525
University of Washington, Seattle, WA 98195-1525
Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
Homepage http://faculty.washington.edu/jmiyamot/


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

--

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Ben Bolker

  paste(x,collapse= )


On Wed, 2 Apr 2003, John Miyamoto wrote:

 Dear Help,
Suppose I have a character vector.
 
 x - c(Bob, loves, Sally)
 
 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally
 
 The following function combines the character vector into a string in the
 way that I want, but it seems somewhat inelegant.
 
 paste.vector - function(x, ...) {
   output - NULL
   for (i in 1:length(x)) output - paste(output, x[i], ...)
   output  } #end of function definition
 
 paste.vector(x)
 [1]  Bob loves Sally
 
 Is there a more natural (no loop) way to do this in R?
 
 John Miyamoto
 
 
 John Miyamoto, Dept. of Psychology, Box 351525
 University of Washington, Seattle, WA 98195-1525
 Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
 Homepage http://faculty.washington.edu/jmiyamot/
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

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

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


RE: [R] Two questions

2003-04-04 Thread Ted Harding
... and one answer ...

On 02-Apr-03 Peter Dunn wrote:
 Hi all
 
 Two questions:
 
 1. I note that help for the postscript device claims The 
 postscript produced by R is EPS (Encapsulated PostScript)
 compatible  It does not say it is EPS *compliant*.  
 Indeed, the EPS produced by R includes a \showpage command 
 which I believe (not that I'm an expert!) non-standard EPS.  
 My question:  Is there any reason why it is EPS compatible,
 but not compliant?  (I ask because the \showpage caused me
 a minor trouble once.)

Nothing whatever wrong with this, and it is perfectly standard
and compliant and indeed is covered in the PostScript Language
Reference Manual.

Using 'showpage' allows the file to be displayed directly on
any PS device, while the file can be embedded in another document
PROVIDED the embedding PS code redefines 'showpage' to be null
(i.e. /showpage {} def) for the duration of the wrapper.

Some document-generating software, however, can be sloppy about
this, in which case you will indeed have trouble. But that is
the fault of the software, not of the fact that 'showpage' is
present in the file.

Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 167 1972
Date: 03-Apr-03   Time: 14:03:33
-- XFMail --

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


Re: [R] Trying to make a nested lme analysis

2003-04-04 Thread Douglas Bates
Where is the rats data available?

It looks as if you have an lme model with both a fixed effect for
Treatment and a random effect for Treatment.  I would guess that you
want to have a fixed effect for treatment and random effects for

 Rat %in% Treatment 

and 

 Liver %in% Rat %in% Treatment

If so you would first create a factor for Rat %in% Treatment, say rTrT
by 

 rats$rTrt = getGroups(~ 1 | Treatment/Rat, data = rats, level = 2)

then fit the lme model as

 lme(Glycogen ~ Treatment, data = rats, random = ~ 1|rTrT/Liver)


Ronaldo Reis Jr. [EMAIL PROTECTED] writes:

 Hi,
 
 I'm trying to understand the lme output and procedure.
 I'm using the Crawley's book.
 
 I'm try to analyse the rats example take from Sokal and Rohlf (1995).
 I make a nested analysis using aov following the book.
 
  summary(rats)
 Glycogen   Treatment  Rat  Liver  
  Min.   :125.0   Min.   :1   Min.   :1.0   Min.   :1  
  1st Qu.:135.8   1st Qu.:1   1st Qu.:1.0   1st Qu.:1  
  Median :141.0   Median :2   Median :1.5   Median :2  
  Mean   :142.2   Mean   :2   Mean   :1.5   Mean   :2  
  3rd Qu.:150.0   3rd Qu.:3   3rd Qu.:2.0   3rd Qu.:3  
  Max.   :162.0   Max.   :3   Max.   :2.0   Max.   :3  

  attach(rats)
  Treatment - factor(Treatment)
  Rat - factor(Rat)
  Liver - factor(Liver)
 
  model - aov(Glycogen~Treatment/Rat/Liver+Error(Treatment/Rat/Liver))
  summary(model)
 
 Error: Treatment
   Df  Sum Sq Mean Sq
 Treatment  2 1557.56  778.78
 
 Error: Treatment:Rat
   Df Sum Sq Mean Sq
 Treatment:Rat  3 797.67  265.89
 
 Error: Treatment:Rat:Liver
 Df Sum Sq Mean Sq
 Treatment:Rat:Liver 12  594.049.5
 
 Error: Within
   Df Sum Sq Mean Sq F value Pr(F)
 Residuals 18 381.00   21.17   
  
 
 OK,
 
 Then I try to make this analysis using lme.
 
  model - lme(Glycogen~Treatment, random=~1|Treatment/Rat/Liver)
  summary(model)
 Linear mixed-effects model fit by REML
  Data: NULL 
AIC  BIClogLik
   233.6213 244.0968 -109.8106
 
 Random effects:
  Formula: ~1 | Treatment
 (Intercept)
 StdDev:3.541272
 
  Formula: ~1 | Rat %in% Treatment
 (Intercept)
 StdDev: 6.00658
 
  Formula: ~1 | Liver %in% Rat %in% Treatment
 (Intercept) Residual
 StdDev:3.764883 4.600247
 
 Fixed effects: Glycogen ~ Treatment 
 Error in if (any(wchLv - (as.double(levels(xtTab[, wchPval])) == 0))) { : 
   missing value where logical needed
 In addition: Warning message: 
 NaNs produced in: pt(q, df, lower.tail, log.p) 
  
 
 The random effects are correct, the variance component is OK:
 
 In nested aov | In nested lme
 Residual
 21.1666   | 21.16227
 Liver in Rats
 14.16667  | 14.17434
 Rats in Treatment
 36.0648   | 36.079
 
 But I not understand why the Fixed effects error?
 
 What is the problem in my formula to make this analysis using lme?
 
 Thanks for all
 Inte
 Ronaldo
 -- 
 Anger kills as surely as the other vices.
 --
 |   // | \\   [*][***]
 || ( õ   õ )  [Ronaldo Reis Júnior  ][PentiumIII-600 ]
 |  V  [UFV/DBA-Entomologia  ][HD: 30 + 10 Gb ]
 ||  / \   [36571-000 Viçosa - MG][RAM: 128 Mb]
 |  /(.''`.)\  [Fone: 31-3899-2532   ][Video: SiS620-8Mb  ]
 ||/(: :'  :)\ [EMAIL PROTECTED]  ][Modem: Pctel-onboar]
 |/ (`. `'` ) \[ICQ#: 5692561][Kernel: 2.4.18 ]
 ||  ( `-  )   [*][***]
 ||| _/   \_Powered by GNU/Debian W/Sarge D+ || Lxuser#: 205366
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

-- 
Douglas Bates[EMAIL PROTECTED]
Statistics Department608/262-2598
University of Wisconsin - Madisonhttp://www.stat.wisc.edu/~bates/

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


[R] Na handing with time series objects

2003-04-04 Thread Wayne Jones
Hello All, 

Does anyone out there know a way to decompose time series objects with
missing values. 
A simple na.omit will not work since it does not preserve the time
differences between succesive observations. 

Thanks in advance, 

Wayne



Dr Wayne R. Jones
Statistician / Research Analyst
KSS Group plc
St James's Buildings
79 Oxford Street
Manchester M1 6SS
Tel: +44(0)161 609 4084
Mob: +44(0)7810 523 713



KSS Ltd
A division of Knowledge Support Systems Group plc
Seventh Floor  St James's Buildings  79 Oxford Street  Manchester  M1 6SS  England
Company Registration Number 2800886 (Limited) 3449594 (plc)
Tel: +44 (0) 161 228 0040   Fax: +44 (0) 161 236 6305
mailto:[EMAIL PROTECTED]http://www.kssg.com


The information in this Internet email is confidential and may b... {{dropped}}

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


RE: [R] S intrp function

2003-04-04 Thread Liaw, Andy
See if the `akima' package on CRAN does what you want.  I just checked in
Splus 6.1 on Linux and there's no `intrp'.  Do you mean `interp'?

Andy

 -Original Message-
 From: Don Isgitt [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 02, 2003 2:02 PM
 To: [EMAIL PROTECTED]
 Subject: [R] S intrp function
 
 
 Hi.
 
 I am trying some S-Plus scripts that I used a few years ago 
 on R. Many 
 things have worked flawlesly and I am very impressed with the 
 work the 
 developers have done. (As I remember, the license fee on 
 S-Plus at that 
 time was ~$4500 per seat (AIX) ouch!!) So, thank you.
 
 My question relates to the intrp function, which takes irregularly 
 spaced xyz data and produces a regular xyz grid suitable for 
 contouring 
 or imaging. I have not found the equivalent function in R; 
 have I missed 
 it or is there some other preferred method to accomplish this.
 
 Thank you very much.
 
 Don
 
 p.s. I am not subscribed to this list, so an email reply would be 
 appreciated.
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

--

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Douglas Bates
Use the collapse argument to paste.

 paste(c('Bob', 'loves', 'Sally'), collapse = ' ')
[1] Bob loves Sally

John Miyamoto [EMAIL PROTECTED] writes:

Suppose I have a character vector.
 
 x - c(Bob, loves, Sally)
 
 I want to combine it into a single string:  Bob loves Sally .

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread John Fox
Dear John,

Try paste(x, collapse= )

John

At 03:54 PM 4/2/2003 -0800, John Miyamoto wrote:
Dear Help,
   Suppose I have a character vector.
x - c(Bob, loves, Sally)

I want to combine it into a single string:  Bob loves Sally .
paste(x) yields:
paste(x)
[1] Bob   loves Sally
The following function combines the character vector into a string in the
way that I want, but it seems somewhat inelegant.
paste.vector - function(x, ...) {
output - NULL
for (i in 1:length(x)) output - paste(output, x[i], ...)
output  } #end of function definition
paste.vector(x)
[1]  Bob loves Sally
Is there a more natural (no loop) way to do this in R?
-
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: [EMAIL PROTECTED]
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Index of item in matrix

2003-04-04 Thread Peter Dalgaard BSA
[EMAIL PROTECTED] writes:

 Try these:
 
 which.col - function (mat, x) (which(mat==x)-1) %/% nrow(mat) + 1
 which.row - function (mat, x) (which(mat==x)-1) %% nrow(mat) + 1
 
 Knowing the R community, there may be already functions to do this.

There is. Take another look at ?which.

-- 
   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
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] How to organize/develop an R function

2003-04-04 Thread Ernesto Jardim
Hi

Maybe this is not an issue about R. It's probably a programming issue
and I am not a developer at all. Anyway my main developing activities
are in R and that's where I have difficulties.

When I develop a function or group of functions I lose eternities with
the objects attributes and classes. I do a lot of object manipulation
(lists to arrays, factors to numeric vectors, etc, etc) so that I can
group data and apply the proper calculations/models to the proper data
combination.

Some times I get lost or need debugging and hell comes on earth. The
objects names are unconsistent, the objects classes are not correct so
methods work differently, etc.

My question is about programming good pratices in R. Does anyone know
about documents ? Do you use some project management software that help
on the function structure ? Do you have any ideas ? How do you (the R
gurus) develop your packages ?

Thanks

EJ

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


[R] Matrix eigenvectors in R and MatLab

2003-04-04 Thread Mikael Niva
Dear R-listers

Is there anyone who knows why I get different eigenvectors when I run
MatLab and R? I run both programs in Windows Me. Can I make R to produce
the same vectors as MatLab?

#R Matrix
PA9900-c(11/24 ,10/53 ,0/1 ,0/1 ,29/43 ,1/24 ,27/53 ,0/1 ,0/1 ,13/43
,14/24 ,178/53 ,146/244 ,17/23 ,15/43 ,2/24 ,4/53 ,0/1 ,2/23 ,2/43 ,4/24
,58/53 ,26/244 ,0/1 ,5/43)

#R-syntax
PA9900-matrix(PA9900,nrow=5,byrow=T)
eigen(PA9900)

#R-output
$values
[1]  1.2352970  0.3901522 -0.2562860  0.2259411  0.1742592

$vectors
[,1][,2][,3]  [,4]   [,5]
[1,] -0.67795430 -1.70686496 -0.52613955 -8.675109 -0.8413826
[2,] -0.32621100  0.54611272 -0.21526356 -2.726193 -0.2876643
[3,] -2.83313878 -2.88801964  0.87388189 45.427935  4.5069361
[4,] -0.09857565 -0.33015962  0.09136359 -5.426254 -0.8201206
[5,] -0.68977432  0.01977374  0.61772506  3.751978  0.4348802


%Matlab Matrix
PA9900 =[11/24 10/53 0/1 0/1 29/43 ;1/24 27/53 0/1 0/1 13/43 ;14/24
178/53 146/244 17/23 15/43 ;2/24 4/53 0/1 2/23 2/43 ;4/24 58/53 26/244
0/1 5/43]

%MatLab-syntax
[wmat,dmat]=eig(mat)

%MatLab-output
wmat =

   -0.22500.4330   -0.4998   -0.1795   -0.1854
   -0.10830.17710.1599   -0.0614   -0.0583
   -0.9403   -0.7191   -0.84570.96170.9708
   -0.0327   -0.0752   -0.0967   -0.1750   -0.1160
   -0.2289   -0.50830.00580.09280.0802


dmat =

1.2353 0 0 0 0
 0   -0.2563 0 0 0
 0 00.3902 0 0
 0 0 00.1743 0
 0 0 0 00.2259

Yours sincerely, Mikael Niva


Mikael Niva
Avd. för Växtekologi, Dept. of Plant Ecology
EvolutionsBiologiskt Centrum, Uppsala Universitet
Villavägen 14
752 36 UPPSALA
E-post [EMAIL PROTECTED]
Tel. +46 (0)18 471 28 65
Fax +46 (0)18 55 34 19

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Jean-Pierre . Mueller
At 15:54 -0800 2.4.2003, John Miyamoto wrote:
Dear Help,
   Suppose I have a character vector.

x - c(Bob, loves, Sally)

I want to combine it into a single string:  Bob loves Sally .
[...]
Is there a more natural (no loop) way to do this in R?

John Miyamoto


paste(x, sep = , collapse =  ) ?


--
Jean-Pierre Muller
SSP / UNIL /  BFSH2 / CH-1015 Lausanne

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


[R] How to organize/develop an R function

2003-04-04 Thread Ernesto Jardim
Hi

Maybe this is not an issue about R. It's probably a programming issue
and I am not a developer at all. Anyway my main developing activities
are in R and that's where I have difficulties.

When I develop a function or group of functions I lose eternities with
the objects attributes and classes. I do a lot of object manipulation
(lists to arrays, factors to numeric vectors, etc, etc) so that I can
group data and apply the proper calculations/models to the proper data
combination.

Some times I get lost or need debugging and hell comes on earth. The
objects names are unconsistent, the objects classes are not correct so
methods work differently, etc.

My question is about programming good pratices in R. Does anyone know
about documents ? Do you use some project management software that help
on the function structure ? Do you have any ideas ? How do you (the R
gurus) develop your packages ?

Thanks

EJ

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


[R] Fink-ed R-base 1.6.2's lm() OK on G3 iBook

2003-04-04 Thread Ulises Mora Alvarez
Hi:

As a follow up on fink-ed R running on a G3 iBook:

As some folks suggest, I move from r-base-atlas to r-base using fink. As 
far as I can tell R is working OK now.

Machine: iBook G3 700 MHz
OS: 10.2.4
fink: Package manager version: 0.12.1; Distribution version: 0.5.1.cvs 
Version: R 1.6.2 (2003-01-10).

Regards.


On Wed, 2 Apr 2003, Peter Muhlberger wrote:

 First, let me thank all the folks who replied, many of which didn't make it
 into the digest.
 
 The following summarizes their experiences w/ lm on a G3 Mac.  Apparently
 some people have lm in R working w/ apparently the same configuration that
 doesn't work for others:

 Machine Operating SystemR Configuration Result
 G3 iBook10.2Jan's OS X Binary   lm works
 Pbook 500mhz G3 10.2Jan's OS X Binary   lm fails
 PB 400mhz G3 Pismo  10.2.4  Jan's OS X Binary   lm fails
 Beige G3OS XJan's OS X Binary   lm fails
 Beige G3OS XFink'ed lm works
 G3 iBookOS X   Fink'ed r-base-atlas 1.6.1-3 lm fails
 G3 Laptop   OS X?   Carbon rm162.sitlm works
 G3  OS X?   Carbon rm162.sitlm works
 
 These are responses from the following folks:
 
 D.G. , David, Peter (me), Steve, Steve, Ulises, Albyn, Martin
 
 From the above, the carbon version always seems to work, the finked version
 worked for one person and not the other, and Jan's binary worked for 1
 person but not three others.
 
 Peter
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

-- 
Ulises M. Alvarez
LAB. DE ONDAS DE CHOQUE
FISICA APLICADA Y TECNOLOGIA AVANZADA
UNAM
[EMAIL PROTECTED]

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Spencer Graves
paste( c(Bob, loves, Sally), collapse= )

Spencer Graves

John Miyamoto wrote:
Dear Help,
   Suppose I have a character vector.
x - c(Bob, loves, Sally)

I want to combine it into a single string:  Bob loves Sally .
paste(x) yields:
paste(x)
[1] Bob   loves Sally
The following function combines the character vector into a string in the
way that I want, but it seems somewhat inelegant.
paste.vector - function(x, ...) {
output - NULL
for (i in 1:length(x)) output - paste(output, x[i], ...)
output  } #end of function definition
paste.vector(x)
[1]  Bob loves Sally
Is there a more natural (no loop) way to do this in R?

John Miyamoto


John Miyamoto, Dept. of Psychology, Box 351525
University of Washington, Seattle, WA 98195-1525
Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
Homepage http://faculty.washington.edu/jmiyamot/

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Tony Plate
From ?paste:
 If a value is specified for `collapse', the values in the result
 are then concatenated into a single string, with the elements
 being separated by the value of `collapse'.
 paste(c(Bob, loves, Sally), collapse= )
[1] Bob loves Sally

At Wednesday 03:54 PM 4/2/2003 -0800, John Miyamoto wrote:
Dear Help,
   Suppose I have a character vector.
x - c(Bob, loves, Sally)

I want to combine it into a single string:  Bob loves Sally .
paste(x) yields:
paste(x)
[1] Bob   loves Sally
The following function combines the character vector into a string in the
way that I want, but it seems somewhat inelegant.
paste.vector - function(x, ...) {
output - NULL
for (i in 1:length(x)) output - paste(output, x[i], ...)
output  } #end of function definition
paste.vector(x)
[1]  Bob loves Sally
Is there a more natural (no loop) way to do this in R?

John Miyamoto


John Miyamoto, Dept. of Psychology, Box 351525
University of Washington, Seattle, WA 98195-1525
Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
Homepage http://faculty.washington.edu/jmiyamot/

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


RE: [R] Multivariate Time series

2003-04-04 Thread Chunlou Yung
Dr. Paul Gilbert's DSE (Dynamic System Estimation) library (which includes
VAR) is available in R package library, CRAN, if that's what you're asking.


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Erin Hodgess
 Sent: Wednesday, April 02, 2003 03:46 PM
 To: [EMAIL PROTECTED]
 Subject: [R] Multivariate Time series


 Dear R People:

 Is there a library for Multivariate time series, please?

 For some reason, I'm thinking that Dr. Paul Gilbert may have one?

 R Version 1.6.2 (i've updated!) for Windows

 Thanks so much!

 Sincerely,
 Erin Hodgess
 University of Houston - Downtown
 mailto: [EMAIL PROTECTED]

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

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


Re: [R] Index of item in matrix

2003-04-04 Thread John Janmaat
Hello All,

Thanks,

John.

Peter Dalgaard BSA wrote:
[EMAIL PROTECTED] writes:


Try these:

which.col - function (mat, x) (which(mat==x)-1) %/% nrow(mat) + 1
which.row - function (mat, x) (which(mat==x)-1) %% nrow(mat) + 1
Knowing the R community, there may be already functions to do this.


There is. Take another look at ?which.



--
--
Dr. John Janmaat
Department of Economics, Acadia University, Wolfville, NS, B4P 2R6
E-mail: [EMAIL PROTECTED]Web: http://ace.acadiau.ca/~jjanmaat
Tel: 902-585-1461  Fax: 902-585-1070
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Combining the components of a character vector

2003-04-04 Thread Jerome Asselin

Please, have a closer look at the help file for paste(), and use the 
collapse arguments.

Jerome

On April 2, 2003 03:54 pm, John Miyamoto wrote:
 Dear Help,
Suppose I have a character vector.

 x - c(Bob, loves, Sally)

 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally

 The following function combines the character vector into a string in
 the way that I want, but it seems somewhat inelegant.

 paste.vector - function(x, ...) {
   output - NULL
   for (i in 1:length(x)) output - paste(output, x[i], ...)
   output  } #end of function definition

 paste.vector(x)
 [1]  Bob loves Sally

 Is there a more natural (no loop) way to do this in R?

 John Miyamoto

 
 John Miyamoto, Dept. of Psychology, Box 351525
 University of Washington, Seattle, WA 98195-1525
 Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
 Homepage http://faculty.washington.edu/jmiyamot/
 

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

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


Re: [R] Index of item in matrix

2003-04-04 Thread Spencer Graves
Sundar's solution is better than mine unless the code must also work in 
S-Plus.

Spencer Graves

Sundar Dorai-Raj wrote:
Or more simply:

  set.seed(1)
  A - array(rnorm(12), dim=c(3,4))
  which(round(A) == 1, arr.ind = TRUE)
 row col
[1,]   2   2
[2,]   1   4
Though, the original post may need more clarification.

Sundar

Spencer Graves wrote:

Satisfying what conditions?

Does the following example help you get what you want?

  set.seed(1)
  A - array(rnorm(12), dim=c(3,4))
 
  sel - (round(A)==1)
  sel
  [,1]  [,2]  [,3]  [,4]
[1,] FALSE FALSE FALSE  TRUE
[2,] FALSE  TRUE FALSE FALSE
[3,] FALSE FALSE FALSE FALSE
  cbind(row(A)[sel],col(A)[sel])
 [,1] [,2]
[1,]22
[2,]14
Spencer Graves

John Janmaat wrote:

Hello All,

Is there a fast way to find the index(row and column) of a point in a 
matrix?

Thanks,

John.


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


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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Pierre Kleiber
Try the collapse argument in paste(), i.e.
   paste(x,collapse= )
John Miyamoto wrote:
Dear Help,
   Suppose I have a character vector.
x - c(Bob, loves, Sally)

I want to combine it into a single string:  Bob loves Sally .
paste(x) yields:
paste(x)
[1] Bob   loves Sally
The following function combines the character vector into a string in the
way that I want, but it seems somewhat inelegant.
paste.vector - function(x, ...) {
output - NULL
for (i in 1:length(x)) output - paste(output, x[i], ...)
output  } #end of function definition
paste.vector(x)
[1]  Bob loves Sally
Is there a more natural (no loop) way to do this in R?

John Miyamoto


John Miyamoto, Dept. of Psychology, Box 351525
University of Washington, Seattle, WA 98195-1525
Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
Homepage http://faculty.washington.edu/jmiyamot/

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



--
-
Pierre Kleiber Email: [EMAIL PROTECTED]
Fishery Biologist Tel: 808 983-5399/737-7544
NOAA FISHERIES - Honolulu Laboratory Fax: 808 983-2902
2570 Dole St., Honolulu, HI 96822-2396
-
 God could have told Moses about galaxies and mitochondria and
  all.  But behold... It was good enough for government work.
-
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Thanks re Combining the components of a character vector

2003-04-04 Thread John Miyamoto
Many people pointed out that the 'collapse' argument yields the solution
to my query:

 x - c(Bob, loves, Sally)
 paste(x, collapse= )
[1] Bob loves Sally

I had looked at the documentation for 'paste' within R and also in several
books before sending my question to R-Help, so I was aware of the
'collapse' argument, but I was making the mistake of abbreviating
'collapse':

 paste(x, col= )
[1] Bob loves   Sally  

The real source of my confusion was that I wasn't aware that arguments
following '...' must be fully specified.  Now I know that this is
important.  Thanks for the help.

John


John Miyamoto, Dept. of Psychology, Box 351525
University of Washington, Seattle, WA 98195-1525
Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
Homepage http://faculty.washington.edu/jmiyamot/


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


[R] InternetSeer- Account Set Up

2003-04-04 Thread Mike Dever
Dear Subscriber

Your account has been set up. Please keep this email for your records.

Login:  [EMAIL PROTECTED]
Password:   658xae49

If you have not completed the activation process, please do so now by logging 
into your account:
http://www.internetseer.com/ep/my_internetseer.jsp?7g7j5YM4xX6v76OwTKwPKPD7671ExzT=e3

We look forward to providing you with our valuable monitoring service.

Best Regards,

Michael Dever
CEO/Co-Founder
InternetSeer.com
[[alternate HTML version deleted]]

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


[R] How to estimate 2-D principal curve using PCURVE?

2003-04-04 Thread Feng Zhang
Hey, R-listers

I am a new user of R and just found the package of PCURVE which can estimate principal 
curve for arbitrary
dimensional data set.
Now I have some 2-Dimensional data set X, which is stored as an Nx2 matrix in data.txt 
file and looks as following:
-1.5551 2.4183
1.0051 1.0102
0.90644 0.82163
1.3248 1.7551
-1.3626 1.8568
-1.3554 1.8371
0.039396 0.0015521
-0.99622 0.99245
0.2314 0.053544
1.4127 1.9956
1.3814 1.9083
0.83861 0.70326
-1.045 1.092
-1.8073 3.2665
0.54591 0.29801
-0.69022 0.47641
-0.7084 0.50183
0.12357 0.015271
0.80539 0.64865
0.25549 0.065274
0.68935 0.47521
1.7864 3.1911
0.6431 0.41358
0.14709 0.021635
-0.5128 0.26296
0.49692 0.24693
1.3053 1.7039
-0.63626 0.40483
1.7643 3.1126
0.3945 0.15563
1.2391 1.5354
0.73498 0.5402
1.023 1.0465
0.16561 0.027426
-0.015812 0.00025002
1.6118 2.5978
-0.60822 0.36993
-0.45553 0.2075
1.7689 3.129
-1.5722 2.4718
0.24103 0.058093
1.1138 1.2406
-0.7679 0.58967
-0.19286 0.037195
0.025852 0.00066834
-1.2959 1.6793
1.3295 1.7675
-0.80465 0.64746
1.1729 1.3758
0.4756 0.2262
So how could I use the PCURVE to get the estimated principal curve? I tried, but 
alwasy got some error message.

 x - as.matrix(read.table(data.txt)); 
 s - pcurve(x, plot.init = FALSE, use.loc = TRUE);

Empty row or column (or negative sum) in table
Error in xy.coords(x, y) : x and y lengths differ


So would you please give me a point on how to use it in R correctly?

Thanks for your time and help.

Fred
[[alternate HTML version deleted]]

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Ray Brownrigg
Suppose I have a character vector.
 
 x - c(Bob, loves, Sally)
 
 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally
 
 Is there a more natural (no loop) way to do this in R?
 
RTFM:
 paste(x, collapse= )
[1] Bob loves Sally

Ray

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


[R] Hypatia

2003-04-04 Thread Ted Harding
It seems that hypatia.math.ethz.ch is hoarding messages
to the r-help list for up to 13 hours ... ?

Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 167 1972
Date: 03-Apr-03   Time: 21:22:12
-- XFMail --

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


Re: [R] S intrp function

2003-04-04 Thread Don Isgitt
Thank you, Roger, and to all who responded. akima is what I needed.

Don

Roger Peng wrote:

There is function `interp' in library(akima).  Maybe this is what you're
looking for?
-roger
___
UCLA Department of Statistics
[EMAIL PROTECTED]
http://www.stat.ucla.edu/~rpeng
On Wed, 2 Apr 2003, Don Isgitt wrote:

Hi.

I am trying some S-Plus scripts that I used a few years ago on R. Many 
things have worked flawlesly and I am very impressed with the work the 
developers have done. (As I remember, the license fee on S-Plus at that 
time was ~$4500 per seat (AIX) ouch!!) So, thank you.

My question relates to the intrp function, which takes irregularly 
spaced xyz data and produces a regular xyz grid suitable for contouring 
or imaging. I have not found the equivalent function in R; have I missed 
it or is there some other preferred method to accomplish this.

Thank you very much.

Don

p.s. I am not subscribed to this list, so an email reply would be 
appreciated.

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



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


[R] Printing zero as dot

2003-04-04 Thread Giovanni Petris

I'm pretty sure I've seen some examples of a function printing zero
entries in a matrix as dots, but I'm not able to find it now...
Any suggestions...? Thanks in advance. (Of course, I might have dreamt
of such a function...) 

Best,
Giovanni

-- 

 __
[  ]
[ Giovanni Petris [EMAIL PROTECTED] ]
[ Department of Mathematical Sciences  ]
[ University of Arkansas - Fayetteville, AR 72701  ]
[ Ph: (479) 575-6324, 575-8630 (fax)   ]
[ http://definetti.uark.edu/~gpetris/  ]
[__]

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


Re: [R] Can boot return matrix?

2003-04-04 Thread Thomas W Blackwell

You're certainly very close.  I observe that you have interchanged
positions for the function which calculates the statistic (f2) and
the number of replicates (R) in the third line of your example below.
Swap positions, or assign arguments by name instead of by position,
and I would expect this example to work.  Probably, you've spotted
this already.  Details are in  help(boot).

And, a matrix is also a vector, so perhaps f1() can return a matrix
without causing any problems.  If not, use

f2 - function(nxm.matrix, i)  as.vector(f1(nxm.matrix[i, ]))

The confidence intervals will require a separate call to boot.ci()
for each entry in the matrix, changing the value of boot.ci(index= )
each time.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Wed, 2 Apr 2003, Katalin  Csillery wrote:

 Dear All,

 I have a function which takes a n x m matrix as an argument and returns
 an n x n matrix. I want to take bootstrap samples form the input matrix
 in the way as each row represent a multivariate observation, so each
 bootstrap sample would be an n x m matrix, and on each sample I want to
 calculate the n x n matrix.

 f1 - function(nxm.matrix){...; return(nxn.matrix)}
 f2 - function(nxm.matrix, i) f1(nxm.matrix[i,])
 boot.out - boot(nxm.matrix, R, f2)
 Error: incorrect number of subscripts on matrix

 Since the final goal would be to put a confidence interval on the
 statistics in each cell of the matrix I would like to use the boot.ci.
 Even if I do the resampling with the sample function and I just use the
 boot.ci by artificially putting togethet an boot.out type of list I run
 into problems. Any idea how to set it up?

 Katalin Csillery
 Division of Biological Sciences
 University of Montana, Missoula MT 59801
 Phone: 406 243 6106, E-mail: [EMAIL PROTECTED]
 

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


[R] R Users

2003-04-04 Thread Doug Browning
I have been introduced to R in the last few weeks. I have been in contact 
with Fritz at the main website. One of the issues I am looking into is the 
amount of users that are involved with open source products. Fritz was able 
to give me some information with regard to the downloads of R from the 
website but he said he was not sure at all as to how many users there were 
regarding R.

Does anybody have an opinion as to approximately how many actual users of 
R exist out there in the open source community?  I am also interested to 
find out how many actual users there are out there for the Linux operating 
system if anybody happens to know.

___
Doug Browning
[EMAIL PROTECTED]
425-313-0331
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Trying to make a nested lme analysis

2003-04-04 Thread Ronaldo Reis Jr.
Thanks,

it works:))

Inte
Ronaldo


ps. rats data and others used in book is in the Crawley home page:

http://www.bio.ic.ac.uk/research/mjcraw/statcomp/welcome.htm


Em Douglas Bates, escreveu:
 Where is the rats data available?

 It looks as if you have an lme model with both a fixed effect for
 Treatment and a random effect for Treatment.  I would guess that you
 want to have a fixed effect for treatment and random effects for

  Rat %in% Treatment

 and

  Liver %in% Rat %in% Treatment

 If so you would first create a factor for Rat %in% Treatment, say rTrT
 by

  rats$rTrt = getGroups(~ 1 | Treatment/Rat, data = rats, level = 2)

 then fit the lme model as

  lme(Glycogen ~ Treatment, data = rats, random = ~ 1|rTrT/Liver)

 Ronaldo Reis Jr. [EMAIL PROTECTED] writes:
  Hi,
 
  I'm trying to understand the lme output and procedure.
  I'm using the Crawley's book.
 
  I'm try to analyse the rats example take from Sokal and Rohlf (1995).
  I make a nested analysis using aov following the book.
 
   summary(rats)
 
  Glycogen   Treatment  Rat  Liver
   Min.   :125.0   Min.   :1   Min.   :1.0   Min.   :1
   1st Qu.:135.8   1st Qu.:1   1st Qu.:1.0   1st Qu.:1
   Median :141.0   Median :2   Median :1.5   Median :2
   Mean   :142.2   Mean   :2   Mean   :1.5   Mean   :2
   3rd Qu.:150.0   3rd Qu.:3   3rd Qu.:2.0   3rd Qu.:3
   Max.   :162.0   Max.   :3   Max.   :2.0   Max.   :3
 
   attach(rats)
   Treatment - factor(Treatment)
   Rat - factor(Rat)
   Liver - factor(Liver)
  
   model - aov(Glycogen~Treatment/Rat/Liver+Error(Treatment/Rat/Liver))
   summary(model)
 
  Error: Treatment
Df  Sum Sq Mean Sq
  Treatment  2 1557.56  778.78
 
  Error: Treatment:Rat
Df Sum Sq Mean Sq
  Treatment:Rat  3 797.67  265.89
 
  Error: Treatment:Rat:Liver
  Df Sum Sq Mean Sq
  Treatment:Rat:Liver 12  594.049.5
 
  Error: Within
Df Sum Sq Mean Sq F value Pr(F)
  Residuals 18 381.00   21.17
 
 
  OK,
 
  Then I try to make this analysis using lme.
 
   model - lme(Glycogen~Treatment, random=~1|Treatment/Rat/Liver)
   summary(model)
 
  Linear mixed-effects model fit by REML
   Data: NULL
 AIC  BIClogLik
233.6213 244.0968 -109.8106
 
  Random effects:
   Formula: ~1 | Treatment
  (Intercept)
  StdDev:3.541272
 
   Formula: ~1 | Rat %in% Treatment
  (Intercept)
  StdDev: 6.00658
 
   Formula: ~1 | Liver %in% Rat %in% Treatment
  (Intercept) Residual
  StdDev:3.764883 4.600247
 
  Fixed effects: Glycogen ~ Treatment
  Error in if (any(wchLv - (as.double(levels(xtTab[, wchPval])) == 0))) {
  : missing value where logical needed
  In addition: Warning message:
  NaNs produced in: pt(q, df, lower.tail, log.p)
 
 
  The random effects are correct, the variance component is OK:
 
  In nested aov | In nested lme
  Residual
  21.1666   | 21.16227
  Liver in Rats
  14.16667  | 14.17434
  Rats in Treatment
  36.0648   | 36.079
 
  But I not understand why the Fixed effects error?
 
  What is the problem in my formula to make this analysis using lme?
 
  Thanks for all
  Inte
  Ronaldo
  --
  Anger kills as surely as the other vices.
  --
 
  |   // | \\   [*][***]
  |
  || ( õ   õ )  [Ronaldo Reis Júnior  ][PentiumIII-600 ]
  |
  |  V  [UFV/DBA-Entomologia  ][HD: 30 + 10 Gb ]
  |
  ||  / \   [36571-000 Viçosa - MG][RAM: 128 Mb]
  |
  |  /(.''`.)\  [Fone: 31-3899-2532   ][Video: SiS620-8Mb  ]
  |
  ||/(: :'  :)\ [EMAIL PROTECTED]  ][Modem: Pctel-onboar]
  |
  |/ (`. `'` ) \[ICQ#: 5692561][Kernel: 2.4.18 ]
  |
  ||  ( `-  )   [*][***]
  ||
  ||| _/   \_Powered by GNU/Debian W/Sarge D+ || Lxuser#: 205366
 
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help

-- 
O muito torna-se pouco com desejar um pouco mais.
-- Francisco de Quevedo 
--
|   // | \\   [*][***]
|| ( õ   õ )  [Ronaldo Reis Júnior  ][PentiumIII-600 ]
|  V  [UFV/DBA-Entomologia  ][HD: 30 + 10 Gb ]
||  / \   [36571-000 Viçosa - MG][RAM: 128 Mb]
|  /(.''`.)\  [Fone: 31-3899-2532   ][Video: SiS620-8Mb  ]
||/(: :'  :)\ [EMAIL PROTECTED]  ][Modem: Pctel-onboar]
|/ (`. `'` ) \[ICQ#: 5692561][Kernel: 2.4.18 ]
||  ( `-  )   [*][***]
||| _/   \_Powered by GNU/Debian W/Sarge D+ || Lxuser#: 205366

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


RE: [R] Combining the components of a character vector

2003-04-04 Thread Adaikalavan Ramasamy
Yes there is. 

 x - c(Bob, loves, Sally)
 paste(x, collapse= )
[1] Bob loves Sally



-Original Message-
From: John Miyamoto [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 03, 2003 7:54 AM
To: R discussion group
Subject: [R] Combining the components of a character vector

Dear Help,
   Suppose I have a character vector.

x - c(Bob, loves, Sally)

I want to combine it into a single string:  Bob loves Sally .
paste(x) yields:
paste(x)
[1] Bob   loves Sally

The following function combines the character vector into a string in
the
way that I want, but it seems somewhat inelegant.

paste.vector - function(x, ...) {
output - NULL
for (i in 1:length(x)) output - paste(output, x[i], ...)
output  } #end of function definition

paste.vector(x)
[1]  Bob loves Sally

Is there a more natural (no loop) way to do this in R?

John Miyamoto


John Miyamoto, Dept. of Psychology, Box 351525
University of Washington, Seattle, WA 98195-1525
Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
Homepage http://faculty.washington.edu/jmiyamot/


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

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


[R] R on AIX RISC-6000

2003-04-04 Thread Kris Nackaerts
Dear,

has anyone experience compiling R on a cluster of RISC-6000 systems (IBM 
Scalable Parallel System) with the xlc compiler (version 5)? We 
discovered we can use such a system at our university and have some 
processing time problems on Linux and Windows systems (running at 1.8 
Ghz an analysis takes us 20 hours for running approx. 2.000.000 logistic 
regressions).

Regards,

Kris

--

http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=krisn


Minds are like parachutes, they only work when open
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] trellis.graphic in for-loop

2003-04-04 Thread Alexander . Herr
Hi list,

I am unsuccessfully trying to produce a serious of trellis barcharts from
within a for-loop. The barcharts work outside the loop. What am I missing?
Example attached.

Thanks Herry

#XX


trellis.device(bg=white)
trellis.par.get(fontsize)-fontsize
fontsize$default-16
trellis.par.set(fontsize,fontsize)

a-c(1,2,4,5,4,3,3,3)
b-c(2,5,1,1,1,3,3,3)
c-c(3,5,1,2,2,5,5,5)
as.data.frame(cbind(a,b,c))-q21
varnames-colnames(q21)
i-
for (i in 1:3) {
round(table(q21[,i])/sum(table(q21[,i])),3)*100-z1
 as.data.frame.table(table(q21[,i]))-z1
  round(z1[,2]/sum(z1[,2]),3)*100-z1[,2]
   colnames(z1)-c(varnames[i],y)
   xnames-levels(z1[,1])
paste(xnames[1], - low,sep=)-xnames[1]
 paste(xnames[length(xnames)], - high,sep=)-xnames[length(xnames)]
  z1[,1]-xnames
 as.factor(z1[,1])-z1[,1]
barchart(
  horizontal=FALSE,
   z1[,2]~z1[,1],
ylab=list(% frequency,cex=1.5),
 main=list(varnames[i],cex=1.25),
scales=list(1,cex=1.5), col=#ffd18f,
   sub=list(Rating,cex=1.25)
)
filename-paste(test,i,_q21k.jpg,sep=)
#dev.print(jpeg, filename , width=1000, height=1000, quality=100,
bg=white, pointsize=20)
}


[[alternate HTML version deleted]]

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


[R] NA handling with time series objects

2003-04-04 Thread Wayne Jones
Hello All, 

Does anyone out there know a way to decompose time series objects with
missing values. 
A simple na.omit will not work since it does not preserve the time
differences between succesive observations. 

Thanks in advance, 

Wayne


KSS Ltd
A division of Knowledge Support Systems Group plc
Seventh Floor  St James's Buildings  79 Oxford Street  Manchester  M1 6SS  England
Company Registration Number 2800886 (Limited) 3449594 (plc)
Tel: +44 (0) 161 228 0040   Fax: +44 (0) 161 236 6305
mailto:[EMAIL PROTECTED]http://www.kssg.com


The information in this Internet email is confidential and may b... {{dropped}}

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


Re: [R]

2003-04-04 Thread Stephane Dray
On Wednesday 02 Apr 2003 6:43 am, Yongde Bao wrote:
 Can someone point out for me where to find a package to do principal
 component analysis for Affy data, if existing?
http://www.stat.uni-muenchen.de/~strimmer/rexpress.html

mva, multiv
See also the function dui.pca of the ade4 package.

Sincerely.
--
Stéphane DRAY
---
Biométrie et Biologie évolutive - Equipe Écologie Statistique
Universite Lyon 1 - Bat 711 - 69622 Villeurbanne CEDEX - France
Tel : 04 72 43 27 56			   Fax : 04 78 89 27 19
  04 72 43 27 57 	   E-mail : [EMAIL PROTECTED] 
---
Webhttp://www.steph280.freesurf.fr/
---

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


Re: [R] cdf function: inverse to quantile?

2003-04-04 Thread Petr Pikal
Hi

On 3 Apr 2003 at 13:20, DED (David George Edwards) wrote:

 Is there a function in R for calculating empirical cumulative
 distribution functions, i.e. the inverse of the quantile function?
 Perhaps in some library? I'd hate to have to re-invent the wheel.

try tu use search provided with the installation
in my case

D:\programy\R\rw1061\doc\html\search\SearchEngine.html

result

ecdf in Hmisc and stepfun libraries.

Cheers



 
 
 David Edwards, Biostatistics, 
 Novo Nordisk A/S, Bagsvrd, Denmark.
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
 Tlf: +45 44 42 62 35. Fax: +45 44 42 14 80
 
 
  [[alternate HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Petr Pikal
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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


Re: [R] Two y-axis in plots

2003-04-04 Thread Jerome Asselin

See the axis() function.

x - rnorm(20)
y- rnorm(20)
plot(x,y)
axis(4,at=-3:3,labels=(-3:3)*10)
axis(3,at=-3:3,labels=letters[1:7])

You may want to also consider plot(x,y,xaxt=n,yaxt=n) to suppress the 
x and y axes which you can rebuild with axis() to fit your purpose. See 
also the help file on par() for all kinds graphicals arguments. E.g., you 
may have to reset your margins with the mai options if you need enough 
space to include a label on the right axis.

Jerome

On April 3, 2003 02:53 am, Allan McRae wrote:
 Hi,

 I am trying to plot two data sets on one plot but with using a different
 y-axis ranges for each - preferably with one shown on each side of the
 graph.

 Is there a function that will allow me to do this.

 Thanks

 Allan McRae
   [[alternate HTML version deleted]]

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

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


Re: [R] Two y-axis in plots

2003-04-04 Thread Ott Toomet
Hi,

 | From: Allan McRae [EMAIL PROTECTED]
 | Date: Thu, 3 Apr 2003 11:53:32 +0100
 | 
 | Hi,
 | 
 | I am trying to plot two data sets on one plot but with
 | using a different y-axis ranges for each - preferably with one shown on each side 
of the graph.

This is a common question, you may try to search the mail archives.
There is no ready-made function in any of the common packages.
There may be some more-or-less suitable function either in the mailing
list or somewhere in the less common packages.

Basically what you have to do is to rescale your data, plot on the
same graph and draw a new axis using axis().

 plot(data1)
 newdata2 - ... #rescale your data2 into the same range as data1
 lines(data2) # or points()
 a3ticks - pretty(data2)
 newa3dticks - ... # here rescale the a3 ticks in the same way
 axis(3, at=newa3ticks, labels=a3ticks) # e.g. new location but old
# labels.

Perhaps it helps.

Ott

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


[R] How to organize/develop an R function

2003-04-04 Thread Ernesto Jardim
Hi

Maybe this is not an issue about R. It's probably a programming issue and I am not a 
developer at all. Anyway my main developing activities are in R and that's where I 
have difficulties.

When I develop a function or group of functions I lose eternities with the objects 
attributes and classes. I do a lot of object manipulation (lists to arrays, factors to 
numeric vectors, etc, etc) so that I can group data and apply the proper 
calculations/models to the proper data combination.

Then comes debugging and hell comes on earth. The objects names are unconsistent, the 
objects classes are not correct so methods work differently, etc.

My question is about programming good pratices in R. Does anyone know about documents 
(others than R manuals and MASS) ? Do you use some project management software that 
help on the function structure ? Do you have any ideas ? How do you (the R gurus) 
develop your packages ?

Thanks

EJ


-- 
Ernesto Jardim [EMAIL PROTECTED]
Marine Biologist
IPIMAR - National Research Institute for Agriculture and Fisheries
Av. Brasilia, 1400-006
Lisboa, Portugal
Tel: +351 213 027 000
Fax: +351 213 015 948
http://ernesto.freezope.org

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


Re: [R] cdf function: inverse to quantile?

2003-04-04 Thread Thomas W Blackwell
library(stepfun) help(ecdf)

... although there's not a great deal involved in re-inventing it.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Thu, 3 Apr 2003, DED (David George Edwards) wrote:

 Is there a function in R for calculating empirical cumulative distribution
 functions, i.e. the inverse of the quantile function? Perhaps in some
 library? I'd hate to have to re-invent the wheel.

 David Edwards, Biostatistics,
 Novo Nordisk A/S, Bagsværd, Denmark.
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 Tlf: +45 44 42 62 35. Fax: +45 44 42 14 80

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


[R] message

2003-04-04 Thread Ernesto Jardim
Hi 

This is a test message. I've tried to send some messages that never got
throught. I'm just checking what's wrong.

Sorry and don't bother answering.

EJ

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


RE: [R] ts function

2003-04-04 Thread Gavin Simpson
Hi Martin,

I guess you didn't get to Chapter 9 or the Preface ;-)

Yes, you need some further commands.  Get the files from:

http://www.uea.ac.uk/~gj/tsbook.html

The two commands you are having trouble with are both part of the commands
written by the authors for the book.  These are not packaged nicely in a
package that you can load with library().  Instead, you need to get the
files from the web site and then use source to read them into the working
environment.

Hope it helps,

Gavin

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
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   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin Wegmann
Sent: 03 April 2003 12:20
To: R-help
Subject: [R] ts function


hello

I read Practical Time Series (Gareth Janacek; 2001) and they presented
e.g the
smoothing functions msmooth(x,k) or the bivariate function
crosscorr(x,y,k),
but both didn't work on my machine.  I only load the ts library, is
another
library necessary or did this function change since 2001? Is there a
more recent and detailed manual for ts?

thanks, cheers Martin


--
Martin Wegmann
Department of Animal Ecology and Tropical Biology
Zoology III, Biocenter
Am Hubland
97074 Würzburg
Germany
0931/888-4378
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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


[R] Time to distribute replies to r-help

2003-04-04 Thread Spencer Graves
	  There appears to be a problem with the cycle time to distribe replies 
to r-help:  My reply (copied below) was submitted at 4/3/2003 8:26 AM, 
some 4.5 hours after the original post.  In those 4.5 hours, some 12 
others had submitted public replies.  However, none of those 12 had 
arrived at my computer before I filed mine.  My reply came back to me 
some 24.5 hours after I posted it.

	  Perhaps this problem has already corrected itself.  If not, I hope 
that someone who knows how to arrange for correction of this kind of 
problem will initiate effective corrective action.  (Our colleagues at 
the Eidgenoesche Technische Hochschule Zuerich may be suffering from too 
much success.)

Best Wishes,
Spencer Graves
Spencer Graves wrote:
 paste( c(Bob, loves, Sally), collapse= )

 Spencer Graves

 John Miyamoto wrote:

 Dear Help,
Suppose I have a character vector.

 x - c(Bob, loves, Sally)

 I want to combine it into a single string:  Bob loves Sally .
 paste(x) yields:
 paste(x)
 [1] Bob   loves Sally

 The following function combines the character vector into a string 
in the
 way that I want, but it seems somewhat inelegant.

 paste.vector - function(x, ...) {
 output - NULL
 for (i in 1:length(x)) output - paste(output, x[i], ...)
 output} #end of function definition

 paste.vector(x)
 [1]  Bob loves Sally

 Is there a more natural (no loop) way to do this in R?

 John Miyamoto

 
 John Miyamoto, Dept. of Psychology, Box 351525
 University of Washington, Seattle, WA 98195-1525
 Phone 206-543-0805, Fax 206-685-3157, Email [EMAIL PROTECTED]
 Homepage http://faculty.washington.edu/jmiyamot/
 

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


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

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


[R] biplot

2003-04-04 Thread Wolfgang Koller
Dear list,

 I want to perform a biplot, using customized titels for the x and y axis.
Setting xlab= and ylab= resulted in an error, e.g.:

 data(USArrests)
 biplot(princomp(USArrests),xlab=,ylab=)
Error in biplot.default(t(t(scores[, choices])/lam), t(t(x$loadings[,  : 
length of dimnames[1] not equal to array extent
 

How do I proceed?

Thanks in advance!

Wolfgang Koller


-
Wolfgang Koller,  [EMAIL PROTECTED]
Forschungsinstitut für Europafragen
Wirtschaftsuniversität Wien
Althanstraße 39-45, 1090 Vienna, Austria
Tel: ++43/1/31336/4147  Fax: ++43/1/31336/758
http://fgr.wu-wien.ac.at/institut/ef/ief-home.htm
-

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


Re: [R] Combining the components of a character vector

2003-04-04 Thread Thomas Lumley
 On Thursday 03 April 2003 01:54, John Miyamoto wrote:

snippage

  The following function combines the character vector into a string
  in the way that I want, but it seems somewhat inelegant.
 
  paste.vector - function(x, ...) {
  output - NULL
  for (i in 1:length(x)) output - paste(output, x[i], ...)
  output  } #end of function definition
 
  paste.vector(x)
  [1]  Bob loves Sally
 
  Is there a more natural (no loop) way to do this in R?

I might also take this opportunity to note that if paste() didn't have the
collapse=  argument there would still be more elegant way to write the
loop

   do.call(paste,as.list(x))

creates a call to paste() whose arguments are the elements of x.


-thomas

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


Re: [R] Hypatia

2003-04-04 Thread Spencer Graves
Hi, Ted:

Thanks.  This is one of many cases where poor quality may cost more than 
high quality:  It requires roughly 60 time as much space to store a 13+ 
hour queue than a 13 minute queue.

Best Wishes,
Spencer Graves
(Ted Harding) wrote:
It seems that hypatia.math.ethz.ch is hoarding messages
to the r-help list for up to 13 hours ... ?
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 167 1972
Date: 03-Apr-03   Time: 21:22:12
-- XFMail --
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] nlme and variance-covariance matrices.

2003-04-04 Thread Jarrod Hadfield
--
Dear R users,
I have data on around 2000 birds from 3 generations for which I know 
an individual's pedigree (i.e. the relationship it shares with other 
individuals e.g brother, uncle, mother) and also a pedigree based on 
foster-families, because half broods were removed from their nest of 
origin and placed in a foster parent's nest.

From this I want to model two types of random effects.  The first are 
additive genetic effects (Va) and the variance-covariance matrix 
associated with these are nearly always positive-definite and will 
look something like the following:

 1   0   0  0.5   0
 0   1   0  0.5   0
 0   0   1   00
0.5 0.5  0   1   0.25
 0   0   0  0.25   1
The elements basically correspond to the proportion of genes shared 
by any two individuals.

The second matrix will model additive maternal effects (Vm) and the 
variance-covariance matrix associated with these effects will usually 
not be positive definite as shown below.

1   100   0.5
1   1000
0   0110
0   0110
0.5 0001
The elements here correspond to the proportion of genes shared by the 
(foster) parents of the two individuals.  In this case 2 individuals 
raised in the same nest that fail to breed in subsequent years will 
have identical variance-covariance elements (row 34).

The structure of the random effects for the model will then be:

Va  0
 0  Vm
or possibly,

   Va Cov(a,m)
Cov(m,a) Vm
I am quite new to both mixed effect models and R so would like to 
know if it is possible to specify specific variance covariance 
structures and whether non-positive-definite matrices can be used.

Many thanks

Jarrod Hadfield.

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


Re: [R] cdf function: inverse to quantile?

2003-04-04 Thread Martin Maechler
 Ded == Ded (David George Edwards) [EMAIL PROTECTED]
 on Thu, 3 Apr 2003 13:20:25 +0200  writes:

Ded Is there a function in R for calculating empirical
Ded cumulative distribution functions, i.e. the inverse of
Ded the quantile function? Perhaps in some library?

Yes: in the `stepfun' package 
 (and already re-invented in other places)

(( package {in R; and  library section in other S implementations}))

Ded I'd hate to have to re-invent the wheel.

good idea ;-)

Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16Leonhardstr. 27
ETH (Federal Inst. Technology)  8092 Zurich SWITZERLAND
phone: x-41-1-632-3408  fax: ...-1228   

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


Re: [R] Printing zero as dot

2003-04-04 Thread Sundar Dorai-Raj
Giovanni Petris wrote:
I'm pretty sure I've seen some examples of a function printing zero
entries in a matrix as dots, but I'm not able to find it now...
Any suggestions...? Thanks in advance. (Of course, I might have dreamt
of such a function...) 

Best,
Giovanni
I just so have something that may help:

print.matrix2 - function(x, zero = ., ...) {
  zeros - which(x == 0, arr.ind = TRUE)
  x[zeros] - zero
  print(x, quote = FALSE, right = TRUE, ...)
  invisible()
}
 print.matrix2(diag(5))
 [,1] [,2] [,3] [,4] [,5]
[1,]1....
[2,].1...
[3,]..1..
[4,]...1.
[5,]....1

Sundar

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


Re: [R] hypatia problems?

2003-04-04 Thread Ted Harding
Just found John Logsdon's posting (copied below) on the R-help
archives (for which thanks, John). For comparison with what he
put up below (about 1 hour delay), following that is what I'm
getting at the moment (26 hours delay and increasingly steadily:
was 13 hours yesterday evening).

Just wondering if there's something about mailing to my account
which may be causing delay (but the admins at mcc.ac.uk assure
me there's no problem at their end). If anyone else is experiencing
similar problem (though in that case heaven knows when you'll get
this one) it would be useful to hear fron you (direct, please,
and not via the list!).
==
 From j.logsdon at lancaster.ac.uk:
 Dear all
 
 Off topic to some extent but Ted Harding has just called me to say he is
 
 (a) seeing large delays in the list messages when it is sent internally
 from hypatia.math.ethz.ch. I get only a delay of an hour which is
 reasonable in the scrap below but Ted reports delays of the order 24
 hours,
 
 (b) messages he has sent to the list don't appear on it for a long time.
 
 Is anyone else experiencing such difficulties?
 
 TIA
 
 John
 
 Received: from hypatia.math.ethz.ch (mailman at hypatia [129.132.58.23])
   by hypatia.math.ethz.ch (8.12.9/8.12.6) with ESMTP id
   h34DDGfm022344;
   Fri, 4 Apr 2003 15:13:29 +0200 (MEST)
   ^^
 Received: from eyre.southern.net.au (eyre.southern.net.au
   [202.182.64.147]) by hypatia.math.ethz.ch (8.12.9/8.12.6) with
   ESMTP id h33CLFfl025858 for r-help at stat.math.ethz.ch;
   Thu, 3 Apr 2003 14:21:16 +0200 (MEST)
   ^^
=
By contrast, from a message from r-help just received by me:

  Received: from hypatia.math.ethz.ch ([EMAIL PROTECTED] [129.132.58.23]) by
   hypatia.math.ethz.ch (8.12.9/8.12.6) with ESMTP id h34FXHg0022987;
   Fri, 4 Apr 2003 17:35:46 +0200 (MEST)
   ^^
  Received: from usryws02.merck.com (taz.merck.com [155.91.6.20]) by
   hypatia.math.ethz.ch (8.12.9/8.12.6) with SMTP id h33DVIfl010695 for
   [EMAIL PROTECTED];
   Thu, 3 Apr 2003 15:31:18 +0200 (MEST)
   ^^

[26 hours delay]

Thanks, apologies for OT[ish], and best wishes to all.

Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 167 1972
Date: 04-Apr-03   Time: 16:54:59
-- XFMail --

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


RE: [R] cdf function: inverse to quantile?

2003-04-04 Thread Wiener, Matthew
Take a look at ecdf in package stepfun.

-Original Message-
From: DED (David George Edwards) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 03, 2003 6:20 AM
To: '[EMAIL PROTECTED]'
Subject: [R] cdf function: inverse to quantile?


Is there a function in R for calculating empirical cumulative distribution
functions, i.e. the inverse of the quantile function? Perhaps in some
library? I'd hate to have to re-invent the wheel.


David Edwards, Biostatistics, 
Novo Nordisk A/S, Bagsværd, Denmark.
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Tlf: +45 44 42 62 35. Fax: +45 44 42 14 80


[[alternate HTML version deleted]]

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

--

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


[R] How to use PCURVE to estimate 2-D principal curves?

2003-04-04 Thread Feng Zhang
Hey, Rlisters.

Does anybody know how to use the package PCURVE to estimate a
2-Dimensional principal curve?

My 2-D data x is stored as a .txt file, looks as following:
xx xx
xx xx
...
xx xx

So how to write the command to get the principal curve?

Thanks for your point.

Fred

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


Re: [R] How to organize/develop an R function

2003-04-04 Thread Spencer Graves
	  1.  Have you read Venables and Ripley's two books, Modern Applied 
Statistics with S (now in its 4th edition) and S Programming? 
Especially the latter book could help in this regard.

	  2.  Which version of R are you using, under which operating system? 
With R 1.6.2 under Windows 2000, I can copy a *.r file into a new 
directory, double click, and have R open an empty .RData file in that 
directory.  This is can be helpful for identifying globals that you 
thought were local to a particular function (e.g., misspelled variable 
names).

Hope this helps.
Spencer Graves
Ernesto Jardim wrote:
Hi

Maybe this is not an issue about R. It's probably a programming issue
and I am not a developer at all. Anyway my main developing activities
are in R and that's where I have difficulties.
When I develop a function or group of functions I lose eternities with
the objects attributes and classes. I do a lot of object manipulation
(lists to arrays, factors to numeric vectors, etc, etc) so that I can
group data and apply the proper calculations/models to the proper data
combination.
Some times I get lost or need debugging and hell comes on earth. The
objects names are unconsistent, the objects classes are not correct so
methods work differently, etc.
My question is about programming good pratices in R. Does anyone know
about documents ? Do you use some project management software that help
on the function structure ? Do you have any ideas ? How do you (the R
gurus) develop your packages ?
Thanks

EJ

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


[R] hypatia problems?

2003-04-04 Thread j . logsdon
Dear all

Off topic to some extent but Ted Harding has just called me to say he is

(a) seeing large delays in the list messages when it is sent internally
from hypatia.math.ethz.ch. I get only a delay of an hour which is
reasonable in the scrap below but Ted reports delays of the order 24
hours,

(b) messages he has sent to the list don't appear on it for a long time.

Is anyone else experiencing such difficulties?

TIA

John

Received: from hypatia.math.ethz.ch ([EMAIL PROTECTED] [129.132.58.23])
by hypatia.math.ethz.ch (8.12.9/8.12.6) with ESMTP id
h34DDGfm022344;
Fri, 4 Apr 2003 15:13:29 +0200 (MEST)
^
Received: from eyre.southern.net.au (eyre.southern.net.au
[202.182.64.147])
by hypatia.math.ethz.ch (8.12.9/8.12.6) with ESMTP id
h33CLFfl025858
for [EMAIL PROTECTED]; Thu, 3 Apr 2003 14:21:16 +0200
(MEST)
^^

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


[R] Re: ... Outbound e-mail slow from R servers ...

2003-04-04 Thread Martin Maechler
About a day ago, I wrote
to R-devel (and Marc) :

 MM == Martin Maechler [EMAIL PROTECTED]
 on Thu, 3 Apr 2003 18:36:12 +0200 writes:

   Marc == Marc Schwartz [EMAIL PROTECTED]
   on Thu, 03 Apr 2003 09:24:20 -0600 writes:

  Marc Martin,

  Marc Not sure if you are aware of this, but since yesterday
  Marc there seems to be multi-hour delays in outbound e-mail
  Marc from r-help and r-devel.  Inbound mail seems to show
  Marc up on the archive OK.

  Marc I am just now getting posts from late yesterday my
  Marc time.  My post to r-devel on RH9 yesterday morning did
  Marc not show up back to me until last night (my time).

  Marc HTH,

MM Indeed that helped a bit, particularly since I'm in a
MM two day course today and tomorrow and haven't had time
MM to look closely.

MM What happened is that the mailman software has
MM occasionally been producing too long delays (of e.g.,
MM half an hour, even for R-core with 17 addresses!), for
MM quite a few weeks now -- which it didn't several weeks
MM ago.  The first thing I was advised to try was to revert
MM the mailman and sendmail settings to their defaults --
MM which I had done yesterday.  Additionally, yesterday a
MM big part of ETH had severe network problems during noon
MM time -- hence it wasn't too easy to find out which
MM timeouts where caused by what.

MM I have now re-reverted the mailman settings to what they
MM were before yesterday, and will start tackling the
MM only halfhour delays (which I think come from the
MM different qrunner setup that mailman 2.1.x is using --
MM which is active since about March 4).

MM Thanks for adverting me!

and the really bad thing that happened was that I had somehow
managed to almost stop mailman delivery ... 
I have restarted and things seem to got working much better
about an hour ago, and I've received many list mails myself
since  -- most delayed for more than a day...
I'm very sorry about that and hope it hasn't caused too much grief.

Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16Leonhardstr. 27
ETH (Federal Inst. Technology)  8092 Zurich SWITZERLAND
phone: x-41-1-632-3408  fax: ...-1228   


PS: This still applies:

MM BTW: If anyone has time for writing a small perl or
MM python script that automatically retrieves the mailman
MM delay from the two Received: headers in each message
MM that contain hypatia -- I'd be quite grateful..

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


Re: [R] message

2003-04-04 Thread Spencer Graves
r-help has recently experienced delays exceeding 24 hours.  Some 
progress has been made in diagnosis, but I don't know about the fix.

Spencer Graves

Ernesto Jardim wrote:
Hi 

This is a test message. I've tried to send some messages that never got
throught. I'm just checking what's wrong.
Sorry and don't bother answering.

EJ

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


Re: [R] Hypatia

2003-04-04 Thread Peter Dalgaard BSA
Spencer Graves [EMAIL PROTECTED] writes:

 Thanks.  This is one of many cases where poor quality may cost more
 than high quality:  It requires roughly 60 time as much space to store
 a 13+ hour queue than a 13 minute queue.

Not to mention the fact that shorter queues will keep people from
replying to something that was already answered. I think current
r-help subscribers are unlikely to forget about paste(x, collapse= )
for a while 

The queue would appear to be clearing now.

-- 
   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
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] trellis.graphic in for-loop

2003-04-04 Thread Martina Pavlicova

HI,

try to use 'print.trellis()'

Martina
-
see:

library(lattice)
trellis.device(bg=white)
trellis.par.get(fontsize)-fontsize
fontsize$default-16
trellis.par.set(fontsize,fontsize)

a-c(1,2,4,5,4,3,3,3)
b-c(2,5,1,1,1,3,3,3)
c-c(3,5,1,2,2,5,5,5)
as.data.frame(cbind(a,b,c))-q21
varnames-colnames(q21)
i-
for (i in 1:3) {
  round(table(q21[,i])/sum(table(q21[,i])),3)*100-z1
  as.data.frame.table(table(q21[,i]))-z1
  round(z1[,2]/sum(z1[,2]),3)*100-z1[,2]
  colnames(z1)-c(varnames[i],y)
  xnames-levels(z1[,1])
  paste(xnames[1], - low,sep=)-xnames[1]
  paste(xnames[length(xnames)], - high,sep=)-xnames[length(xnames)]
  z1[,1]-xnames
  as.factor(z1[,1])-z1[,1]
  print.trellis(barchart(
   horizontal=FALSE,
   z1[,2]~z1[,1],
   ylab=list(% frequency,cex=1.5),
   main=list(varnames[i],cex=1.25),
   scales=list(1,cex=1.5), col=#ffd18f,
   sub=list(Rating,cex=1.25)
   ))
  filename-paste(test,i,_q21k.jpg,sep=)
#dev.print(jpeg, filename ,
width=1000, height=1000, quality=100, bg=white, pointsize=20)
}


--
Department of Statistics Office Phone: (614) 292-1567
1958 Neil Avenue, 304E Cockins Hall  FAX: (614) 292-2096
The Ohio State UniversityE-mail: [EMAIL PROTECTED]
Columbus, OH 43210-1247  www.stat.ohio-state.edu/~pavlicov


On Fri, 4 Apr 2003 [EMAIL PROTECTED] wrote:

 Hi list,

 I am unsuccessfully trying to produce a serious of trellis barcharts from
 within a for-loop. The barcharts work outside the loop. What am I missing?
 Example attached.

 Thanks Herry

 #XX


 trellis.device(bg=white)
 trellis.par.get(fontsize)-fontsize
 fontsize$default-16
 trellis.par.set(fontsize,fontsize)

 a-c(1,2,4,5,4,3,3,3)
 b-c(2,5,1,1,1,3,3,3)
 c-c(3,5,1,2,2,5,5,5)
 as.data.frame(cbind(a,b,c))-q21
 varnames-colnames(q21)
 i-
 for (i in 1:3) {
 round(table(q21[,i])/sum(table(q21[,i])),3)*100-z1
  as.data.frame.table(table(q21[,i]))-z1
   round(z1[,2]/sum(z1[,2]),3)*100-z1[,2]
colnames(z1)-c(varnames[i],y)
xnames-levels(z1[,1])
 paste(xnames[1], - low,sep=)-xnames[1]
  paste(xnames[length(xnames)], - high,sep=)-xnames[length(xnames)]
   z1[,1]-xnames
  as.factor(z1[,1])-z1[,1]
 barchart(
   horizontal=FALSE,
z1[,2]~z1[,1],
 ylab=list(% frequency,cex=1.5),
  main=list(varnames[i],cex=1.25),
 scales=list(1,cex=1.5), col=#ffd18f,
sub=list(Rating,cex=1.25)
 )
 filename-paste(test,i,_q21k.jpg,sep=)
 #dev.print(jpeg, filename , width=1000, height=1000, quality=100,
 bg=white, pointsize=20)
 }


   [[alternate HTML version deleted]]

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


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


Re: [R] trellis.graphic in for-loop

2003-04-04 Thread Deepayan Sarkar
On Friday 04 April 2003 12:04 am, [EMAIL PROTECTED] wrote:
 Hi list,

 I am unsuccessfully trying to produce a serious of trellis barcharts from
 within a for-loop. The barcharts work outside the loop. What am I missing?

An explicit print() outside the barchart call. The result of barchart is a 
trellis object, which needs to be printed for anything to be plotted.

Deepayan

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


[R] Sampling from a Data Frame

2003-04-04 Thread Ko-Kang Kevin Wang
Hi,

I've been looking through the documentation for sample(), but can only get 
it to work with vectors.  Is it possible to sample from a dataframe?

-- 
Cheers,

Kevin

--
/* Time is the greatest teacher, unfortunately it kills its students */

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

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


Re: [R] Sampling from a Data Frame

2003-04-04 Thread Chuck Cleland
Ko-Kang Kevin Wang wrote:
I've been looking through the documentation for sample(), but can only get 
it to work with vectors.  Is it possible to sample from a dataframe?
Do you want to sample rows from a single dataframe?  How about 
something like this where 10 is the number of rows sampled:

mydata[sample(dim(mydata)[1], 10),]

hope it helps,

Chuck Cleland

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


Re: [R] Sampling from a Data Frame

2003-04-04 Thread Spencer Graves
What do you want?

The following selects 3 rows at random from DataFrame:

DataFrame - data.frame(x=1:9, y=rnorm(9))
DataFrame[sample(dim(DataFrame)[1], 3, replace=TRUE), ]
Spencer Graves

Ko-Kang Kevin Wang wrote:
Hi,

I've been looking through the documentation for sample(), but can only get 
it to work with vectors.  Is it possible to sample from a dataframe?

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


Re: [R] Calling Fortran routines

2003-04-04 Thread Duncan Murdoch
On Thu, 3 Apr 2003 11:14:55 +0100 , you wrote in message
[EMAIL PROTECTED]:


PS: I am using R version 1.6.2, under windows 2000 (professional), and the
Fortran code is compiled into a Windows 32bit DLL using Compaq Visual
Fortran Professional, edition 6.1.0

I don't know that compiler at all, but the usual cause of crashes like
this is using incompatible calling conventions.  The usual calling
convention for a DLL in Windows is stdcall, but R uses cdecl;
since I didn't see anything mentioned in your source, I think you were
probably using stdcall.

Hopefully your documentation will tell you how to ask for cdecl.

Once you find this, could you please email me a short paragraph saying
in detail what to do with your compiler?  I'm putting together a web
page showing what's necessary in various cases.   My current
incomplete draft is visible here: 

 http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs

Duncan Murdoch

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


Re: [R] Hypatia

2003-04-04 Thread partha_bagchi
Tell me about it ! :)

My email system was about to collapse ...

Partha.





Peter Dalgaard BSA [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
04/04/2003 02:18 PM

 
To: Spencer Graves [EMAIL PROTECTED]
cc: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject:Re: [R] Hypatia


Spencer Graves [EMAIL PROTECTED] writes:

 Thanks.  This is one of many cases where poor quality may cost more
 than high quality:  It requires roughly 60 time as much space to store
 a 13+ hour queue than a 13 minute queue.

Not to mention the fact that shorter queues will keep people from
replying to something that was already answered. I think current
r-help subscribers are unlikely to forget about paste(x, collapse= )
for a while

The queue would appear to be clearing now.

--
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
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



[[alternate HTML version deleted]]

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


[R] Problems with Mac OS X Beta 3 display?

2003-04-04 Thread Katalin Csillery

Beyond a general problem with X11, that it sometimes doesn't display 
-especially when it is inactive for a while-  new windows (like new 
terminal, R device, or emacs) and only the restart helps, I found a   
problem which might also be especially the X11's problem.
   
From an apple Terminal window, the following code (which is the first  
boot.ci example) works just fine.
 data(city)
 ratio - function(d, w)
  sum(d$x * w)/sum(d$u * w)
 city.boot - boot(city, ratio, R=999, stype=w,sim=ordinary)
 boot.ci(city.boot, conf=c(0.90,0.95),
  type=c(norm,basic,perc,bca))
I get normally the four types of confidenec intervals.
   
But form apple X11 public Beta 0.3 I get the following error messages,

 library(boot)

Attaching package `boot':


The following object(s) are masked _by_ .GlobalEnv :
 boot

 data(city)
 ratio - function(d, w)  sum(d$x * w)/sum(d$u * w)
 city.boot - boot(city, ratio, R=999, stype=w,sim=ordinary)
 boot.ci(city.boot, conf=c(0.90,0.95), type=c(norm,basic,perc,bca))
[1] odd number of coulumns
 [,1]   [,2]
[1,] 95/1.074 1.908/0.978
Error in paste((, ints1[, 2 * (1:n1)], ,, sep = ) :
subscript out of bounds

Did anyone find the same behavior under X11? Any soultions? Or just that
is why it is still beta.

Thanks for any thoughts, suggestions!

Katalin

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


[R] creating function bodies using body()

2003-04-04 Thread Setzer . Woodrow
I'm having trouble figuring out how to create a function using body-
().  The help file for body() says that the argument should be a list of
R expressions.  However if I try that I get an error:

 tmpfun - function(a, b=2){}
 body(tmpfun) - list(expression(z - a + b),expression(z^2))
Error in as.function.default(c(formals(f), value), envir) :
invalid formal argument list for function

Can someone give me a simple example for doing this?  Thanks!

R. Woodrow Setzer, Jr.Phone: (919) 541-0128
Experimental Toxicology Division Fax:  (919) 541-4284
Pharmacokinetics Branch
NHEERL B143-05; US EPA; RTP, NC 27711

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


Re: [R] trellis.graphic in for-loop

2003-04-04 Thread Douglas Bates
Martina Pavlicova [EMAIL PROTECTED] writes:

 HI,
 
 try to use 'print.trellis()'
 
 Martina

Actually the preferred approach is to use print(), not
print.trellis().  That is, call the generic function, not the specific
name of the method.  With namespaces, available in R-1.7.0 and later,
package authors have the option of hiding direct access to methods.
If Deepayan Sarkar added a namespace to the lattice package (and I
think he does plan to do that at some point) then using print() would
work as expected but using print.trellis() would no longer work.

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


Re: [R] Printing zero as dot

2003-04-04 Thread Giovanni Petris

Many thanks to J.R. Lockwood and to Sundar Dorai-Raj for sending me
their suggestions. I ended up using Sundar's function blended with a
flavour of `zapsmall':

print.matrix2 - function(x, zero = ., digits=getOption(digits), ...) {
if (all(ina - is.na(x))) 
return(x)
if (length(digits) == 0) 
stop(invalid digits)
mx - max(abs(x[!ina]))
x - round(x, digits = if (mx  0) 
   max(0, digits - log10(mx))
else digits)
zeros - which(x == 0, arr.ind = TRUE)
x[zeros] - zero
print(x, quote = FALSE, right = TRUE, ...)
invisible()
}

Have a good weekend,
Giovanni 


 
 I'm pretty sure I've seen some examples of a function printing zero
 entries in a matrix as dots, but I'm not able to find it now...
 Any suggestions...? Thanks in advance. (Of course, I might have dreamt
 of such a function...) 
 
 Best,
 Giovanni
 

-- 

 __
[  ]
[ Giovanni Petris [EMAIL PROTECTED] ]
[ Department of Mathematical Sciences  ]
[ University of Arkansas - Fayetteville, AR 72701  ]
[ Ph: (479) 575-6324, 575-8630 (fax)   ]
[ http://definetti.uark.edu/~gpetris/  ]
[__]

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


[R] sqlSave() Question

2003-04-04 Thread Minghua Yao
All,

I am new in R. I found sqlSave() doesn't work for our Oracle9i. The
following was the message:

 sqlSave(channel, USArrests, rownames=state)
Error in sqlColumns(channel, tablename) : USArrests : table not found on
channel
Check case parameter in odbcConnect


sqlQuery() works OK.

Please help. Thanks.

-MY

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


Re: [R] Matrix eigenvectors in R and MatLab

2003-04-04 Thread Thomas W Blackwell
Mikael  -

The matrix PA9900 is not a symmetric matrix.  Eigen() will
automatically detect this.  help(eigen) says explicitly:

For `eigen( , symmetric = FALSE)' the choice of length of
the eigenvectors is not defined by LINPACK.  In all other
cases the vectors are normalized to unit length.

In the example you give, the eigenvectors from R are clearly
NOT normalized to unit length, while those from Matlab are.
Even after normalizing them, the R eigenvectors will differ
by order and sign from the Matlab ones.  (Compare R column 3
with Matlab column 2.)  Have to look at the EISPACK source
documentation to see whether it's returning right eigenvectors
or left eigenvectors for an asymmetric matix.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Thu, 3 Apr 2003, Mikael Niva wrote:

 Dear R-listers

 Is there anyone who knows why I get different eigenvectors when I run
 MatLab and R? I run both programs in Windows Me. Can I make R to produce
 the same vectors as MatLab?

 #R Matrix
 PA9900-c(11/24 ,10/53 ,0/1 ,0/1 ,29/43 ,1/24 ,27/53 ,0/1 ,0/1 ,13/43
 ,14/24 ,178/53 ,146/244 ,17/23 ,15/43 ,2/24 ,4/53 ,0/1 ,2/23 ,2/43 ,4/24
 ,58/53 ,26/244 ,0/1 ,5/43)

 #R-syntax
 PA9900-matrix(PA9900,nrow=5,byrow=T)
 eigen(PA9900)

 #R-output
 $values
 [1]  1.2352970  0.3901522 -0.2562860  0.2259411  0.1742592

 $vectors
 [,1][,2][,3]  [,4]   [,5]
 [1,] -0.67795430 -1.70686496 -0.52613955 -8.675109 -0.8413826
 [2,] -0.32621100  0.54611272 -0.21526356 -2.726193 -0.2876643
 [3,] -2.83313878 -2.88801964  0.87388189 45.427935  4.5069361
 [4,] -0.09857565 -0.33015962  0.09136359 -5.426254 -0.8201206
 [5,] -0.68977432  0.01977374  0.61772506  3.751978  0.4348802

 %Matlab Matrix
 PA9900 =[11/24 10/53 0/1 0/1 29/43 ;1/24 27/53 0/1 0/1 13/43 ;14/24
 178/53 146/244 17/23 15/43 ;2/24 4/53 0/1 2/23 2/43 ;4/24 58/53 26/244
 0/1 5/43]

 %MatLab-syntax
 [wmat,dmat]=eig(mat)

 %MatLab-output
 wmat =
-0.22500.4330   -0.4998   -0.1795   -0.1854
-0.10830.17710.1599   -0.0614   -0.0583
-0.9403   -0.7191   -0.84570.96170.9708
-0.0327   -0.0752   -0.0967   -0.1750   -0.1160
-0.2289   -0.50830.00580.09280.0802

 dmat =
 1.2353 0 0 0 0
  0   -0.2563 0 0 0
  0 00.3902 0 0
  0 0 00.1743 0
  0 0 0 00.2259

 Yours sincerely, Mikael Niva

 
 Mikael Niva
 Avd. för Växtekologi, Dept. of Plant Ecology
 EvolutionsBiologiskt Centrum, Uppsala Universitet
 Villavägen 14
 752 36 UPPSALA
 E-post [EMAIL PROTECTED]
 Tel. +46 (0)18 471 28 65
 Fax +46 (0)18 55 34 19

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


Re: [R] creating function bodies using body()

2003-04-04 Thread Peter Dalgaard BSA
[EMAIL PROTECTED] writes:

 I'm having trouble figuring out how to create a function using body-
 ().  The help file for body() says that the argument should be a list of
 R expressions.  However if I try that I get an error:
 
  tmpfun - function(a, b=2){}
  body(tmpfun) - list(expression(z - a + b),expression(z^2))
 Error in as.function.default(c(formals(f), value), envir) :
 invalid formal argument list for function
 
 Can someone give me a simple example for doing this?  Thanks!

Like this:

 tmpfun - function(a, b=2){}
 body(tmpfun) - quote({z - a + b; z^2})
 tmpfun(3)
[1] 25

And yes, that help page could do with a rewrite...

-- 
   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
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Problems with Mac OS X Beta 3 display?

2003-04-04 Thread Thomas Lumley
On Fri, 4 Apr 2003, Katalin  Csillery wrote:

 But form apple X11 public Beta 0.3 I get the following error messages,

  library(boot)

 Attaching package `boot':


 The following object(s) are masked _by_ .GlobalEnv :
  boot


This message means that you have something called `boot' in your workspace
that will override the bootstrap function, and is probably causing the
error. In any case, it makes it very hard to diagnose the error.

I don't have any trouble with this example using version 0.2.1 of Apple's
X11 server, and since the example doesn't use any graphics it would be
surprising (though not completely impossible) for X11 to be the problem.

Try the example in a clean R workspace (if you are starting R from the
command line then type

R --vanilla

to start R without loading any previous workspace.


-thomas

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


Re: [R] Matrix eigenvectors in R and MatLab

2003-04-04 Thread Spencer Graves
Excellent analysis, Thomas.  An alternative to looking at EISPACK 
documentation is to do the following computations:

	(1) Values %*% diag(vectors) %*% solve(Values)

	(2) solve(Values) %*% diag(vectors) %*% Values

One of these two should return the original matrix; the other will 
likely be very different.  If so, the mystery is solved.  If (1) returns
PA9900, then

	PA9900 %*% Values = Values %*% diag(vectors)

Else

	Values %*% PA9900 = diag(vectors) %*% Values

Best Wishes,
Spencer Graves
Thomas W Blackwell wrote:
Mikael  -

The matrix PA9900 is not a symmetric matrix.  Eigen() will
automatically detect this.  help(eigen) says explicitly:
For `eigen( , symmetric = FALSE)' the choice of length of
the eigenvectors is not defined by LINPACK.  In all other
cases the vectors are normalized to unit length.
In the example you give, the eigenvectors from R are clearly
NOT normalized to unit length, while those from Matlab are.
Even after normalizing them, the R eigenvectors will differ
by order and sign from the Matlab ones.  (Compare R column 3
with Matlab column 2.)  Have to look at the EISPACK source
documentation to see whether it's returning right eigenvectors
or left eigenvectors for an asymmetric matix.
-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Thu, 3 Apr 2003, Mikael Niva wrote:


Dear R-listers

Is there anyone who knows why I get different eigenvectors when I run
MatLab and R? I run both programs in Windows Me. Can I make R to produce
the same vectors as MatLab?
#R Matrix
PA9900-c(11/24 ,10/53 ,0/1 ,0/1 ,29/43 ,1/24 ,27/53 ,0/1 ,0/1 ,13/43
,14/24 ,178/53 ,146/244 ,17/23 ,15/43 ,2/24 ,4/53 ,0/1 ,2/23 ,2/43 ,4/24
,58/53 ,26/244 ,0/1 ,5/43)
#R-syntax
PA9900-matrix(PA9900,nrow=5,byrow=T)
eigen(PA9900)
#R-output
$values
[1]  1.2352970  0.3901522 -0.2562860  0.2259411  0.1742592
$vectors
   [,1][,2][,3]  [,4]   [,5]
[1,] -0.67795430 -1.70686496 -0.52613955 -8.675109 -0.8413826
[2,] -0.32621100  0.54611272 -0.21526356 -2.726193 -0.2876643
[3,] -2.83313878 -2.88801964  0.87388189 45.427935  4.5069361
[4,] -0.09857565 -0.33015962  0.09136359 -5.426254 -0.8201206
[5,] -0.68977432  0.01977374  0.61772506  3.751978  0.4348802
%Matlab Matrix
PA9900 =[11/24 10/53 0/1 0/1 29/43 ;1/24 27/53 0/1 0/1 13/43 ;14/24
178/53 146/244 17/23 15/43 ;2/24 4/53 0/1 2/23 2/43 ;4/24 58/53 26/244
0/1 5/43]
%MatLab-syntax
[wmat,dmat]=eig(mat)
%MatLab-output
wmat =
  -0.22500.4330   -0.4998   -0.1795   -0.1854
  -0.10830.17710.1599   -0.0614   -0.0583
  -0.9403   -0.7191   -0.84570.96170.9708
  -0.0327   -0.0752   -0.0967   -0.1750   -0.1160
  -0.2289   -0.50830.00580.09280.0802
dmat =
   1.2353 0 0 0 0
0   -0.2563 0 0 0
0 00.3902 0 0
0 0 00.1743 0
0 0 0 00.2259
Yours sincerely, Mikael Niva


Mikael Niva
Avd. f?r V?xtekologi, Dept. of Plant Ecology
EvolutionsBiologiskt Centrum, Uppsala Universitet
Villav?gen 14
752 36 UPPSALA
E-post [EMAIL PROTECTED]
Tel. +46 (0)18 471 28 65
Fax +46 (0)18 55 34 19


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


[R] slides in linux R

2003-04-04 Thread Fredrik Lundgren
Hello,

In S-Plus Windows you can transform graphics to Powerpoint very easily, in R Windows 
you can use enhanced metafiles (.emf) and Powerpoint almost as easy. Is there a 
simular way with R in Linux to transform to the presentation program in StarOffice or 
OpenOffice or are you stuck with the pdf device?

Fredrik Lundgren

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