Re: [R] polr problem solved

2004-10-09 Thread Prof Brian Ripley
On Fri, 8 Oct 2004, Peter Flom wrote:

 I'd like to thank John Fox and Chuck Cleland for their help in resovling
 this issue.  It turned out to be something simple, but perhaps others
 have had similar problems
 
 In my original data frame, I had 4 categories of race/ethnicity.  One of
 the categories (other) was very small, and not similar to any of the
 other three categories, so I created a new data frame deleting those
 people.
 
 However, the level other was still there, with no one in it.
 This didn't cause a problem for glm or lm, but it did for polr.  When I
 eliminated that level, the problem disappeared.

How did you use `glm or lm' for an order factor response?  An empty factor 
level will certainly cause glm problems, depending which one it is.

An empty level will always cause polr problems, as there is no MLE under 
those circumstances.  I will add a sanity check in due course.

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

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


Re: [R] Survey of moving window statistical functions - still looking f or fast mad function

2004-10-09 Thread Prof Brian Ripley
On Fri, 8 Oct 2004, Tuszynski, Jaroslaw W. wrote:

[...]

   Finally a question: I still need to get moving windows mad function
 faster my runmad function is not that much faster than apply/embed combo,
 and that I used before, and this is where my code spends most of its time. I
 need something like runmed but for a mad function. Any suggestions?

Write your own C-level implementation, as runmed and most of the other
fast functions you cite are.

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

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


Re: [R] Adding factor variable to a CoxPH

2004-10-09 Thread Göran Broström
On Sat, Oct 09, 2004 at 09:03:23AM +0800, Neil Leonard wrote:
 I think this is a pretty basic statistic question:
 
 If I have a variable which has 4 factors how can I add it to a coxph 
 model? I have other variables added which have digits 1-4 instead of 
 four factors. If I recode the variable will that work?

?factor
?as.factor

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

-- 
 Göran Broströmtel: +46 90 786 5223
 Department of Statistics  fax: +46 90 786 6614
 Umeå University   http://www.stat.umu.se/egna/gb/
 SE-90187 Umeå, Sweden e-mail: [EMAIL PROTECTED]

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


[R] which() and value replacement in a matrix

2004-10-09 Thread Patrick Giraudoux
Hi,

I cannot go through the archives with which() as key-word... so common. Though I am 
sure to have seen something about this subject
in the past could somebody put me on the track. I have a matrix (actually a 
data.frame) in which I would replace the non-null values
by 1.

I tried the following:

indices-which(myforetbin  0,arr.ind=T)
myforetbin[indices[,1],indices[,2]]-1

and get the message:

 myforetbin[indices[,1],indices[,2]]-1
Error in [-.data.frame(`*tmp*`, indices[, 1], indices[, 2], value = 1) :
duplicate subscripts for columns

I get the same with

myforetbin[indices]-1

However, with:

myforetbin[indices]

I well get a vector with the corresponding non-null values.

Can somebody put me on the track?

All the best,

Patrick

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


Re: [R] polr problem solved

2004-10-09 Thread Peter Flom
Prof Brian Ripley [EMAIL PROTECTED] 10/09/04 3:18 AM asked


How did you use `glm or lm' for an order factor response?  An empty
factor 
level will certainly cause glm problems, depending which one it is.

An empty level will always cause polr problems, as there is no MLE under

those circumstances.  I will add a sanity check in due course.



The analyses were part of a paper I am writing, illustrating that, when
the DV is oddly
distributed (the DV in question was a count, with many 0's, and a long
right tail) that
the 'usual' methods not only are wrong for statisically reasaons (such
as grossly violating
model assumptions) but also give bad results.

While this is widely known to statisticians, in the fields in which I
work, people sometimes
analyze such variables using either OLS regression (hence lm), or by
categorizing the DV into 
something like 0, 1, 2, more than 2 (hence the need for polr). I also
tried Poisson regression and
negative binomial regression (hence glm).  

The empty level of the IV only caused a problem for polr

Thanks 

Peter


Peter

Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for Drug Use and HIV Research
National Development and Research Institutes
71 W. 23rd St
www.peterflom.com
New York, NY 10010
(212) 845-4485 (voice)
(917) 438-0894 (fax)

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


[R] Shangai ranking of world Universities

2004-10-09 Thread Jean lobry
Dear all,
this is somewhat off-topic, but given the audience of this
mailling list this might interest some people here.
I have imported under R the data used in 2004 by Liu et al.
from Shanghai Jiao Tong University to build their Academic
Ranking of World Universities, see:
http://ed.sjtu.edu.cn/rank/2004/2004Main.htm
The following R code:
loadURL(http://pbil.univ-lyon1.fr/R/donnees/shangai.RData;, mode = wb)
should import a dataframe called shangai in your workspace.
If you are interested I have also a draft Sweave-generated document
based on this dataframe, but all comments are in french.
I would be interested by references of scientific articles
about this ranking.
Best,
Jean Lobry
--
Jean R. Lobry([EMAIL PROTECTED])
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 12 87 fax: +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] which() and value replacement in a matrix

2004-10-09 Thread Liaw, Andy
Use the index vector directly, rather than breaking it up:

 x - matrix(sample(30), 10, 3)
 idx - which(x  25, arr.ind=TRUE)
 idx
 row col
[1,]   6   1
[2,]   9   1
[3,]   4   2
[4,]   6   2
[5,]   4   3
 x[idx] - 999
 x
  [,1] [,2] [,3]
 [1,]7   14   16
 [2,]   20   248
 [3,]   17   18   11
 [4,]   19  999  999
 [5,]   234   15
 [6,]  999  9995
 [7,]   219   12
 [8,]   2223
 [9,]  999   131
[10,]6   10   25

HTH,
Andy

 From: Patrick Giraudoux
 
 Hi,
 
 I cannot go through the archives with which() as key-word... 
 so common. Though I am sure to have seen something about this subject
 in the past could somebody put me on the track. I have a 
 matrix (actually a data.frame) in which I would replace the 
 non-null values
 by 1.
 
 I tried the following:
 
 indices-which(myforetbin  0,arr.ind=T)
 myforetbin[indices[,1],indices[,2]]-1
 
 and get the message:
 
  myforetbin[indices[,1],indices[,2]]-1
 Error in [-.data.frame(`*tmp*`, indices[, 1], indices[, 
 2], value = 1) :
 duplicate subscripts for columns
 
 I get the same with
 
 myforetbin[indices]-1
 
 However, with:
 
 myforetbin[indices]
 
 I well get a vector with the corresponding non-null values.
 
 Can somebody put me on the track?
 
 All the best,
 
 Patrick
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


RE: [R] problem Installing R 2.0.0 on SuSe 9.1

2004-10-09 Thread Christopher Albert
Hello:

I first tried it by using ./configure with the source files, but
found that there is a huge problem with the gcc-g77 package, then I
tried using the RPM obtained from CRAN, getting the following, the first
of which appears to be another manifestation of the g77 problem:

linux:/tmp # rpm -i R-base-2.0.0-1.i586.rpm
warning: R-base-2.0.0-1.i586.rpm: V3 DSA signature: NOKEY, key ID
a3278da3
error: Failed dependencies:
libg2c.so.0 is needed by R-base-2.0.0-1
libglade-gnome.so.0 is needed by R-base-2.0.0-1
libglade.so.0 is needed by R-base-2.0.0-1

Do you have a suggestion about what I (a suse beginner) should do in
order to get R up and running under suse 9.1?  I have done some looking
around and I do not see any package on suse for version 3.3.3 of the
gcc-g77 package that corresponds to the gcc-g++ version 3.3.3, and I
don't know if I am up to changing the versions of everything, so I hope
I don't have to do that.  Thanks in advance.


I'm not a Suse user, but this probably means you are missing a couple
packages that a required for the install. 
On a Fedora 2 box :
[EMAIL PROTECTED] albert]$ rpm -qf /usr/lib/libg2c.so.0
libf2c-3.3.3-7
[EMAIL PROTECTED] albert]$ rpm -qf /usr/lib/libglade-gnome.so.0
libglade-0.17-13.2.1
[EMAIL PROTECTED] albert]$ rpm -qf /usr/lib/libglade.so.0
libglade-0.17-13.2.1
[EMAIL PROTECTED] albert]$

Do you have those files? If not, you might just need to install a couple
of rpms, libf2c and libglade. They seem to be available for 9.1:

http://www.suse.com/us/private/products/suse_linux/prof/packages_profess
ional/libglade.html
http://www.suse.de/en/private/products/suse_linux/prof/packages_professi
onal/f2c.html

What does rpm -q f2c libglade tell you?

Chris

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


[R] RE: zero-inflated count models (was polr problem solved)

2004-10-09 Thread John Fox
Dear Peter,

 -Original Message-

. . .
 
 The analyses were part of a paper I am writing, illustrating 
 that, when the DV is oddly distributed (the DV in question 
 was a count, with many 0's, and a long right tail) that the 
 'usual' methods not only are wrong for statisically reasaons 
 (such as grossly violating model assumptions) but also give 
 bad results.
 
 While this is widely known to statisticians, in the fields in 
 which I work, people sometimes analyze such variables using 
 either OLS regression (hence lm), or by categorizing the DV 
 into something like 0, 1, 2, more than 2 (hence the need for 
 polr). I also tried Poisson regression and negative binomial 
 regression (hence glm).  
 

From your description, it seems possible that there are too many zeros for a
Poisson or negative-binomial model. Since the focus of your paper is the
methodology, you might want to try a zero-inflated Poisson or
negative-binomial model. Though I haven't tried them, I'm aware of two
sources of R functions for zero-inflated count models -- zeroinfl(), from
Simon Jackman's web site http://pscl.stanford.edu/content.html, and gnlr()
in Jim Lindsey's gnlm package, which is not available on CRAN but at
www.luc.ac.be/~jlindsey/rcode.html.

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox

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


Re: [R] which() and value replacement in a matrix

2004-10-09 Thread Patrick Giraudoux
Thanks for the clue.

Actually the trouble comes when refering to a data.frame. If I use the matrix from the 
data.frame (matrix(mydataframe)), everything
goes smoothly...

So I wrote:

indices-which(myforetbin  0,arr.ind=T)
myforetbin-as.matrix(myforetbin)
myforetbin[indices]-1
myforetbin-as.data.frame(myforetbin)

It works but I wonder if there are no more simple ways...

All the best,

Patrick


- Original Message - 
From: Liaw, Andy [EMAIL PROTECTED]
To: 'Patrick Giraudoux' [EMAIL PROTECTED]; r-help [EMAIL PROTECTED]
Sent: Saturday, October 09, 2004 3:00 PM
Subject: RE: [R] which() and value replacement in a matrix


 Use the index vector directly, rather than breaking it up:

  x - matrix(sample(30), 10, 3)
  idx - which(x  25, arr.ind=TRUE)
  idx
  row col
 [1,]   6   1
 [2,]   9   1
 [3,]   4   2
 [4,]   6   2
 [5,]   4   3
  x[idx] - 999
  x
   [,1] [,2] [,3]
  [1,]7   14   16
  [2,]   20   248
  [3,]   17   18   11
  [4,]   19  999  999
  [5,]   234   15
  [6,]  999  9995
  [7,]   219   12
  [8,]   2223
  [9,]  999   131
 [10,]6   10   25

 HTH,
 Andy

  From: Patrick Giraudoux
 
  Hi,
 
  I cannot go through the archives with which() as key-word...
  so common. Though I am sure to have seen something about this subject
  in the past could somebody put me on the track. I have a
  matrix (actually a data.frame) in which I would replace the
  non-null values
  by 1.
 
  I tried the following:
 
  indices-which(myforetbin  0,arr.ind=T)
  myforetbin[indices[,1],indices[,2]]-1
 
  and get the message:
 
   myforetbin[indices[,1],indices[,2]]-1
  Error in [-.data.frame(`*tmp*`, indices[, 1], indices[,
  2], value = 1) :
  duplicate subscripts for columns
 
  I get the same with
 
  myforetbin[indices]-1
 
  However, with:
 
  myforetbin[indices]
 
  I well get a vector with the corresponding non-null values.
 
  Can somebody put me on the track?
 
  All the best,
 
  Patrick
 
  __
  [EMAIL PROTECTED] mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
 


 --
 Notice:  This e-mail message, together with any attachments, contains information of 
 Merck  Co., Inc. (One Merck Drive,
Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known 
outside the United States as Merck Frosst,
Merck Sharp  Dohme or MSD and in Japan, as Banyu) that may be confidential, 
proprietary copyrighted and/or legally privileged. It
is intended solely for the use of the individual or entity named on this message.  If 
you are not the intended recipient, and have
received this message in error, please notify us immediately by reply e-mail and then 
delete it from your system.
 --

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


[R] conversion of a data.frame of numerics to a data.frame of factors

2004-10-09 Thread Patrick Giraudoux
Hi,

I am trying to convert a data.frame of numerics (this could be a matrix as well in 
this case) into a data.frame of factors.

I did it in a way that is less than direct...

myforet2-t(myforet)
for (i in 1:length(myforet2[1,])) {
if (i == 1)myforetfact-list(as.factor(myforet2[,i]))
else myforetfact-c(myforetfact,list(as.factor(myforet2[,i])))
}
myforetfact-data.frame(myforetfact)
names(myforetfact)-row.names(myforet)

Here again, I wonder if there are no easier way to go through (the loop is not R 
style, for the least). However, I cannot do
it otherway so far...

Cheers,

Patrick

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


[R] inst directory

2004-10-09 Thread Bob Wheeler
R CMD check now balks at my inst directory. It contains a single folder 
doc, but apparently any folder causes the problem. If inst is empty, 
the project checks OK. This was not a problem before 1.9. I've checked 
the documentation, but don't see a change. What am I missing.

--
Bob Wheeler --- http://www.bobwheeler.com/
ECHIP, Inc. ---
Randomness comes in bunches.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] conversion of a data.frame of numerics to a data.frame of factors

2004-10-09 Thread Prof Brian Ripley
On Sat, 9 Oct 2004, Patrick Giraudoux wrote:

mydf[] - lapply(mydf, as.factor)

would appear to be what you want.

For a matrix, I presume you want a factor matrix as the result.  Something 
like

my - matrix(1:12, 3, 4)
dmy - dim(my)
my - as.factor(my)
dim(my) - dmy
my

which does not print as a matrix but is one.  If you want a data frame 
result, convert to a data frame first.

 Hi,
 
 I am trying to convert a data.frame of numerics (this could be a matrix
 as well in this case) into a data.frame of factors.
 
 I did it in a way that is less than direct...
 
 myforet2-t(myforet)
 for (i in 1:length(myforet2[1,])) {
 if (i == 1)myforetfact-list(as.factor(myforet2[,i]))
 else myforetfact-c(myforetfact,list(as.factor(myforet2[,i])))
 }
 myforetfact-data.frame(myforetfact)
 names(myforetfact)-row.names(myforet)
 
 Here again, I wonder if there are no easier way to go through (the loop is not 
 R style, for the least). However, I cannot do
 it otherway so far...
 
 Cheers,
 
 Patrick
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 

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

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


[R] [R-pkgs] Publishing R package descriptions in JSS

2004-10-09 Thread Jan de Leeuw
More and more R packages come with a corresponding article in the  
Journal
of Statistical Software (www.jstatsoft.org). Achim Zeileis, our
TeXnical Editor, has recently contributed jss style files for issues,
bookreviews, software reviews, and code snippets. They can be
downloaded from

http://www.jstatsoft.org/JSSstyle.zip
Package authors who want to transform their package into a
published article are encouraged to use these style files.
===
Jan de Leeuw; Professor and Chair, UCLA Department of Statistics;
Editor: Journal of Multivariate Analysis, Journal of Statistical  
Software
US mail: 8125 Math Sciences Bldg, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550;  fax (310)-206-5658;  email: [EMAIL PROTECTED]
homepage: http://gifi.stat.ucla.edu
  
 
-
  No matter where you go, there you are. --- Buckaroo Banzai
   http://gifi.stat.ucla.edu/sounds/nomatter.au

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


[R] [R-pkgs] verfication package announcement

2004-10-09 Thread Matt Pocernich
The verification package has recently been posted to CRAN.  This package
was initially developed by people in the Verification Group at the
National Center for Atmospheric Research to verfiy and study weather
models and forecasts.  It has been written in general terms to be
applicable to other fields of study.  Functions include

receiver operating characteristic curves
attribute diagrams
reliability plots
spatial scale and frequency plots
conditional quantile plots and more.

Suggestions and comments on the package can be directed to me at
[EMAIL PROTECTED]  More information on verification (with a somewhat
meteorolgical perspective) can be found at
http://www.bom.gov.au/bmrc/wefor/staff/eee/verif/verif_web_page.html.

Thanks,

Matt

#
Matt Pocernich
NCAR - Research Applications Program
303-497-8312

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

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


[R] [R-pkgs] R interface for MINPACK least squares optimization library

2004-10-09 Thread Timur Elzhov
Hello guys.

I've built and uploaded to CRAN an R interface to MINPACK Fortran library,
which  solves non-linear  least squares problem  by  modification of the
Levenberg-Marquardt algorithm. The package includes one R function, which
passes  all  the necessary control parameters to the appropriate Fortran
functions.

The package location is
http://cran.r-project.org/src/contrib/Descriptions/minpack.lm.html


Best wishes,
Timur.

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

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


Re: [R] inst directory

2004-10-09 Thread Prof Brian Ripley
On Sat, 9 Oct 2004, Bob Wheeler wrote:

 R CMD check now balks at my inst directory. It contains a single folder 
 doc, but apparently any folder causes the problem. If inst is empty, 
 the project checks OK. This was not a problem before 1.9. I've checked 
 the documentation, but don't see a change. What am I missing.

Hard to tell.  (What does `balk at' really mean?  What OS?  What is meant
by `now'?: there is no `1.9' and 1.9.0 is six months ago.  And so on.)

There are many packages on CRAN with sub-directories of inst (I presume
that is what you mean by `folder'), for example MASS, sm, spatstat, and
several (e.g. strucchange) have an inst directory just containing a doc 
subdirectory.

As I hope is clear we would need a lot more information.  Also, I think 
R-devel is a more appropriate place to ask such questions.

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

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


Re: [R] conversion of a data.frame of numerics to a data.frame of factors

2004-10-09 Thread Patrick Giraudoux
This work perfectly with a data.frame. Actually my so-called data.frame was an 
output of t(), and thus not a data.frame (what I
realise after trying Prof. Ripley's example). If applied to an output of t() (eg 
t(df)), the result is quite unxpected (to me): a
strange list of 989 elements, each of them being a factor of one digit and one level 
corresponding to each cell of the matrix 23
rows x 43 columns...

So in this particular case, advised to write:

mydf-as.data.frame(t(mydf0))
mydf[] - lapply(mydf, as.factor)



 - Original Message - 
 From: Prof Brian Ripley [EMAIL PROTECTED]
 To: Patrick Giraudoux [EMAIL PROTECTED]
 Cc: r-help [EMAIL PROTECTED]
 Sent: Saturday, October 09, 2004 4:32 PM
 Subject: Re: [R] conversion of a data.frame of numerics to a data.frame of factors


  On Sat, 9 Oct 2004, Patrick Giraudoux wrote:
 
  mydf[] - lapply(mydf, as.factor)
 
  would appear to be what you want.
 
  For a matrix, I presume you want a factor matrix as the result.  Something
  like
 
  my - matrix(1:12, 3, 4)
  dmy - dim(my)
  my - as.factor(my)
  dim(my) - dmy
  my
 
  which does not print as a matrix but is one.  If you want a data frame
  result, convert to a data frame first.
 
   Hi,
  
   I am trying to convert a data.frame of numerics (this could be a matrix
   as well in this case) into a data.frame of factors.
  
   I did it in a way that is less than direct...
  
   myforet2-t(myforet)
   for (i in 1:length(myforet2[1,])) {
   if (i == 1)myforetfact-list(as.factor(myforet2[,i]))
   else myforetfact-c(myforetfact,list(as.factor(myforet2[,i])))
   }
   myforetfact-data.frame(myforetfact)
   names(myforetfact)-row.names(myforet)
  
   Here again, I wonder if there are no easier way to go through (the loop is 
   not R style, for the least). However, I
cannot
 do
   it otherway so far...
  
   Cheers,
  
   Patrick
  
   __
   [EMAIL PROTECTED] mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
  
  
 
  -- 
  Brian D. Ripley,  [EMAIL PROTECTED]
  Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
  University of Oxford, Tel:  +44 1865 272861 (self)
  1 South Parks Road, +44 1865 272866 (PA)
  Oxford OX1 3TG, UKFax:  +44 1865 272595


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


[R] Clustering of variable

2004-10-09 Thread clara gonalves
Hi!
Does anybody know if there is any way to do clustering of variables?
Thank you in advance,
Clara.
[[alternative HTML version deleted]]

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


Re: [R] Chernoff faces

2004-10-09 Thread Shigeru Mase
There is also an code which is more faithful (?) to the original
one by S. Aoki although it is in a Japanese HP
http://aoki2.si.gunma-u.ac.jp/R/face.html
Quality? Judge yourself!
Wolfram Fischer wrote:
Kenneth == Kenneth Cabrera [EMAIL PROTECTED] writes:
Kenneth Hello everybody: Does any one has a function to build Chernoff
Kenneth faces?
Many of us don't think it's worth them.
But we know that opinions differ and gladly incorporate
(good quality) submissions of source code.
R *is* an open source project and to some extent a community effort.
Please don't hesitate to contribute and enter the hall of fame of R
contributors :-)
Martin 

An example code from H.P. Wolf (2003) can be found at:
http://www.wiwi.uni-bielefeld.de/~wolf/ : S/R - functions : faces
Wolfram
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RE: zero-inflated count models (was polr problem solved)

2004-10-09 Thread Peter Flom
John Fox wrote

From your description, it seems possible that there are too many zeros
for a Poisson or negative-binomial model. Since the focus of your paper
is the methodology, you might want to try a zero-inflated Poisson or
negative-binomial model. Though I haven't tried them, I'm aware of two
sources of R functions for zero-inflated count models -- zeroinfl(),
from Simon Jackman's web site http://pscl.stanford.edu/content.html,
and gnlr()
in Jim Lindsey's gnlm package, which is not available on CRAN but at
www.luc.ac.be/~jlindsey/rcode.html.


Indeed. I am going to use these, as well, and attempt to demonstrate
that fitting the correct model not only is correct, statistically, but
also give results that are substantively different than the 'usual'
models.  I hope that this will increase the use of appropriate models in
the field (which, in case anyone is interested, is substance abuse
research, and, in my particular case, the syringe-sharing behaviors of
drug injectors).

Peter

Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for Drug Use and HIV Research
National Development and Research Institutes
71 W. 23rd St
www.peterflom.com
New York, NY 10010
(212) 845-4485 (voice)
(917) 438-0894 (fax)

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


[R] R-2.0.0 and tcltk package

2004-10-09 Thread Jean Eid
there does not seem to be a package tcltk on CRAN for 2.0.0.
I have successfully installed the same package for 1.9.1.

In essence I require the package for a GUI interface to setwd.
All work fine with 1.9.1.

This is on a Linux Debian unstable kernel 2.4.20

The build version of R 2.0.0 (issuing version whithin R) has the following

platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor0.0
year 2004
month10
day  04
language R



However, the build version of 1.9.1. has the paltform as i386

platform i386-pc-linux-gnu
arch i386
os   linux-gnu
system   i386, linux-gnu
status
major1
minor9.1
year 2004
month06
day  21
language R



Thank you for all the help,


Jean,

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


[R] Is it safe? Cochran etc

2004-10-09 Thread Dan Bolser

I have the following contingency table

dat - matrix(c(1,506,13714,878702),nr=2)

And I want to test if their is an association between events 

A:{a,not(a)} and B:{b,not(b)}

| b   | not(b) |
+-++
 a  |   1 |  13714 |
+-++
 not(a) | 506 | 878702 |
+-++

I am worried that prop.test and chisq.test are not valid given the low
counts and low probabilites associated with 'sucess' in each category.

Is it safe to use them, and what is the alternative? (given that
fisher.test can't handle this data... hold the phone...

I just found fisher.test can handle this data if the test is one-tailed
and not two-tailed.

I don't understand the difference between chisq.test, prop.test and
fisher.test when the hybrid=1 option is used for the fisher.test.

I was using the binomial distribution to test the 'extremity' of the
observed data, but now I think I know why that is inapropriate, however,
with the binomial (and its approximation) at least I know what I am
doing. And I can do it in perl easily...

Generally, how should I calculate fisher.test in perl (i.e. what are its
principles). When is it safe to approximate fisher to chisq?

I cannot get insight into this problem...

How come if I do...

dat - matrix(c(50,60,100,100),nr=2)

prop.test(dat)$p.value
chisq.test(dat)$p.value
fisher.test(dat)$p.value

I get 

[1] 0.5173269
[1] 0.5173269
[1] 0.4771358

When I looked at the binomial distribution and the normal approximation
thereof with similar counts I never had a p-value difference  0.004

I am so fed up with this problem :(

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


Re: [R] Is it safe? Cochran etc

2004-10-09 Thread Dan Bolser

Why can't I just use Log odds? Does the standard error of the logs score
depend on a similar chisq assumption?



On Sat, 9 Oct 2004, Dan Bolser wrote:


I have the following contingency table

dat - matrix(c(1,506,13714,878702),nr=2)

And I want to test if their is an association between events 

A:{a,not(a)} and B:{b,not(b)}

| b   | not(b) |
+-++
 a  |   1 |  13714 |
+-++
 not(a) | 506 | 878702 |
+-++

I am worried that prop.test and chisq.test are not valid given the low
counts and low probabilites associated with 'sucess' in each category.

Is it safe to use them, and what is the alternative? (given that
fisher.test can't handle this data... hold the phone...

I just found fisher.test can handle this data if the test is one-tailed
and not two-tailed.

I don't understand the difference between chisq.test, prop.test and
fisher.test when the hybrid=1 option is used for the fisher.test.

I was using the binomial distribution to test the 'extremity' of the
observed data, but now I think I know why that is inapropriate, however,
with the binomial (and its approximation) at least I know what I am
doing. And I can do it in perl easily...

Generally, how should I calculate fisher.test in perl (i.e. what are its
principles). When is it safe to approximate fisher to chisq?

I cannot get insight into this problem...

How come if I do...

dat - matrix(c(50,60,100,100),nr=2)

prop.test(dat)$p.value
chisq.test(dat)$p.value
fisher.test(dat)$p.value

I get 

[1] 0.5173269
[1] 0.5173269
[1] 0.4771358

When I looked at the binomial distribution and the normal approximation
thereof with similar counts I never had a p-value difference  0.004

I am so fed up with this problem :(

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


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


[R] RSQLite query error

2004-10-09 Thread Mikkel Grum
Dear R-helpers,

I ran the following little test on RSQLite and got the
data below from the query.  Unless I've made some
mistake, the results of both the where and order by
statements have problems:

library(RSQLite)
con-dbConnect(dbDriver(SQLite),dbname=test)
data(USArrests)
dbWriteTable(con,arrests,USArrests,overwrite=TRUE)
dbListTables(con)
dbReadTable(con,arrests)
dbGetQuery(con,paste(SELECT row_names,Murder,Rape
FROM arrests,
WHERE Rape30 ORDER BY Murder))

   row_names Murder Rape
1 Alaska   10.0 44.5
2 New Mexico   11.4 32.1
3   Michigan   12.1 35.1
4 Nevada   12.2 46.0
5Florida   15.4 31.9
6   North Dakota0.8  7.3
7  New Hampshire2.1  9.5
8  Maine2.1  7.8
9   Rhode Island3.4  8.3
10 West Virginia5.7  9.3
11  Colorado7.9 38.7
12   Arizona8.1 31.0
13California9.0 40.6

I'm running R 2.0.0 on Windows XP.  Should I make a
bug report or can someone point to an error that I've
made?

cheers
Mikkel

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


Re: [R] Is it safe? Cochran etc

2004-10-09 Thread Frederico Zanqueta Poleto
Dan,
I don't know what is the theory behind this hybrid option and what 
consists the Cochran conditions.

However, I think even if you suppose the asymptotic distribution is not 
too accurate, because your sampled 1, there is a too strong association 
of A and B, as this can be noticed by conservative methods such as using 
the Yates continuity correction or Wald/Neyman tests (that usually does 
not reject the null hypothesis of no interaction much more than the 
Pearson/score test and likelihood ratio test, in this order) of the log 
odds.
Both procedures inflate the pvalues, but not sufficiently to change your 
conclusion as you can notice by:

chisq.test(dat,correct=FALSE)
   Pearson's Chi-squared test
data:  dat 

X-squared = 6.0115, df = 1, p-value = 0.01421
chisq.test(dat)
   Pearson's Chi-squared test with Yates' continuity correction
data:  dat 

X-squared = 5.1584, df = 1, p-value = 0.02313
1-pchisq( (log(878702/(13714*506))^2)/(1+1/878702+1/13714+1/506) ,1)
# Wald test of null log odds
[1] 0.03898049
The book Categorical data analysis from Agresti (2002) has an ample 
discussion about tests like this on chapters 1 (basics and one sample) 
and 3 (two variables). You may look there if you still have doubts about 
this tests.

Sincerely,
--
Frederico Zanqueta Poleto
[EMAIL PROTECTED]
--
An approximate answer to the right problem is worth a good deal more than an exact answer 
to an approximate problem. J. W. Tukey

Dan Bolser wrote:
Why can't I just use Log odds? Does the standard error of the logs score
depend on a similar chisq assumption?

On Sat, 9 Oct 2004, Dan Bolser wrote:
 

I have the following contingency table
dat - matrix(c(1,506,13714,878702),nr=2)
And I want to test if their is an association between events 

A:{a,not(a)} and B:{b,not(b)}
  | b   | not(b) |
+-++
a  |   1 |  13714 |
+-++
not(a) | 506 | 878702 |
+-++
I am worried that prop.test and chisq.test are not valid given the low
counts and low probabilites associated with 'sucess' in each category.
Is it safe to use them, and what is the alternative? (given that
fisher.test can't handle this data... hold the phone...
I just found fisher.test can handle this data if the test is one-tailed
and not two-tailed.
I don't understand the difference between chisq.test, prop.test and
fisher.test when the hybrid=1 option is used for the fisher.test.
I was using the binomial distribution to test the 'extremity' of the
observed data, but now I think I know why that is inapropriate, however,
with the binomial (and its approximation) at least I know what I am
doing. And I can do it in perl easily...
Generally, how should I calculate fisher.test in perl (i.e. what are its
principles). When is it safe to approximate fisher to chisq?
I cannot get insight into this problem...
How come if I do...
dat - matrix(c(50,60,100,100),nr=2)
prop.test(dat)$p.value
chisq.test(dat)$p.value
fisher.test(dat)$p.value
I get 

[1] 0.5173269
[1] 0.5173269
[1] 0.4771358
When I looked at the binomial distribution and the normal approximation
thereof with similar counts I never had a p-value difference  0.004
I am so fed up with this problem :(
   

 

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


Re: [R] RSQLite query error

2004-10-09 Thread David James
Mikkel Grum wrote:
 Dear R-helpers,
 
 I ran the following little test on RSQLite and got the
 data below from the query.  Unless I've made some
 mistake, the results of both the where and order by
 statements have problems:

This is due to the fact that SQLite as of version 2.8 is typeless
and values are stored as ASCII strings. Most expressions are evaluated 
as string expressions, as in your query.  For details see
http://www.sqlite.org/datatypes.html (SQLite Version 2.8) and
http://www.sqlite.org/datatype3.html (Version 3.0).

You can use a trivial arithmetic expression to force numeric
comparisons (awk users may recognize this trick):

 dbGetQuery(con, 
 paste(select * from arrests where Rape+0.0  30,
   order by Murder+0.0))

   row_names Murder Assault UrbanPop Rape
1   Colorado7.9 204   78 38.7
2Arizona8.1 294   80 31.0
3 California9.0 276   91 40.6
4 Alaska   10.0 263   48 44.5
5 New Mexico   11.4 285   70 32.1
6   Michigan   12.1 255   74 35.1
7 Nevada   12.2 252   81 46.0
8Florida   15.4 335   80 31.9

Regards,

--
David
 
 
 library(RSQLite)
 con-dbConnect(dbDriver(SQLite),dbname=test)
 data(USArrests)
 dbWriteTable(con,arrests,USArrests,overwrite=TRUE)
 dbListTables(con)
 dbReadTable(con,arrests)
 dbGetQuery(con,paste(SELECT row_names,Murder,Rape
 FROM arrests,
 WHERE Rape30 ORDER BY Murder))
 
row_names Murder Rape
 1 Alaska   10.0 44.5
 2 New Mexico   11.4 32.1
 3   Michigan   12.1 35.1
 4 Nevada   12.2 46.0
 5Florida   15.4 31.9
 6   North Dakota0.8  7.3
 7  New Hampshire2.1  9.5
 8  Maine2.1  7.8
 9   Rhode Island3.4  8.3
 10 West Virginia5.7  9.3
 11  Colorado7.9 38.7
 12   Arizona8.1 31.0
 13California9.0 40.6
 
 I'm running R 2.0.0 on Windows XP.  Should I make a
 bug report or can someone point to an error that I've
 made?
 
 cheers
 Mikkel
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] R-2.0.0 and tcltk package

2004-10-09 Thread Prof Brian Ripley
On Sat, 9 Oct 2004, Jean Eid wrote:

 there does not seem to be a package tcltk on CRAN for 2.0.0.

It is part of the R tarball, so library(tcltk) should do something.
It has never been on CRAN, to my knowledge.  See the R FAQ 5.1.1
(as the posting guide suggests).

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

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


Re: [R] Is it safe? Cochran etc

2004-10-09 Thread Kjetil Brinchmann Halvorsen
Dan Bolser wrote:
I have the following contingency table
dat - matrix(c(1,506,13714,878702),nr=2)
And I want to test if their is an association between events 

A:{a,not(a)} and B:{b,not(b)}
   | b   | not(b) |
+-++
a  |   1 |  13714 |
+-++
not(a) | 506 | 878702 |
+-++
I am worried that prop.test and chisq.test are not valid given the low
counts and low probabilites associated with 'sucess' in each category.
 

 test - matrix( c(1,506, 13714, 878702), 2,2)
 test
[,1]   [,2]
[1,]1  13714
[2,]  506 878702
 chisq.test(test)
   Pearson's Chi-squared test with Yates' continuity correction
data:  test
X-squared = 5.1584, df = 1, p-value = 0.02313
 chisq.test(test,sim=TRUE)
   Pearson's Chi-squared test with simulated p-value (based on 2000
   replicates)
data:  test
X-squared = 6.0115, df = NA, p-value = 0.02099
 chisq.test(test,sim=TRUE, B=20)
# To rule out simulation uncertainty
   Pearson's Chi-squared test with simulated p-value (based on 20
   replicates)
data:  test
X-squared = 6.0115, df = NA, p-value = 0.01634
 N - sum(test)
 rows - rowSums(test)
 cols - colSums(test)
 E - rows %o% cols/N
 E
  [,1]  [,2]
[1,]   7.787351  13707.21
[2,] 499.212649 878708.79

None of the expected'eds are lesser than 5, an often  used rule of thumb 
(which might even be
to conservative. Just to check on the distribution:

rows - round(rows)
cols - round(cols)
 pvals - sapply(r2dtable(10, rows, cols), function(x) 
chisq.test(x)$p.value)
 hist(pvals)
# not very good approximation to uniform histogram, but:
 sum(pvals  0.05)/10
[1] 0.03068
 sum(pvals  0.01)/10
[1] 0.00669

So the true levels are not very far from the calculated by te chisq 
approximation, and it seems safe to use it.

All of this to show that with R you are not anymore dependent on old 
rules os thumb,
you can investigate for yourself.

Kjetil
Is it safe to use them, and what is the alternative? (given that
fisher.test can't handle this data... hold the phone...
I just found fisher.test can handle this data if the test is one-tailed
and not two-tailed.
I don't understand the difference between chisq.test, prop.test and
fisher.test when the hybrid=1 option is used for the fisher.test.
I was using the binomial distribution to test the 'extremity' of the
observed data, but now I think I know why that is inapropriate, however,
with the binomial (and its approximation) at least I know what I am
doing. And I can do it in perl easily...
Generally, how should I calculate fisher.test in perl (i.e. what are its
principles). When is it safe to approximate fisher to chisq?
I cannot get insight into this problem...
How come if I do...
dat - matrix(c(50,60,100,100),nr=2)
prop.test(dat)$p.value
chisq.test(dat)$p.value
fisher.test(dat)$p.value
I get 

[1] 0.5173269
[1] 0.5173269
[1] 0.4771358
When I looked at the binomial distribution and the normal approximation
thereof with similar counts I never had a p-value difference  0.004
I am so fed up with this problem :(
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Clustering of variable

2004-10-09 Thread Kjetil Brinchmann Halvorsen
clara gonçalves wrote:
Hi!
Does anybody know if there is any way to do clustering of variables?
Thank you in advance,
 

varclust() in Hmisc
Kjetil
Clara.
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] which() and value replacement in a matrix

2004-10-09 Thread Liaw, Andy
Use matrix indexing, instead of generating the index vector:

 x - as.data.frame(x)
 x[x  25] - -999
 x
 V1   V2   V3
1 7   14   16
220   248
317   18   11
419 -999 -999
5234   15
6  -999 -9995
7219   12
82223
9  -999   131
106   10   25

Andy

 From: Patrick Giraudoux
 
 Thanks for the clue.
 
 Actually the trouble comes when refering to a data.frame. If 
 I use the matrix from the data.frame (matrix(mydataframe)), everything
 goes smoothly...
 
 So I wrote:
 
 indices-which(myforetbin  0,arr.ind=T)
 myforetbin-as.matrix(myforetbin)
 myforetbin[indices]-1
 myforetbin-as.data.frame(myforetbin)
 
 It works but I wonder if there are no more simple ways...
 
 All the best,
 
 Patrick
 
 
 - Original Message - 
 From: Liaw, Andy [EMAIL PROTECTED]
 To: 'Patrick Giraudoux' [EMAIL PROTECTED]; 
 r-help [EMAIL PROTECTED]
 Sent: Saturday, October 09, 2004 3:00 PM
 Subject: RE: [R] which() and value replacement in a matrix
 
 
  Use the index vector directly, rather than breaking it up:
 
   x - matrix(sample(30), 10, 3)
   idx - which(x  25, arr.ind=TRUE)
   idx
   row col
  [1,]   6   1
  [2,]   9   1
  [3,]   4   2
  [4,]   6   2
  [5,]   4   3
   x[idx] - 999
   x
[,1] [,2] [,3]
   [1,]7   14   16
   [2,]   20   248
   [3,]   17   18   11
   [4,]   19  999  999
   [5,]   234   15
   [6,]  999  9995
   [7,]   219   12
   [8,]   2223
   [9,]  999   131
  [10,]6   10   25
 
  HTH,
  Andy
 
   From: Patrick Giraudoux
  
   Hi,
  
   I cannot go through the archives with which() as key-word...
   so common. Though I am sure to have seen something about 
 this subject
   in the past could somebody put me on the track. I have a
   matrix (actually a data.frame) in which I would replace the
   non-null values
   by 1.
  
   I tried the following:
  
   indices-which(myforetbin  0,arr.ind=T)
   myforetbin[indices[,1],indices[,2]]-1
  
   and get the message:
  
myforetbin[indices[,1],indices[,2]]-1
   Error in [-.data.frame(`*tmp*`, indices[, 1], indices[,
   2], value = 1) :
   duplicate subscripts for columns
  
   I get the same with
  
   myforetbin[indices]-1
  
   However, with:
  
   myforetbin[indices]
  
   I well get a vector with the corresponding non-null values.
  
   Can somebody put me on the track?
  
   All the best,
  
   Patrick
  
   __
   [EMAIL PROTECTED] mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
   http://www.R-project.org/posting-guide.html
  
  
 
 
  
 --
 
  Notice:  This e-mail message, together with any 
 attachments, contains information of Merck  Co., Inc. (One 
 Merck Drive,
 Whitehouse Station, New Jersey, USA 08889), and/or its 
 affiliates (which may be known outside the United States as 
 Merck Frosst,
 Merck Sharp  Dohme or MSD and in Japan, as Banyu) that may 
 be confidential, proprietary copyrighted and/or legally privileged. It
 is intended solely for the use of the individual or entity 
 named on this message.  If you are not the intended 
 recipient, and have
 received this message in error, please notify us immediately 
 by reply e-mail and then delete it from your system.
  
 --
 
 
 


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


[R] Mac: importing saved PDF figures into Illustrator CS

2004-10-09 Thread Tilo Blenk
Rene Bertin wrote:
 Hello,

 This is a usage question for others with experience of R under the  
Aqua Mac OS
 X interface.

 Basically, I don't succeed in importing PDF files (created with the  
'Save As'
 menu to Quartz device windows) into Illustrator. Versions up to (and
 including?) 10 loose paths (lines/polygons) and or fill them in  
black. Version
 CS (11) on the Mac imports almost correctly, but, to preserve  
appearance,
 some text has been outlined. In other words: *all* text in the  
figure is
 converted to polygons. Somewhat annoying if one plans to edit the  
text, and in
 general change the appearance. I've asked on both the Apple and Adobe
 Illustrator forums
  
(http://www.adobeforums.com/cgi-bin/webx? 
[EMAIL PROTECTED]@.3bb6383d/0),
 but have not yet received any reply. Maybe someone here has found a  
way to
 tell Illustrator not to outline ('preserve editability', in their  
jargon), or
 some other workaround?

 Thanks in advance, René Bertin

No real solution but try the pdf command instead of saving with the menu
pdf(file='~/Desktop/figure.pdf')
curve(x^2)
dev.off()
the resulting pdf file can be read into Illustrator CS without  
outlining the text (Mac OS X 10.3.5 with R 1.9.1) but each character is  
in a separate text frame.

As far as I remember the paths were not lost in Illustrator 10 but just  
were invisible. Selecting everything inside the plot region and setting  
the opacity to 100% (can be done in the transparency window) solved the  
problem.

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


[R] functions

2004-10-09 Thread Benjamin M. Osborne
Does anyone know of a list of functions that R already knows?  I can't seem to
find this anywhere in the help documentation.  For example, I want to count the
number of occurences of a certain value in a column of a data frame: What do I
have to do to tell R to Count?
Thanks,
Ben Osborne

--
Botany Department
University of Vermont
109 Carrigan Drive
Burlington, VT 05405

[EMAIL PROTECTED]
phone: 802-656-0297
fax: 802-656-0440

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


Re: [R] functions

2004-10-09 Thread Duncan Murdoch
On Sat,  9 Oct 2004 18:12:20 -0400, Benjamin M. Osborne
[EMAIL PROTECTED] wrote:

Does anyone know of a list of functions that R already knows?  I can't seem to
find this anywhere in the help documentation.  For example, I want to count the
number of occurences of a certain value in a column of a data frame: What do I
have to do to tell R to Count?

There are several such lists.  The one you want is probably the one
the help system uses.  For example,

help.search('count')

lists a number of functions that count various things.  I don't think
any of them is exactly what you want, which could be accomplished in a
couple of ways:

table(x)

gives counts of all the different values in x;

length(x[x==3])

gives the count of occurences of 3 in x.

Duncan Murdoch

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


[R] Fatal error: unable to restore saved data in .Rdata

2004-10-09 Thread Susan Yeh
Dear Sir/Madam:
I'm currently running R 1.9.1 on a Mac OS 10.3. I have been able to
use it fine for a while now. But for some reason, it now crashes
each time I open it with the error: Fatal error: unable to restore
saved data in .Rdata
I read on the online help forum that I can just delete the bad
.Rdata file. But I cannot find it. I even tried to delete
everything related to R and reinstalling but the problem has not
gone away.
Please HELP!
Thank you,
Susan Yeh

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


[R] How to install a package that needs to see oher pkg dependencies:

2004-10-09 Thread Aldi Kraja
Hi,
I am trying to install the genetics package on a server with Linux, 
Fedora. I installed it in a PC and worked fine.

In a server since I am not used with R, I am not sure what do I need to 
change so genetics pkg can see some package dependencies:
Any suggestion is appreciated, Aldi

Note:
genetics expects gregmisc and mvtnorm to be installed already. gregmisc 
creates gdata etc dependencies.
So here is what I have done:
Retrieved the base R and installed and compiled it with make under :
/users/genetics/aldi/r/R/R-2.0.0

Under it directories:
/mvtnorm
/gregmisc
/genetics
are created.
Installed mvtnorm and gregmisc with no problem, but genetics is not 
recognizing the location of /gregmisc/gdata

The command I am using to install genetics package is the following:
../bin/R CMD ../bin/INSTALL genetics_1.1.0.tar.gz
Here is the problem:
[EMAIL PROTECTED]:/users/genetics/aldi/r/R-2.0.0/genetics% ../bin/R CMD 
../bin/INSTALL -l . genetics_1.1.0.tar.gz

* Installing *source* package 'genetics' ...
** R
** data
** inst
** preparing package for lazy loading
Error in loadNamespace(i[[1]], c(lib.loc, .libPaths()), keep.source) :
   There is no package called 'gdata'
Execution halted
ERROR: lazy loading failed for package 'genetics'
[EMAIL PROTECTED]:/users/genetics/aldi/r/R-2.0.0/genetics%
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R-2.0.0 and tcltk package

2004-10-09 Thread Dirk Eddelbuettel
On Sat, Oct 09, 2004 at 12:36:51PM -0400, Jean Eid wrote:
 there does not seem to be a package tcltk on CRAN for 2.0.0.
 I have successfully installed the same package for 1.9.1.
 
 In essence I require the package for a GUI interface to setwd.
 All work fine with 1.9.1.
 
 This is on a Linux Debian unstable kernel 2.4.20

If you were using the pre-built Debian package, you'd have the tcltk package:

[EMAIL PROTECTED]:~ dpkg -L r-base-core | grep tcltk/ | wc -l
48
[EMAIL PROTECTED]:~ dpkg -L r-base-core | grep tcltk/ | head
/usr/lib/R/library/tcltk/R
/usr/lib/R/library/tcltk/R/tcltk
/usr/lib/R/library/tcltk/R/tcltk.rdb
/usr/lib/R/library/tcltk/R/tcltk.rdx
/usr/lib/R/library/tcltk/NAMESPACE
/usr/lib/R/library/tcltk/DESCRIPTION
/usr/lib/R/library/tcltk/Meta
/usr/lib/R/library/tcltk/Meta/package.rds
/usr/lib/R/library/tcltk/Meta/nsInfo.rds
/usr/lib/R/library/tcltk/Meta/Rd.rds

As you seem to prefer to roll your own (which you could also base on the
Debian package sources which enforce build-time dependencies so that these
things work), I highly recommend to fetch the output of the build process
(e.g. via script(1)) so that you can go back and check what configure told
you -- for it will have almost surely have told you if and when it missed
headers or libraries for tcl/tk. 

Hope this helps, regards, Dirk

-- 
Those are my principles, and if you don't like them... well, I have others.
-- Groucho Marx

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