Re: [R] Can't there be a cd command?

2006-05-10 Thread Peter Dalgaard
Issac Trotts [EMAIL PROTECTED] writes:

 I'm on Linux, so it didn't occur to me to look in the Windows FAQ
 until it came up in the Google search.  Why should Windows users be
 the only ones who learn how to change directories?

Well, on Linux et al., the normal mode of operation is to start R from
the commmand line in the directory where you want to be. On Windows
you start from a desktop icon or a menu entry, which implies that
you're always in the same directory, and usually the wrong one.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


Re: [R] microsoft proxy R project

2006-05-10 Thread Laurent_Valdes
Thanks a lot, you are nice.

Laurent.

-Original Message-
From: Nolwenn LeMeur [mailto:[EMAIL PROTECTED] 
Sent: lundi 8 mai 2006 08:16
To: Laurent Valdes
Cc: r-help@stat.math.ethz.ch; Remy Drouilhet; Valdes, Laurent; [EMAIL PROTECTED]
Subject: Re: [R] microsoft proxy  R project

Hi Laurent,

You should look the R windows FAQ web page:

(a) Use the alternative |internet2.dll| by starting R with the flag 
--internet2 (see How do I install R for Windows? 
http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-install-R-for-Windows_003f)
 
which uses the Internet Explorer internals (and so needs Internet 
Explorer 4 or later installed). Note that this does not work with 
proxies that need authentication.

(b) A proxy needs to be set up: see |?download.file|. Here are two 
versions of an example (a real one, but from a machine that is only 
available locally) of a command-line in a short cut:

 path_to_R\bin\RGui.exe http_proxy=http://user:[EMAIL PROTECTED]:80/
 
 path_to_R\bin\RGui.exe http_proxy=http://gannet/ http_proxy_user=ask

The second version will prompt the user for the proxy username and 
password when HTTP downloads are first used.


Nolwenn

Laurent Valdes wrote:

hi,

as I'm using R at Dell (where I am working), I manage to install packages
from web, but there is a web proxy, which is pretty boring.
R asks me to enter an active directory login/password, that would
normally auth me through the web proxy, but it doesn't work.

I'm looking forward for your help. Sorry if I used bad english.

Any ideas ?

Laurent

--
«Un peu d'internationalisme éloigne de la patrie; beaucoup y ramène»
Jean Jaurès@http://www.le-valdo.com

   [[alternative HTML version deleted]]

  



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


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


[R] warning messages ?

2006-05-10 Thread orkun
hello

I received these warning messages while I was building
logistic regression model.

Could you tell me why  this warnings arises ?

regards

Warning messages:
1: algorithm did not converge in: glm.fit(x = X, y = Y, weights = 
weights, start = start, etastart = etastart,
2: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x = X, y 
= Y, weights = weights, start = start, etastart = etastart,

-- 
Ahmet Temiz
Jeoloji Müh.
Afet İşleri Genel Müdürlüğü
Deprem Araştırma Dairesi
Tel: (312) 287 89 51 veya (312) 287 26 80/1547
Faks: (312) 287 89 51
E. Posta: [EMAIL PROTECTED]
 www.deprem.gov.tr

Ahmet Temiz
Geological Eng.
General Directorate of Disaster Affairs
Earthquake Research Department
Phone: +90 (312) 287 89 51 or (312) 287 26 80/1547
Fax: +90 (312) 287 89 51
E. Mail: [EMAIL PROTECTED]
www.deprem.gov.tr


-- 
This message has been scanned for viruses and\ dangerous con...{{dropped}}

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Prof Brian Ripley
On Wed, 10 May 2006, Peter Dalgaard wrote:

 Issac Trotts [EMAIL PROTECTED] writes:

 I'm on Linux, so it didn't occur to me to look in the Windows FAQ
 until it came up in the Google search.  Why should Windows users be
 the only ones who learn how to change directories?

 Well, on Linux et al., the normal mode of operation is to start R from
 the commmand line in the directory where you want to be. On Windows
 you start from a desktop icon or a menu entry, which implies that
 you're always in the same directory, and usually the wrong one.

Exactly.  I don't think I have ever used setwd() on Linux.

Also, I have never seen this asked before for a Unix-alike, so it seems 
not to be a FAQ.  There is a common tendency for users who run into a 
problem to think everyone does too, and it isn't necessarily so.
Frequently asked questions do make it to the FAQs: it is a defence 
mechanism for the volunteers supporting R.

help.search(directory)  gets you there.

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

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


Re: [R] new package error message

2006-05-10 Thread Prof Brian Ripley
On Tue, 9 May 2006, Jason Liao wrote:

 My coauthor made a new R package GeneLogit (100% R code) which installs
 ok on R 2.3 on Windows. But when I type

 library(GeneLogit)

 it gave the error message

 Error in library(GeneLogit) : 'GeneLogit' is not a valid package --
 installed  2.0.0?

 It runs on R 1.9.0 just fine. It seems that others have encountered
 same problem but no solution is found by googling

In every case I have ever seen mentioned, the solution was to install the 
package properly by R CMD INSTALL and not by a manual kludge.

The message is given if the installation lacks the metadata in the Meta 
subdirectory which INSTALL creates.

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

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


Re: [R] Full or non constrained/reparametrized model.matrix

2006-05-10 Thread Gregor Gorjanc

Gabor thanks! Last suggestion works like charm!

Gabor Grothendieck wrote:
 On 5/9/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 
 On 5/9/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
  Hello!
 
  Thank you very much for the response. Please read within the lines
 
  Gabor Grothendieck wrote:
   On 5/9/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
  
   Hello!
  
   I have parameter estimates for a generalized linear model and
 would like
   to produce fitted values i.e. fitted(). This can be easily done
 in R,
   but my problem lies in fact that I have a vector of parameters
 from some
   other software, that is is not constrained i.e. I have the following
   estimates for model with one factor with 4 levels
  
   beta = c(intercept group1 group2 group3 group4)
  
   where group1:4 are estimated deviations from intercept i.e. sum
 to zero
   contraint, but all parameter estimates are there! How can I create a
   model matrix that will not contain any constraints since I would
 like to
   compute
  
   model.matrix(some_formula) %*% beta
  
   I.e. I would like to have model.matrix of the form
  
   1 1 0 0 0
   1 0 1 0 0
   1 0 0 1 0
   1 0 0 0 1
  
   and not of the following form with contr.treatment or any other
   contraints
  
   1 0 0 0
   1 1 0 0
   1 0 1 0
   1 0 0 1
  
   I could remove group4 from beta and use sum to zero contraint for
   contrast in fomula, but I would like to overcome this, as my
 model can
   be richer in number or parameters. The following example, will
 show what
   I would like to do:
  
   ## --- Setup ---
  
   groupN - 4
   NPerGroup - 5
   min - 1
   max - 5
   g - runif(n = groupN, min = min, max = max)
  
   ## --- Simulate ---
  
   group - factor(rep(paste(G, 1:groupN, sep = ), each =
 NPerGroup))
   y - vector(mode = numeric, length = groupN * NPerGroup)
   j - 1
   for (i in 1:groupN) {
y[j:(i * NPerGroup)] - rpois(n = NPerGroup, lambda = g[i])
j - (i * NPerGroup) + 1
   }
  
   ## --- GLM ---
  
   contrasts(group) - contr.sum(groupN)
   fit - glm(y ~ group, family = poisson)
   coef(fit)
  
   ## Now this goes nicely
   model.matrix(y ~ group) %*% coef(fit)
  
   ## But pretend I have the following vector of estimated parameters
   beta - c(coef(fit), 0 - sum(coef(fit)[-1]))
   names(beta) - c(names(beta)[1:4], group4)
  
   ## I can not apply this as model matrix does not conform to beta
   model.matrix(y ~ group) %*% beta
  
  
   Try this:
  
   model.matrix(y ~ group-1) %*% beta[-1] + beta[1]
 
  This is a nice hack here, but does not work in general. Say I have
  another factor
 
  sex - factor(rep(paste(S, 1:2, sep = ), times=10))
 
  model.matrix(y ~ group + sex - 1)
 
  produces a matrix of 5 columns and not 6 as I want to.

 Try this:

 cbind(1, model.matrix(~group-1), model.matrix(~sex-1))

 
 In thinking about this a bit more, try this:
 
 attr(group, contrasts) - diag(nlevels(group))
 attr(sex, contrasts) - diag(nlevels(sex))
 model.matrix(~ group + sex)


-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Unix X-WIndows RGUI

2006-05-10 Thread Prof Brian Ripley
On Tue, 9 May 2006, Alex Restrepo wrote:

 Could someone tell me if there is an X-Windows version of the RGUI ?

There is not.  An one point there was a Motif version (graphapp, the 
toolkit used for RGui, used to have a Motif version), but it was 
incomplete (and unmaintainable).

There are several other consoles for R which work under X Windows.
Package gnomeGUI is one that used to be bundled in R, and for others see
http://www.sciviews.org/_rgui/.  [JGR is the one that is most frequently 
mentioned (but you will need working Java, which precludes my current 
x86_64 Linux platform).]

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

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


[R] How to use function to change density in sm.density?

2006-05-10 Thread Torleif Markussen Lunde
I have trawl data (fish) for different areas. In each catch length of the
different fish is registerd. However the real catch has to be calibrated
because the trawl is selective.

For fish=15cm the adjusted catch is (old.frequency*35/19)
for fish15cm and 62cm the adjusted catch is (old.frequency*35/(
5.91*frequency^0.43)
and for fish=62cm the catch need no adjustment.

Basically what I need is to know how to write an expression i R that says
something like

if (fishlength=15) new.dens-old.density*35/19
if (fishlength15fishlength62) update the new.dens with old.dens*35/(
5.91*density^0.43)
else old.density=old.density (this should also be updated in new.dens)

After these steps I wold like to draw the new adjusted densityline.

Any suggestions are welcome.

Best regards
T M Lunde

[[alternative HTML version deleted]]

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Issac Trotts
On 5/9/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Wed, 10 May 2006, Peter Dalgaard wrote:

  Issac Trotts [EMAIL PROTECTED] writes:
 
  I'm on Linux, so it didn't occur to me to look in the Windows FAQ
  until it came up in the Google search.  Why should Windows users be
  the only ones who learn how to change directories?
 
  Well, on Linux et al., the normal mode of operation is to start R from
  the commmand line in the directory where you want to be. On Windows
  you start from a desktop icon or a menu entry, which implies that
  you're always in the same directory, and usually the wrong one.

 Exactly.  I don't think I have ever used setwd() on Linux.

 Also, I have never seen this asked before for a Unix-alike, so it seems
 not to be a FAQ.  There is a common tendency for users who run into a
 problem to think everyone does too, and it isn't necessarily so.

 Frequently asked questions do make it to the FAQs: it is a defence
 mechanism for the volunteers supporting R.

 help.search(directory)  gets you there.

OK, good to know.  Thanks for helping.

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


[R] Until the key pressed: FOR-LOOP-Clustering

2006-05-10 Thread j.joshua thomas
Hi All,

These are the code that i used to plot the kmeans clustering.

 DataSetS01022-rbind(matrix(rnorm(50),ncol=2),
+ matrix(rnorm(50),ncol=2))
 colnames(DataSetS01022) -c(timeslot,em)
 (cl -kmeans(DataSetS01022,2))
plot (DataSetS01022, col=cl$cluster)
 points(cl$centers, col = 1:2, pch = 8, cex=2)

Now, i would like to do *the same process for 5 times*, so that i can view
the clusters in data
have been moving and the center changes with various results.
(Animation-like)

My main concern here, is how to put this in a *loop form* or any other
methods are available?

I tried with:* clarax$clusinfo I thought of doing it to activate Device (1)
 (2)*
**
*Really need anyones help!*
**
*JJ*
*---*



--
Lecturer J. Joshua Thomas
KDU College Penang Campus
Research Student,
University Sains Malaysia

[[alternative HTML version deleted]]

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


Re: [R] remove Punctuation characters

2006-05-10 Thread Filipe Almeida
Thanks a lot!!

Filipe Almeida

Marc Schwartz (via MN) wrote:
 On Tue, 2006-05-09 at 16:50 +0100, Filipe Almeida wrote:
   
 Hi,

 I want to remove all punctuation characters in a string. I was trying it use
 a regular expressions but it doesn't work.
 Here is a sample os what i want:

 str - 'ABD - remove de punct, and dot characters.'
 str - gsub('[:punct:]','',str)
 str
 'ABD remove de punct and dot characters

 is there any function that do this kind of thing?

 Thanks to all.

 Filipe Almeida
 

 You almost have it.  Just need to double the brackets:

   
 str
 
 [1] ABD - remove de punct, and dot characters.

   
 gsub([[:punct:]], , str)
 
 [1] ABD  remove de punct and dot characters


 Note the following in ?regex:

 For example, [[:alnum:]] means [0-9A-Za-z], except the latter depends
 upon the locale and the character encoding, whereas the former is
 independent of locale and character set. (Note that the brackets in
 these class names are part of the symbolic names, and must be included
 in addition to the brackets delimiting the bracket list.) Most
 metacharacters lose their special meaning inside lists. To include a
 literal ], place it first in the list. Similarly, to include a literal
 ^, place it anywhere but first. Finally, to include a literal -, place
 it first or last. (Only these and \ remain special inside character
 classes.)

 HTH,

 Marc Schwartz





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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Joerg van den Hoff
Issac Trotts wrote:
 On 5/9/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Wed, 10 May 2006, Peter Dalgaard wrote:

 Issac Trotts [EMAIL PROTECTED] writes:

 I'm on Linux, so it didn't occur to me to look in the Windows FAQ
 until it came up in the Google search.  Why should Windows users be
 the only ones who learn how to change directories?
 Well, on Linux et al., the normal mode of operation is to start R from
 the commmand line in the directory where you want to be. On Windows
 you start from a desktop icon or a menu entry, which implies that
 you're always in the same directory, and usually the wrong one.
 Exactly.  I don't think I have ever used setwd() on Linux.

 Also, I have never seen this asked before for a Unix-alike, so it seems
 not to be a FAQ.  There is a common tendency for users who run into a
 problem to think everyone does too, and it isn't necessarily so.

 Frequently asked questions do make it to the FAQs: it is a defence
 mechanism for the volunteers supporting R.

 help.search(directory)  gets you there.
 
 OK, good to know.  Thanks for helping.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


probably this has used up sufficient disk space in the mail archive
already, but anyway a bit of support  to the initial request: one of the
very first things I did, when I started using R, was adding

cd - setwd
pwd - getwd

to my .Rprofile. and when I encouraged colleagues to try R out, the 'top
three' questions where

how can I get out? I tried ^C, exit(), quit(), but nothing works
how can I change the directory? `cd' does'nt work
where am I? `pwd' does'nt work (`pwd' is something like a 'local
speciality', I presume...)

this is of course a marginal obstacle for new users, but avoidable all
the same. (and maybe most people (like myself) in the first place don't
think it important enough to post it -- maybe it _would_ be in the FAQ
otherwise...)

so, _if_ 'cd' would be recognized in future releases, it would'nt do any
harm, would it?


joerg

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


[R] subselect in a matrix

2006-05-10 Thread orkun
hello

I confused one point

in matrix constructed with cbind
I want to subselect 6. column  1000

what should the syntax be ?

regards

-- 
Ahmet Temiz
Jeoloji Müh.
Afet İşleri Genel Müdürlüğü
Deprem Araştırma Dairesi
Tel: (312) 287 89 51 veya (312) 287 26 80/1547
Faks: (312) 287 89 51
E. Posta: [EMAIL PROTECTED]
 www.deprem.gov.tr

Ahmet Temiz
Geological Eng.
General Directorate of Disaster Affairs
Earthquake Research Department
Phone: +90 (312) 287 89 51 or (312) 287 26 80/1547
Fax: +90 (312) 287 89 51
E. Mail: [EMAIL PROTECTED]
www.deprem.gov.tr


-- 
This message has been scanned for viruses and\ dangerous con...{{dropped}}

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


Re: [R] subselect in a matrix

2006-05-10 Thread Peter Dalgaard
orkun [EMAIL PROTECTED] writes:

 hello
 
 I confused one point
 
 in matrix constructed with cbind
 I want to subselect 6. column  1000
 
 what should the syntax be ?

m[m[, 6]  1000, ] if I understand your question correctly.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


Re: [R] draw a graphic using segments to represent data

2006-05-10 Thread Uwe Ligges
Wang, Xuetao wrote:

 Hello,
 
  
 
 I'd like to draw a graphic using different color line segments to
 represent microarray data.  It simply likes this:
 
 Data=cbind(c(1, 2, -1, 3,  -2.2), c(1, 3, -1, -1.8, 4))
 
 The first col No represents y'axis position (negative down and positive
 up). The second col No represents a length of segment (negative segment
 should be on left of y, and positive on right). Also the segment color
 on I, II, III, IV should be different.
 


Something like


  myplot - function(x, y, segcol=1:4, col, ...){
plot(x, y, type=n, ...)
abline(h=0, v=0, col=grey, ...)
if(missing(col))
col - segcol[1 + (x  0) + 2 * (y  0)]
segments(x, y, 0, y, col = col, ...)
  }

  myplot(Data[,1], Data[,2])

springs to mind.




 
 Thank you for your time and help.
 
  
 
 Xueato
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] transposing a big data file

2006-05-10 Thread Uwe Ligges
yohannes alazar wrote:

 I HAVE A VERY BIG DATA OF 67 COLMS AND 25000 ROWS
 AND WOULD LIKE TO TRANSPOSE IT THE R HELP WAS NOT ENOUGH INFORMATION
 BECOUSE I AM NOT A PROGRAMMER AND FIRST TIME R USER.
 SO CAN YOU GIVE SOME HINTS OF CODING,

You might want to fix your Caps Lock key ...


 
AA TT GG GG CC AA TT GG GG CC AA TT GG GG CC AA TT GG GG CC AA TT GG GG
 CC


Looks like 1x25


 TO
 
AA AA AA AA AA TT TT TT TT TT GG GG GG GG GG GG GG GG GG GG CC CC CC CC
 CC

1x25 ...


Do you really want to transpose or to rearrange in some other manner?
Transposing is done by t() as help.search(transpose) turns out

Uwe Ligges



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

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


[R] R and Java

2006-05-10 Thread miniar mansouri
hello,
I want to call R from java. I know that i must install SJava .so ,what tools  i 
need and how i  install  
 
hwo help me ?
[[alternative HTML version deleted]]

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


Re: [R] R and Java

2006-05-10 Thread Prof Brian Ripley
You keep on asking questions on this topic lacking basic information.
Please consult the posting guide:

1) Do not send HTML mail.
2) Do tell us your OS and platform.
3) Do ask the maintainer about contributed packages.

There are alternatives to SJava, for example Rserve and JRI at 
http://www.rosuda.org/software/ (and see the R FAQ).

On Wed, 10 May 2006, miniar mansouri wrote:

 hello,
 I want to call R from java. I know that i must install SJava .so ,what tools  
 i need and how i  install

 hwo help me ?
   [[alternative HTML version deleted]]

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


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

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


Re: [R] transposing a big data file

2006-05-10 Thread Xiaohua Dai
I think that's a 5 X 5 matrix. However, it is very difficult to read
words in Caps.

On 5/10/06, Uwe Ligges [EMAIL PROTECTED] wrote:
 yohannes alazar wrote:

  I HAVE A VERY BIG DATA OF 67 COLMS AND 25000 ROWS
  AND WOULD LIKE TO TRANSPOSE IT THE R HELP WAS NOT ENOUGH INFORMATION
  BECOUSE I AM NOT A PROGRAMMER AND FIRST TIME R USER.
  SO CAN YOU GIVE SOME HINTS OF CODING,

 You might want to fix your Caps Lock key ...


 
 AA TT GG GG CC AA TT GG GG CC AA TT GG GG CC AA TT GG GG CC AA TT GG GG
  CC


 Looks like 1x25


  TO
 
 AA AA AA AA AA TT TT TT TT TT GG GG GG GG GG GG GG GG GG GG CC CC CC CC
  CC

 1x25 ...


 Do you really want to transpose or to rearrange in some other manner?
 Transposing is done by t() as help.search(transpose) turns out

 Uwe Ligges



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

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


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


Re: [R] draw a graphic using segments to represent data

2006-05-10 Thread Camarda, Carlo Giovanni
Hi,
I am not sure whether I completely understood your question. Anyway,
here it's a simple code that, hopefully, overcome your problem.

Data=cbind(c(1, 2, -1, 3,  -2.2), c(1, 3, -1, -1.8, 4))
plot(x=rep(0,nrow(Data)), Data[,1], axes=F, xlim=c(-max(Data[,2]),
max(Data[,2])), xlab=, col=1:nrow(Data), cex=2)
axis(2)
for(i in 1:nrow(Data)){
segments(x0=0, y0=Data[i,1], x1=Data[i,1] + Data[i,2], y1=Data[i,1],
col=i)
}

Best,
Carlo Giovani Camarda

===
Camarda Carlo Giovanni
PhD-Student
Max Planck Institute for Demographic Research
Konrad-Zuse-Strasse 1
18057 Rostock, Germany
Tel:  +49 (0)381 2081 172
Fax: +49 (0)381 2081 472
[EMAIL PROTECTED]
===




Date: Tue, 9 May 2006 15:10:37 -0400
From: Wang, Xuetao [EMAIL PROTECTED]
Subject: [R] draw a graphic using segments to  represent data
To: r-help@stat.math.ethz.ch
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain

Hello,

 

I'd like to draw a graphic using different color line segments to
represent microarray data.  It simply likes this:

Data=cbind(c(1, 2, -1, 3,  -2.2), c(1, 3, -1, -1.8, 4))

The first col No represents y'axis position (negative down and positive
up). The second col No represents a length of segment (negative segment
should be on left of y, and positive on right). Also the segment color
on I, II, III, IV should be different.

 

Thank you for your time and help.

 

Xueato


--
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

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


[R] identify high dimension data point

2006-05-10 Thread Tong Wang
Hi there, 
I am having some trouble with the Identify() function,  it looks that 
the identify() function only works on the plot of 2-dimension data set.  In 
high-dimension case , if I use pairs() + identify() in hope to observe all the 
components of the data point I selected, I get error message.  Is there anyway 
to get around this ? Plus,  I also need it to actually compare all the 
components of the picked data point with mydataset to choose the closest one. 
Thanks million in advance. 

best

tong

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


[R] kernel smoothing of disease rates at locations

2006-05-10 Thread Oarabile Molaodi
I want to do kernel smoothing on the standardised mortality rates at 
specified location(x-y coordinates) and be able to produce contour map. 
I've tried to use the package called fields in R (function smooth.2d) 
but the problem is I get negative results after smoothing and I do not 
understand why? Your contributions will be highly appreciated or if 
there is any package that can do this I will be happy to know about it.  
Thanks in advance for your comments.
Oarabile

Below is how my data in R looks like
  XcoordYcoord   smr
1  383894.70  653202.8 1.5816327
2  339053.00  631770.9 1.0003473
3  369164.50  609973.2 1.2943872
4  313477.70  640382.8 0.9443508
5  290748.80  695088.8 1.1662125
6  287547.50  679829.6 0.9433962
7  259031.90  704478.3 1.0184905
8  329107.60  585753.3 1.0445860
9  292170.20  578978.2 1.1287758
10 268330.90  564281.7 0.9805996
11 227395.50  561524.6 1.1947431
12 310130.70  689395.0 1.0991957
13 325756.00  696565.6 1.1734694
14 339427.20  713217.2 0.8724100
15 391752.10  805661.5 1.2483221
16 385935.90  851044.5 1.0558140
17 372471.20  826373.7 1.4220183
18 354901.70  791107.2 0.9175084
19 324944.10  842040.8 1.0447080
20 275672.50  802570.4 0.9899329
21 320750.00  954769.7 1.0866834
22 243489.20  832748.8 1.0995658
23 166559.70  786365.3 1.0401267
24 288160.80  846054.4 1.0299003
25 220347.00  869181.0 0.9529435
26 175863.63  822593.9 0.9902252
27 246114.40  938419.3 0.8909370
28 359070.60  669738.3 0.9883721
29 320614.70  670434.2 1.1288534
30 331414.80  659972.3 0.9070866
31 299336.90  666122.9 0.7969349
32 156965.25  708047.7 1.1410460
33 253867.30  674916.5 0.9256710
34 249188.40  674272.8 1.0869565
35 272463.00  679495.3 0.8576698
36 252643.80  611378.4 0.8615611
37 212637.35  643725.0 0.8596604
38 234751.95  691803.4 0.9706546
39 264856.20  644684.8 0.8468395
40 253949.30  653042.5 0.8106169
41 260412.35  663552.2 0.9253686
42 270807.60  657454.0 0.9002826
43 228477.30  670443.2 1.0782502
44 248215.30  641897.3 0.9240407
45 229797.50  596059.0 1.1579197
46 291725.00  635771.8 0.8908766
47 278012.80  667982.0 1.024
48 279490.80  659761.6 0.9828301
49 242791.70  662651.8 1.0230584
50 263217.20  675295.2 0.9759817
51 341138.80  754471.3 0.9505541
52 334963.00  735075.4 0.9264498
53 286139.70  733611.6 0.9052453
54 354015.60 1025696.8 0.8905506
55 455775.60 1201636.0 1.0862620
56  88429.32  854994.4 0.9577015

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


[R] using crr in cmprsk

2006-05-10 Thread Rasanga Ruwanthi
Hi,
 
I need to fit model using crr, however my covariate is
categorical with 3 levels. I use 
crr(time,status,agesplit,failcode=1,cencode=0) where
agesplit is defined as 20,21-29,30 years, so it
takes 0, 1 or 2 for each patient. I hoped to get
estimated coefficients for the levels 1 and 2 w.r.t
level 0 as in coxph. But, I didn't. Could someone
please help me to use crr in this situation?

Thanks a lot.
Ruwanthi

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


Re: [R] kernel smoothing of disease rates at locations

2006-05-10 Thread Roger D. Peng
It is certainly possible to get negative values when smoothing, especially on 
the edges.  But we cannot reproduce your problem because you did not provide 
any 
code.

-roger

Oarabile Molaodi wrote:
 I want to do kernel smoothing on the standardised mortality rates at 
 specified location(x-y coordinates) and be able to produce contour map. 
 I've tried to use the package called fields in R (function smooth.2d) 
 but the problem is I get negative results after smoothing and I do not 
 understand why? Your contributions will be highly appreciated or if 
 there is any package that can do this I will be happy to know about it.  
 Thanks in advance for your comments.
 Oarabile
 
 Below is how my data in R looks like
   XcoordYcoord   smr
 1  383894.70  653202.8 1.5816327
 2  339053.00  631770.9 1.0003473
 3  369164.50  609973.2 1.2943872
 4  313477.70  640382.8 0.9443508
 5  290748.80  695088.8 1.1662125
 6  287547.50  679829.6 0.9433962
 7  259031.90  704478.3 1.0184905
 8  329107.60  585753.3 1.0445860
 9  292170.20  578978.2 1.1287758
 10 268330.90  564281.7 0.9805996
 11 227395.50  561524.6 1.1947431
 12 310130.70  689395.0 1.0991957
 13 325756.00  696565.6 1.1734694
 14 339427.20  713217.2 0.8724100
 15 391752.10  805661.5 1.2483221
 16 385935.90  851044.5 1.0558140
 17 372471.20  826373.7 1.4220183
 18 354901.70  791107.2 0.9175084
 19 324944.10  842040.8 1.0447080
 20 275672.50  802570.4 0.9899329
 21 320750.00  954769.7 1.0866834
 22 243489.20  832748.8 1.0995658
 23 166559.70  786365.3 1.0401267
 24 288160.80  846054.4 1.0299003
 25 220347.00  869181.0 0.9529435
 26 175863.63  822593.9 0.9902252
 27 246114.40  938419.3 0.8909370
 28 359070.60  669738.3 0.9883721
 29 320614.70  670434.2 1.1288534
 30 331414.80  659972.3 0.9070866
 31 299336.90  666122.9 0.7969349
 32 156965.25  708047.7 1.1410460
 33 253867.30  674916.5 0.9256710
 34 249188.40  674272.8 1.0869565
 35 272463.00  679495.3 0.8576698
 36 252643.80  611378.4 0.8615611
 37 212637.35  643725.0 0.8596604
 38 234751.95  691803.4 0.9706546
 39 264856.20  644684.8 0.8468395
 40 253949.30  653042.5 0.8106169
 41 260412.35  663552.2 0.9253686
 42 270807.60  657454.0 0.9002826
 43 228477.30  670443.2 1.0782502
 44 248215.30  641897.3 0.9240407
 45 229797.50  596059.0 1.1579197
 46 291725.00  635771.8 0.8908766
 47 278012.80  667982.0 1.024
 48 279490.80  659761.6 0.9828301
 49 242791.70  662651.8 1.0230584
 50 263217.20  675295.2 0.9759817
 51 341138.80  754471.3 0.9505541
 52 334963.00  735075.4 0.9264498
 53 286139.70  733611.6 0.9052453
 54 354015.60 1025696.8 0.8905506
 55 455775.60 1201636.0 1.0862620
 56  88429.32  854994.4 0.9577015
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


[R] Increase the number of plotting characters in dotplot (lattice)?

2006-05-10 Thread Fredrik Karlsson
Dear list,

I am using the dotplot function of lattice and like it very much.
However, in some of the plots, I have more than 7 categories that I
would like to represent by different plotting characters in the graph,
which is  a problem. For the categories after the 7th, the plotting
characters are recycled, creating a confisuing graph indeed.

So, my question is: how do I increase the number of unique plotting characters?

/Fredrik

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


Re: [R] Increase the number of plotting characters in dotplot (lattice)?

2006-05-10 Thread Chuck Cleland
library(lattice)

show.settings()

trellis.par.set(superpose.symbol = list(pch = 1:16), dot.symbol = 
list(pch = 1:16))

show.settings()

?trellis.par.get

Fredrik Karlsson wrote:
 Dear list,
 
 I am using the dotplot function of lattice and like it very much.
 However, in some of the plots, I have more than 7 categories that I
 would like to represent by different plotting characters in the graph,
 which is  a problem. For the categories after the 7th, the plotting
 characters are recycled, creating a confisuing graph indeed.
 
 So, my question is: how do I increase the number of unique plotting 
 characters?
 
 /Fredrik
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


Re: [R] kernel smoothing of disease rates at locations

2006-05-10 Thread Prof Brian Ripley
On Wed, 10 May 2006, Roger D. Peng wrote:

 It is certainly possible to get negative values when smoothing, especially on
 the edges.  But we cannot reproduce your problem because you did not provide 
 any
 code.

But kernel smoothing always reduces the range of the data, so kernel 
smoothing of non-negative data cannot give a negative estimate.  Roger's 
comments apply to other smoothers, e.g. local polynomials.

We do need to see reproducible code (and also the posting guide advises 
contacting the package maintainer about problems with contributed 
packages).


 -roger

 Oarabile Molaodi wrote:
 I want to do kernel smoothing on the standardised mortality rates at
 specified location(x-y coordinates) and be able to produce contour map.
 I've tried to use the package called fields in R (function smooth.2d)
 but the problem is I get negative results after smoothing and I do not
 understand why? Your contributions will be highly appreciated or if
 there is any package that can do this I will be happy to know about it.
 Thanks in advance for your comments.
 Oarabile

 Below is how my data in R looks like
   XcoordYcoord   smr
 1  383894.70  653202.8 1.5816327
 2  339053.00  631770.9 1.0003473
 3  369164.50  609973.2 1.2943872
 4  313477.70  640382.8 0.9443508
 5  290748.80  695088.8 1.1662125
 6  287547.50  679829.6 0.9433962
 7  259031.90  704478.3 1.0184905
 8  329107.60  585753.3 1.0445860
 9  292170.20  578978.2 1.1287758
 10 268330.90  564281.7 0.9805996
 11 227395.50  561524.6 1.1947431
 12 310130.70  689395.0 1.0991957
 13 325756.00  696565.6 1.1734694
 14 339427.20  713217.2 0.8724100
 15 391752.10  805661.5 1.2483221
 16 385935.90  851044.5 1.0558140
 17 372471.20  826373.7 1.4220183
 18 354901.70  791107.2 0.9175084
 19 324944.10  842040.8 1.0447080
 20 275672.50  802570.4 0.9899329
 21 320750.00  954769.7 1.0866834
 22 243489.20  832748.8 1.0995658
 23 166559.70  786365.3 1.0401267
 24 288160.80  846054.4 1.0299003
 25 220347.00  869181.0 0.9529435
 26 175863.63  822593.9 0.9902252
 27 246114.40  938419.3 0.8909370
 28 359070.60  669738.3 0.9883721
 29 320614.70  670434.2 1.1288534
 30 331414.80  659972.3 0.9070866
 31 299336.90  666122.9 0.7969349
 32 156965.25  708047.7 1.1410460
 33 253867.30  674916.5 0.9256710
 34 249188.40  674272.8 1.0869565
 35 272463.00  679495.3 0.8576698
 36 252643.80  611378.4 0.8615611
 37 212637.35  643725.0 0.8596604
 38 234751.95  691803.4 0.9706546
 39 264856.20  644684.8 0.8468395
 40 253949.30  653042.5 0.8106169
 41 260412.35  663552.2 0.9253686
 42 270807.60  657454.0 0.9002826
 43 228477.30  670443.2 1.0782502
 44 248215.30  641897.3 0.9240407
 45 229797.50  596059.0 1.1579197
 46 291725.00  635771.8 0.8908766
 47 278012.80  667982.0 1.024
 48 279490.80  659761.6 0.9828301
 49 242791.70  662651.8 1.0230584
 50 263217.20  675295.2 0.9759817
 51 341138.80  754471.3 0.9505541
 52 334963.00  735075.4 0.9264498
 53 286139.70  733611.6 0.9052453
 54 354015.60 1025696.8 0.8905506
 55 455775.60 1201636.0 1.0862620
 56  88429.32  854994.4 0.9577015

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

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


Re: [R] identify high dimension data point [Broadcast]

2006-05-10 Thread Liaw, Andy
You might want to give Ggobi a try (www.ggobi.org).  There's a rggobi
package that lets you run Ggobi on data in R, or control Ggobi from within
R.

Andy 

From: Tong Wang
 
 Hi there, 
 I am having some trouble with the Identify() 
 function,  it looks that the identify() function only works 
 on the plot of 2-dimension data set.  In high-dimension case 
 , if I use pairs() + identify() in hope to observe all the 
 components of the data point I selected, I get error message. 
  Is there anyway to get around this ? Plus,  I also need it 
 to actually compare all the components of the picked data 
 point with mydataset to choose the closest one. 
 Thanks million in advance. 
 
 best
 
 tong
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Barry Rowlingson

 so, _if_ 'cd' would be recognized in future releases, it would'nt do any
 harm, would it?

   ls()
[1] some   things   here
   cd(foo)
   ls()
[1] some   things   here

Cue shout of: Hey, it didnt work!

ls() is not to /bin/ls what setwd() is to 'cd'.

Gets -1 from me. setwd() makes it clear[er] its a working directory on 
the file system and nothing to do with R's objects.

Barry

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Paul Johnson
It is a FAQ in our Linux lab.  People start emacs and fire up R via
ess, and then they have no idea 'where they are.  For computer
experts, it is not a problem, but for people who don't know much about
computers, it is a pretty big problem.  They have data in some
subdirectory, but almost invariably they don't get emacs  R started
from that same place.

Unfortunately, for our users, it does not help to simply re-label
setwd as cd.  Both commands imply a deeper understanding of the OS
than they have.  Also, unfortunately, these are the same people who
don't understand that FAQs exist and should be consulted. These people
are so new/timid that asking in r-help would be the last thing to
cross their mind.

I've wondered if it would not help to have the R prompt include the
directory name, as in an x terminal.

pj

On 5/10/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:


 Exactly.  I don't think I have ever used setwd() on Linux.

 Also, I have never seen this asked before for a Unix-alike, so it seems
 not to be a FAQ.  There is a common tendency for users who run into a
 problem to think everyone does too, and it isn't necessarily so.
 Frequently asked questions do make it to the FAQs: it is a defence
 mechanism for the volunteers supporting R.

 help.search(directory)  gets you there.

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

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



--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

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


[R] problem rbind after lapply (difference between 2.2.1 and 2.3.0)

2006-05-10 Thread Gary Collins
Any help on the following would be appreciated...

 R.version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major2
minor2.1
year 2005
month12
day  20
svn rev  36812
 language R
 set.seed(2)
 x=matrix(ncol=4, nrow=10)
 for(i in 1:4) x[,i]=rnorm(10)
 x=as.data.frame(x)
 x$V1=c(rep(0,5), rep(1,5))
 x
   V1  V2   V3 V4
1   0  0.41765075  2.090819205  0.7389386
2   0  0.98175278 -1.199925820  0.3189604
3   0 -0.39269536  1.589638200  1.0761644
4   0 -1.03966898  1.954651642 -0.2841577
5   0  1.78222896  0.00493 -0.7766753
6   1 -2.31106908 -2.451706388 -0.5956605
7   1  0.87860458  0.477237303 -1.7259798
8   1  0.03580672 -0.596558169 -0.9025845
9   1  1.01282869  0.792203270 -0.5590619
10  1  0.43226515  0.289636710 -0.2465126

  do.call(rbind, lapply(split(x, x$V1), function(x) 
 data.frame(min=min(x$V2), max=max(x$V2
min  max
0 -1.039669 1.782229
1 -2.311069 1.012829

yet with the same call on version 2.3.0, I get the following error.

 do.call(rbind, lapply(split(x, x$V1), function(x) data.frame(min=min(x$V2), 
 max=max(x$V2
Error in data.frame(min = c(-1.039669, -2.311069), max = c(1.782229,  :
row names contain missing values

Any clues on what has changed between the two versions? and a fix to
get around this? The actual function (min, max) within the lapply is
just an example for illustration only, the issue is the rbinding of
results from an lapply call. I've had a look at the changes document
packaged with 2.3.0 and found nothing...so wondering whether it's a
bug or not?

Thanks in advance.

Gary

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


Re: [R] problem rbind after lapply (difference between 2.2.1 and 2.3.0)

2006-05-10 Thread Gabor Grothendieck
Update your R:

https://www.stat.math.ethz.ch/pipermail/r-devel/2006-May/037542.html


On 5/10/06, Gary Collins [EMAIL PROTECTED] wrote:
 Any help on the following would be appreciated...

  R.version
 _
 platform i386-pc-mingw32
 arch i386
 os   mingw32
 system   i386, mingw32
 status
 major2
 minor2.1
 year 2005
 month12
 day  20
 svn rev  36812
  language R
  set.seed(2)
  x=matrix(ncol=4, nrow=10)
  for(i in 1:4) x[,i]=rnorm(10)
  x=as.data.frame(x)
  x$V1=c(rep(0,5), rep(1,5))
  x
   V1  V2   V3 V4
 1   0  0.41765075  2.090819205  0.7389386
 2   0  0.98175278 -1.199925820  0.3189604
 3   0 -0.39269536  1.589638200  1.0761644
 4   0 -1.03966898  1.954651642 -0.2841577
 5   0  1.78222896  0.00493 -0.7766753
 6   1 -2.31106908 -2.451706388 -0.5956605
 7   1  0.87860458  0.477237303 -1.7259798
 8   1  0.03580672 -0.596558169 -0.9025845
 9   1  1.01282869  0.792203270 -0.5590619
 10  1  0.43226515  0.289636710 -0.2465126

   do.call(rbind, lapply(split(x, x$V1), function(x) 
  data.frame(min=min(x$V2), max=max(x$V2
min  max
 0 -1.039669 1.782229
 1 -2.311069 1.012829

 yet with the same call on version 2.3.0, I get the following error.

  do.call(rbind, lapply(split(x, x$V1), function(x) 
  data.frame(min=min(x$V2), max=max(x$V2
 Error in data.frame(min = c(-1.039669, -2.311069), max = c(1.782229,  :
row names contain missing values

 Any clues on what has changed between the two versions? and a fix to
 get around this? The actual function (min, max) within the lapply is
 just an example for illustration only, the issue is the rbinding of
 results from an lapply call. I've had a look at the changes document
 packaged with 2.3.0 and found nothing...so wondering whether it's a
 bug or not?

 Thanks in advance.

 Gary

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


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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Liaw, Andy
From: Paul Johnson
 
 It is a FAQ in our Linux lab.  People start emacs and fire up 
 R via ess, and then they have no idea 'where they are.  For 
 computer experts, it is not a problem, but for people who 
 don't know much about computers, it is a pretty big problem.  
 They have data in some subdirectory, but almost invariably 
 they don't get emacs  R started from that same place.

ESS by default will prompt for start-up directory when starting 
R.  Perhaps that was turned off in the lab?

 
 Unfortunately, for our users, it does not help to simply 
 re-label setwd as cd.  Both commands imply a deeper 
 understanding of the OS than they have.  Also, unfortunately, 
 these are the same people who don't understand that FAQs 
 exist and should be consulted. These people are so new/timid 
 that asking in r-help would be the last thing to cross their mind.
 
 I've wondered if it would not help to have the R prompt 
 include the directory name, as in an x terminal.

Here's one possibility (on WinXP Pro):

 h - taskCallbackManager() 
 h$add(function(expr, value, ok, visible) { 
+ options(prompt=paste(getwd(), , sep=))
+ return(TRUE)}, name=pwdprompt) 
[1] pwdprompt
C:/home  setwd(projects)
C:/home/projects  

Andy

 
 pj
 
 On 5/10/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 
 
  Exactly.  I don't think I have ever used setwd() on Linux.
 
  Also, I have never seen this asked before for a Unix-alike, so it 
  seems not to be a FAQ.  There is a common tendency for 
 users who run 
  into a problem to think everyone does too, and it isn't 
 necessarily so.
  Frequently asked questions do make it to the FAQs: it is a defence 
  mechanism for the volunteers supporting R.
 
  help.search(directory)  gets you there.
 
  --
  Brian D. Ripley,  [EMAIL PROTECTED]
  Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
  University of Oxford, Tel:  +44 1865 272861 (self)
  1 South Parks Road, +44 1865 272866 (PA)
  Oxford OX1 3TG, UKFax:  +44 1865 272595
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 
 
 --
 Paul E. Johnson
 Professor, Political Science
 1541 Lilac Lane, Room 504
 University of Kansas
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


[R] ape comparative analysis query

2006-05-10 Thread Chris Knight
I've been comparing variables among objects (taxa) related by known
trees, using phylogentically independent contrasts in the ape package,
and want to move on to more complex models e.g. by using gls with
appropriate correlation terms. My trees contain lots of (hard)
polytomies and information about ancestors, which I've been including-
creating fully dichotomous trees by using zero branch lengths. For
instance:

library(ape)
tree-read.tree(text=((B1:3,(((D1:5,C1:0):5,B2:0):4,(B3:3,B4:4):0):0):0,A1:0):0;)
plot(tree)

Where all the B taxa arise in a true polytomy from A1 and B2 is the
ancestor of C1 which is the ancestor of D1

I have information on all the taxa and can create independent contrasts
for this:

x-c(B1=47,D1=43,C1=45,B2=50,B3=47,B4=48,A1=48)
y-c(B1=2.9,D1=5.4,C1=2.8,B2=3.5,B3=3.2,B4=3.5,A1=1.8)
picx-pic(x,phy=tree)
picy-pic(y,phy=tree)

Which seems to make sense. However, if I try to use anything more
sophisticated I run into problems:

dat-as.data.frame(cbind(x,y))
model1-gls(y~x,data=dat, correlation=corBrownian(phy=tree))
Error in corFactor.corStruct(object) : NA/NaN/Inf in foreign function
call (arg 1)

or equally:

 model2-compar.gee(y~x,data=dat, phy=tree)
[1] Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
[1] running glm to get initial regression estimate
[1] 15.6000 -0.2625
Error in gee(y ~ x, c(1, 1, 1, 1, 1, 1, 1), data = list(x = c(47, 43,  :
NA/NaN/Inf in foreign function call (arg 14)

(NB using the 'data=' argument seems to be necessary in the gls case- if
I don't, there is a further problem: 'Row names in dataframe do not
match tree tip names. data taken to be in the same order as in tree. in:
Initialize.corPhyl(X[[1]], ...)')

This seems to go away if I remove the root taxon (A1):
tree2-drop.tip(tree, A1)
x2-c(B1=47,D1=43,C1=45,B2=50,B3=47,B4=48)
y2-c(B1=2.9,D1=5.4,C1=2.8,B2=3.5,B3=3.2,B4=3.5)
dat2-as.data.frame(cbind(x2,y2))
model2-gls(y2~x2,data=dat2, correlation=corBrownian(phy=tree2))

This raises various questions:

1) Was I misleading myself that my independent contrasts were valid in
the first place?
2) What is it, if anything, about the root taxon that causes this issue,
given that other taxa also have zero branch lengths?
3) Is there any way of getting around this and including data on the
root taxon, or am I better off just dropping it (ultimately I want to
work with much larger trees (up to tens of thousands of taxa) where that
one piece of information will become relatively less important)

Any help very much appreciated,

Chris

I'm working with ape 1.8-2 in R 2.1.1 under ubuntu 'Breezy' linux
(unfortunately 2.1.1 is the latest easily available in breezy)

-- 
--
Dr Christopher Knight  School of Chemistry
[EMAIL PROTECTED] The University of Manchester
Tel: extn 64414   Faraday Building
 +44 (0)161 3064414  PO Box 88
Fax: +44 (0)161 3064556   Sackville Street
Manchester M60 1QD
 ` · . ,,(((°UK

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

Re: [R] Can't there be a cd command?

2006-05-10 Thread Duncan Murdoch
On 5/10/2006 9:29 AM, Paul Johnson wrote:
 It is a FAQ in our Linux lab.  People start emacs and fire up R via
 ess, and then they have no idea 'where they are.  For computer
 experts, it is not a problem, but for people who don't know much about
 computers, it is a pretty big problem.  They have data in some
 subdirectory, but almost invariably they don't get emacs  R started
 from that same place.
 
 Unfortunately, for our users, it does not help to simply re-label
 setwd as cd.  Both commands imply a deeper understanding of the OS
 than they have.  Also, unfortunately, these are the same people who
 don't understand that FAQs exist and should be consulted. These people
 are so new/timid that asking in r-help would be the last thing to
 cross their mind.
 
 I've wondered if it would not help to have the R prompt include the
 directory name, as in an x terminal.

I think file system directories aren't as central in R as they are in a 
shell, so it would just be distracting.  Most of the time I work in the 
R workspace, not in the file system.

To me the solution is to allow interactive file selection by default, 
i.e. the default on read.table and similar functions should be 
file.choose(), rather than having no default and throwing an error. 
This won't help you in the short run (because file.choose() on Linux 
isn't all that friendly to beginners), but perhaps it would encourage 
someone to make it better.  file.choose() is quite nice in Windows (and 
I think on the Mac), so beginners there could be told

mydf - read.table()

and they'd get something useful.

Martin Maechler has disagreed with me about this in the past, but hasn't 
convinced me that he's right, he's just convinced me that doing nothing 
is easier than arguing about it.

Duncan Murdoch

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Duncan Murdoch
On 5/10/2006 10:11 AM, Liaw, Andy wrote:
 From: Paul Johnson
 
 It is a FAQ in our Linux lab.  People start emacs and fire up 
 R via ess, and then they have no idea 'where they are.  For 
 computer experts, it is not a problem, but for people who 
 don't know much about computers, it is a pretty big problem.  
 They have data in some subdirectory, but almost invariably 
 they don't get emacs  R started from that same place.
 
 ESS by default will prompt for start-up directory when starting 
 R.  Perhaps that was turned off in the lab?
 
  
 Unfortunately, for our users, it does not help to simply 
 re-label setwd as cd.  Both commands imply a deeper 
 understanding of the OS than they have.  Also, unfortunately, 
 these are the same people who don't understand that FAQs 
 exist and should be consulted. These people are so new/timid 
 that asking in r-help would be the last thing to cross their mind.
 
 I've wondered if it would not help to have the R prompt 
 include the directory name, as in an x terminal.
 
 Here's one possibility (on WinXP Pro):
 
 h - taskCallbackManager() 
 h$add(function(expr, value, ok, visible) { 
 + options(prompt=paste(getwd(), , sep=))
 + return(TRUE)}, name=pwdprompt) 
 [1] pwdprompt
 C:/home  setwd(projects)
 C:/home/projects  

That doesn't quite work in the current Rgui, because the menu function 
to change directories (File | Change dir...) doesn't trigger the 
callback.  Not sure if that's a bug or not...

Duncan Murdoch

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Gabor Grothendieck
On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 5/10/2006 9:29 AM, Paul Johnson wrote:
  It is a FAQ in our Linux lab.  People start emacs and fire up R via
  ess, and then they have no idea 'where they are.  For computer
  experts, it is not a problem, but for people who don't know much about
  computers, it is a pretty big problem.  They have data in some
  subdirectory, but almost invariably they don't get emacs  R started
  from that same place.
 
  Unfortunately, for our users, it does not help to simply re-label
  setwd as cd.  Both commands imply a deeper understanding of the OS
  than they have.  Also, unfortunately, these are the same people who
  don't understand that FAQs exist and should be consulted. These people
  are so new/timid that asking in r-help would be the last thing to
  cross their mind.
 
  I've wondered if it would not help to have the R prompt include the
  directory name, as in an x terminal.

 I think file system directories aren't as central in R as they are in a
 shell, so it would just be distracting.  Most of the time I work in the
 R workspace, not in the file system.

 To me the solution is to allow interactive file selection by default,
 i.e. the default on read.table and similar functions should be
 file.choose(), rather than having no default and throwing an error.
 This won't help you in the short run (because file.choose() on Linux
 isn't all that friendly to beginners), but perhaps it would encourage
 someone to make it better.  file.choose() is quite nice in Windows (and
 I think on the Mac), so beginners there could be told

 mydf - read.table()

 and they'd get something useful.

 Martin Maechler has disagreed with me about this in the past, but hasn't
 convinced me that he's right, he's just convinced me that doing nothing
 is easier than arguing about it.

I agree with Martin regarding read.table; however, the underlying idea is
good and could be achieved via simple wrappers which are the same
as the corresponding underlying functions except for the default argument
to file:

   read.table.choose - function(file = file.choose(), ...)
read.table(file, ...)
   read.csv.choose - function(file = file.choose(), ...) read.csv(file, ...)
   read.delim.choose - function(file = file.choose(), ...)
read.delim(file, ...)

  # test
  mydata - read.table.choose()

in a package available to the users or possibly even in R core.

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


Re: [R] new package error message

2006-05-10 Thread Jason Liao
Thank you very much, Prof. Ripley. This is our own package and in R
only, no C or Fortran code. We are doing this on Windows. So it seems
that we have to setup the complete R development system for a simple R
package to work.

Maybe we should just source() the file in, less elegant though.

Jason

--- Prof Brian Ripley [EMAIL PROTECTED] wrote:
 
 In every case I have ever seen mentioned, the solution was to install
 the 
 package properly by R CMD INSTALL and not by a manual kludge.
 
 The message is given if the installation lacks the metadata in the
 Meta 
 subdirectory which INSTALL creates.
 
 -- 
 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
 


Jason Liao, http://www.geocities.com/jg_liao
Dept. of Biostatistics, http://www2.umdnj.edu/bmtrxweb
University of Medicine and Dentistry of New Jersey
683 Hoes Lane West, Piscataway‚ NJ 08854
phone 732-235-5429, School of Public Health office
phone 732-235-9824, Cancer Institute of New Jersey office

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Duncan Murdoch
On 5/10/2006 10:45 AM, Gabor Grothendieck wrote:
 On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 5/10/2006 9:29 AM, Paul Johnson wrote:
  It is a FAQ in our Linux lab.  People start emacs and fire up R via
  ess, and then they have no idea 'where they are.  For computer
  experts, it is not a problem, but for people who don't know much about
  computers, it is a pretty big problem.  They have data in some
  subdirectory, but almost invariably they don't get emacs  R started
  from that same place.
 
  Unfortunately, for our users, it does not help to simply re-label
  setwd as cd.  Both commands imply a deeper understanding of the OS
  than they have.  Also, unfortunately, these are the same people who
  don't understand that FAQs exist and should be consulted. These people
  are so new/timid that asking in r-help would be the last thing to
  cross their mind.
 
  I've wondered if it would not help to have the R prompt include the
  directory name, as in an x terminal.

 I think file system directories aren't as central in R as they are in a
 shell, so it would just be distracting.  Most of the time I work in the
 R workspace, not in the file system.

 To me the solution is to allow interactive file selection by default,
 i.e. the default on read.table and similar functions should be
 file.choose(), rather than having no default and throwing an error.
 This won't help you in the short run (because file.choose() on Linux
 isn't all that friendly to beginners), but perhaps it would encourage
 someone to make it better.  file.choose() is quite nice in Windows (and
 I think on the Mac), so beginners there could be told

 mydf - read.table()

 and they'd get something useful.

 Martin Maechler has disagreed with me about this in the past, but hasn't
 convinced me that he's right, he's just convinced me that doing nothing
 is easier than arguing about it.
 
 I agree with Martin regarding read.table; however, the underlying idea is
 good and could be achieved via simple wrappers which are the same
 as the corresponding underlying functions except for the default argument
 to file:
 
read.table.choose - function(file = file.choose(), ...)
 read.table(file, ...)
read.csv.choose - function(file = file.choose(), ...) read.csv(file, ...)
read.delim.choose - function(file = file.choose(), ...)
 read.delim(file, ...)
 
   # test
   mydata - read.table.choose()
 
 in a package available to the users or possibly even in R core.

No, I don't think this is a good idea.  It would be just as easy to tell 
people to type

read.table(file=file.choose())

with no new package or function necessary.  I want the existing basic 
function to work when used by a beginner in a simple way.

What is it that you find objectionable about having a default for the 
file argument in read.table?  I think Martin has said that he doesn't 
want non-UI functions to be involved with UI functions, but I don't see 
that:  if your code works now, it will be completely unaffected by 
setting a default for the argument.  (Sorry if I summarized the argument 
incorrectly, Martin, I didn't look it up.)

Duncan Murdoch

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


Re: [R] new package error message

2006-05-10 Thread Prof Brian Ripley

On Wed, 10 May 2006, Jason Liao wrote:


Thank you very much, Prof. Ripley. This is our own package and in R
only, no C or Fortran code. We are doing this on Windows. So it seems
that we have to setup the complete R development system for a simple R
package to work.


Yes, you do (well, you don't need the compilers but you need the tools and 
perl).


We cannot convert help to a viewable format without perl (nor are we 
likely to in the foreseeable future, help formats having been discussed 
since 2001).  We probably could convert R CMD INSTALL to need only Perl

for a package with no C or Fortran code, which might be helpful.



Maybe we should just source() the file in, less elegant though.

Jason

--- Prof Brian Ripley [EMAIL PROTECTED] wrote:


In every case I have ever seen mentioned, the solution was to install
the
package properly by R CMD INSTALL and not by a manual kludge.

The message is given if the installation lacks the metadata in the
Meta
subdirectory which INSTALL creates.

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




Jason Liao, http://www.geocities.com/jg_liao
Dept. of Biostatistics, http://www2.umdnj.edu/bmtrxweb
University of Medicine and Dentistry of New Jersey
683 Hoes Lane West, Piscataway‚ NJ 08854
phone 732-235-5429, School of Public Health office
phone 732-235-9824, Cancer Institute of New Jersey office

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com




--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Can't there be a cd command?

2006-05-10 Thread Gabor Grothendieck
On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 5/10/2006 10:45 AM, Gabor Grothendieck wrote:
  On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
  On 5/10/2006 9:29 AM, Paul Johnson wrote:
   It is a FAQ in our Linux lab.  People start emacs and fire up R via
   ess, and then they have no idea 'where they are.  For computer
   experts, it is not a problem, but for people who don't know much about
   computers, it is a pretty big problem.  They have data in some
   subdirectory, but almost invariably they don't get emacs  R started
   from that same place.
  
   Unfortunately, for our users, it does not help to simply re-label
   setwd as cd.  Both commands imply a deeper understanding of the OS
   than they have.  Also, unfortunately, these are the same people who
   don't understand that FAQs exist and should be consulted. These people
   are so new/timid that asking in r-help would be the last thing to
   cross their mind.
  
   I've wondered if it would not help to have the R prompt include the
   directory name, as in an x terminal.
 
  I think file system directories aren't as central in R as they are in a
  shell, so it would just be distracting.  Most of the time I work in the
  R workspace, not in the file system.
 
  To me the solution is to allow interactive file selection by default,
  i.e. the default on read.table and similar functions should be
  file.choose(), rather than having no default and throwing an error.
  This won't help you in the short run (because file.choose() on Linux
  isn't all that friendly to beginners), but perhaps it would encourage
  someone to make it better.  file.choose() is quite nice in Windows (and
  I think on the Mac), so beginners there could be told
 
  mydf - read.table()
 
  and they'd get something useful.
 
  Martin Maechler has disagreed with me about this in the past, but hasn't
  convinced me that he's right, he's just convinced me that doing nothing
  is easier than arguing about it.
 
  I agree with Martin regarding read.table; however, the underlying idea is
  good and could be achieved via simple wrappers which are the same
  as the corresponding underlying functions except for the default argument
  to file:
 
 read.table.choose - function(file = file.choose(), ...)
  read.table(file, ...)
 read.csv.choose - function(file = file.choose(), ...) read.csv(file, 
  ...)
 read.delim.choose - function(file = file.choose(), ...)
  read.delim(file, ...)
 
# test
mydata - read.table.choose()
 
  in a package available to the users or possibly even in R core.

 No, I don't think this is a good idea.  It would be just as easy to tell
 people to type

 read.table(file=file.choose())

 with no new package or function necessary.  I want the existing basic
 function to work when used by a beginner in a simple way.

I don't think that an idiom of multiple function calls is as simple as
issuing a single function call with no args.

One possibility is to have
a keyword choose on the file function in the same way that file
accepts the keyword clipboard.  Then one could write:

  mydata - read.table(choose)

I think the wrapper approach is probably preferable though and seems
consistent with the way R deals with this in other places such as the
ISOdate wrapper.



 What is it that you find objectionable about having a default for the
 file argument in read.table?  I think Martin has said that he doesn't
 want non-UI functions to be involved with UI functions, but I don't see
 that:  if your code works now, it will be completely unaffected by
 setting a default for the argument.  (Sorry if I summarized the argument
 incorrectly, Martin, I didn't look it up.)

That would be my objection too.  UI should not be tied to the non-UI core.
Its basically a loose coupling argument.

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


Re: [R] problem rbind after lapply (difference between 2.2.1 and 2.3.0)

2006-05-10 Thread Prof Brian Ripley
This is already fixed in R-patched:

 o   rbind()ing dataframes with a single row could lead to a
 corrupt data frame (a problem with the fix to PR#8506).

On Wed, 10 May 2006, Gary Collins wrote:

 Any help on the following would be appreciated...

 R.version
 _
 platform i386-pc-mingw32
 arch i386
 os   mingw32
 system   i386, mingw32
 status
 major2
 minor2.1
 year 2005
 month12
 day  20
 svn rev  36812
 language R
 set.seed(2)
 x=matrix(ncol=4, nrow=10)
 for(i in 1:4) x[,i]=rnorm(10)
 x=as.data.frame(x)
 x$V1=c(rep(0,5), rep(1,5))
 x
   V1  V2   V3 V4
 1   0  0.41765075  2.090819205  0.7389386
 2   0  0.98175278 -1.199925820  0.3189604
 3   0 -0.39269536  1.589638200  1.0761644
 4   0 -1.03966898  1.954651642 -0.2841577
 5   0  1.78222896  0.00493 -0.7766753
 6   1 -2.31106908 -2.451706388 -0.5956605
 7   1  0.87860458  0.477237303 -1.7259798
 8   1  0.03580672 -0.596558169 -0.9025845
 9   1  1.01282869  0.792203270 -0.5590619
 10  1  0.43226515  0.289636710 -0.2465126

  do.call(rbind, lapply(split(x, x$V1), function(x) 
 data.frame(min=min(x$V2), max=max(x$V2
min  max
 0 -1.039669 1.782229
 1 -2.311069 1.012829

 yet with the same call on version 2.3.0, I get the following error.

 do.call(rbind, lapply(split(x, x$V1), function(x) 
 data.frame(min=min(x$V2), max=max(x$V2
 Error in data.frame(min = c(-1.039669, -2.311069), max = c(1.782229,  :
row names contain missing values

 Any clues on what has changed between the two versions? and a fix to
 get around this? The actual function (min, max) within the lapply is
 just an example for illustration only, the issue is the rbinding of
 results from an lapply call. I've had a look at the changes document
 packaged with 2.3.0 and found nothing...so wondering whether it's a
 bug or not?

 Thanks in advance.

 Gary

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


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

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Duncan Murdoch
On 5/10/2006 11:10 AM, Gabor Grothendieck wrote:
 On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 5/10/2006 10:45 AM, Gabor Grothendieck wrote:
  On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
  On 5/10/2006 9:29 AM, Paul Johnson wrote:
   It is a FAQ in our Linux lab.  People start emacs and fire up R via
   ess, and then they have no idea 'where they are.  For computer
   experts, it is not a problem, but for people who don't know much about
   computers, it is a pretty big problem.  They have data in some
   subdirectory, but almost invariably they don't get emacs  R started
   from that same place.
  
   Unfortunately, for our users, it does not help to simply re-label
   setwd as cd.  Both commands imply a deeper understanding of the OS
   than they have.  Also, unfortunately, these are the same people who
   don't understand that FAQs exist and should be consulted. These people
   are so new/timid that asking in r-help would be the last thing to
   cross their mind.
  
   I've wondered if it would not help to have the R prompt include the
   directory name, as in an x terminal.
 
  I think file system directories aren't as central in R as they are in a
  shell, so it would just be distracting.  Most of the time I work in the
  R workspace, not in the file system.
 
  To me the solution is to allow interactive file selection by default,
  i.e. the default on read.table and similar functions should be
  file.choose(), rather than having no default and throwing an error.
  This won't help you in the short run (because file.choose() on Linux
  isn't all that friendly to beginners), but perhaps it would encourage
  someone to make it better.  file.choose() is quite nice in Windows (and
  I think on the Mac), so beginners there could be told
 
  mydf - read.table()
 
  and they'd get something useful.
 
  Martin Maechler has disagreed with me about this in the past, but hasn't
  convinced me that he's right, he's just convinced me that doing nothing
  is easier than arguing about it.
 
  I agree with Martin regarding read.table; however, the underlying idea is
  good and could be achieved via simple wrappers which are the same
  as the corresponding underlying functions except for the default argument
  to file:
 
 read.table.choose - function(file = file.choose(), ...)
  read.table(file, ...)
 read.csv.choose - function(file = file.choose(), ...) read.csv(file, 
  ...)
 read.delim.choose - function(file = file.choose(), ...)
  read.delim(file, ...)
 
# test
mydata - read.table.choose()
 
  in a package available to the users or possibly even in R core.

 No, I don't think this is a good idea.  It would be just as easy to tell
 people to type

 read.table(file=file.choose())

 with no new package or function necessary.  I want the existing basic
 function to work when used by a beginner in a simple way.
 
 I don't think that an idiom of multiple function calls is as simple as
 issuing a single function call with no args.
 
 One possibility is to have
 a keyword choose on the file function in the same way that file
 accepts the keyword clipboard.  Then one could write:
 
   mydata - read.table(choose)
 
 I think the wrapper approach is probably preferable though and seems
 consistent with the way R deals with this in other places such as the
 ISOdate wrapper.
 
 

 What is it that you find objectionable about having a default for the
 file argument in read.table?  I think Martin has said that he doesn't
 want non-UI functions to be involved with UI functions, but I don't see
 that:  if your code works now, it will be completely unaffected by
 setting a default for the argument.  (Sorry if I summarized the argument
 incorrectly, Martin, I didn't look it up.)
 
 That would be my objection too.  UI should not be tied to the non-UI core.
 Its basically a loose coupling argument.

I don't accept that argument, because in R everything* is interactive. 
There isn't a non-UI core.  The function arguments are part of the user 
interface.

Duncan Murdoch

* Well, maybe this should be restricted to functions visible to the 
user, but everything we've been discussing so far is visible and is part 
of the user interface.

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


[R] problems with optimize (again)

2006-05-10 Thread tom wright
Can someone please explain what the $minimum result of the optimize
function actually is?

I'm trying to optimize the function:
fitIT-function(ampFac,ts_wave1,ts_template){
template-stretchWaveTime(ts_template,ampFac)
fit-calcFit(ts_wave1,template)
return(fit)
}

with
optimize(f=fitIT,interval=c(0.5,4),ts_wave1=test.data[,1],ts_template=test.data[,1])
$minimum
[1] 3.764685

$objective
[1] 1.037864

however when I run
 calcFit(test.data[,1],stretchWaveTime(test.data[,1],1.037864)) 
[1] 0.3059954

I thought $minimum and the result of the calcFit function should be the
same.

As a further question I'm going to need to nest optimize functions so I
can optimize over two variables. How can I get the minimum and objective
back from the nested function f, as well as the value to be minimised?

I hope this makes sense and I apologise for the lack of reproducible
code. If it will help I can include that in a further e-mail.
Thanks
Tom

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


[R] importing a list

2006-05-10 Thread grazia
Hi, all.
I'm trying to automate some regression operations in R leaving the 
possibility to modify the predictors in the regression.

For example, I have saved in a list the results and then exported as a txt 
file, in which we can modify the predictors, putting for example 
lm(y~x^2) instead of having lm(y~x) as in the original model.

Now, I need to import in R the txt file as a list to evaluate the model. 
Is that possible?

I played around
with source() and file() but can't figure it out.

Thanks.
Grazia


M. Grazia Pittau, Ph.D.
Post-Doctoral Research Fellow
Department of Statistics
Columbia University
1255 Amsterdam Avenue
New York, NY  10027

[EMAIL PROTECTED]
Phone: 212.851.2160
Fax: 212.851.2164

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Jan T. Kim
On Wed, May 10, 2006 at 11:26:55AM -0400, Duncan Murdoch wrote:
 On 5/10/2006 11:10 AM, Gabor Grothendieck wrote:
  On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:

  What is it that you find objectionable about having a default for the
  file argument in read.table?  I think Martin has said that he doesn't
  want non-UI functions to be involved with UI functions, but I don't see
  that:  if your code works now, it will be completely unaffected by
  setting a default for the argument.  (Sorry if I summarized the argument
  incorrectly, Martin, I didn't look it up.)
  
  That would be my objection too.  UI should not be tied to the non-UI core.
  Its basically a loose coupling argument.
 
 I don't accept that argument, because in R everything* is interactive. 
 There isn't a non-UI core.  The function arguments are part of the user 
 interface.

It seems to me that there might be a misunderstanding here; as the term
user is used to refer to a person interacting with the computer on
the one hand, and to refer to a programmer using R on the other hand.

Everything being part of the user interface, in the sense of
every user-visible function being part of the API, does not and should
not imply that everything should be interactive.

In my experience, interactivity is a rather double-edged thing: On the
one hand, it facilitates learning and exploration, but on the other
hand, its improper use is frequently detrimental to reproducibility of
scientific computation.

Best regards, Jan
-- 
 +- Jan T. Kim ---+
 | email: [EMAIL PROTECTED]   |
 | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=  hierarchical systems are for files, not for humans  =-*

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Gabor Grothendieck
On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 5/10/2006 11:10 AM, Gabor Grothendieck wrote:
  On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
  On 5/10/2006 10:45 AM, Gabor Grothendieck wrote:
   On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
   On 5/10/2006 9:29 AM, Paul Johnson wrote:
It is a FAQ in our Linux lab.  People start emacs and fire up R via
ess, and then they have no idea 'where they are.  For computer
experts, it is not a problem, but for people who don't know much about
computers, it is a pretty big problem.  They have data in some
subdirectory, but almost invariably they don't get emacs  R started
from that same place.
   
Unfortunately, for our users, it does not help to simply re-label
setwd as cd.  Both commands imply a deeper understanding of the OS
than they have.  Also, unfortunately, these are the same people who
don't understand that FAQs exist and should be consulted. These people
are so new/timid that asking in r-help would be the last thing to
cross their mind.
   
I've wondered if it would not help to have the R prompt include the
directory name, as in an x terminal.
  
   I think file system directories aren't as central in R as they are in a
   shell, so it would just be distracting.  Most of the time I work in the
   R workspace, not in the file system.
  
   To me the solution is to allow interactive file selection by default,
   i.e. the default on read.table and similar functions should be
   file.choose(), rather than having no default and throwing an error.
   This won't help you in the short run (because file.choose() on Linux
   isn't all that friendly to beginners), but perhaps it would encourage
   someone to make it better.  file.choose() is quite nice in Windows (and
   I think on the Mac), so beginners there could be told
  
   mydf - read.table()
  
   and they'd get something useful.
  
   Martin Maechler has disagreed with me about this in the past, but hasn't
   convinced me that he's right, he's just convinced me that doing nothing
   is easier than arguing about it.
  
   I agree with Martin regarding read.table; however, the underlying idea is
   good and could be achieved via simple wrappers which are the same
   as the corresponding underlying functions except for the default argument
   to file:
  
  read.table.choose - function(file = file.choose(), ...)
   read.table(file, ...)
  read.csv.choose - function(file = file.choose(), ...) read.csv(file, 
   ...)
  read.delim.choose - function(file = file.choose(), ...)
   read.delim(file, ...)
  
 # test
 mydata - read.table.choose()
  
   in a package available to the users or possibly even in R core.
 
  No, I don't think this is a good idea.  It would be just as easy to tell
  people to type
 
  read.table(file=file.choose())
 
  with no new package or function necessary.  I want the existing basic
  function to work when used by a beginner in a simple way.
 
  I don't think that an idiom of multiple function calls is as simple as
  issuing a single function call with no args.
 
  One possibility is to have
  a keyword choose on the file function in the same way that file
  accepts the keyword clipboard.  Then one could write:
 
mydata - read.table(choose)
 
  I think the wrapper approach is probably preferable though and seems
  consistent with the way R deals with this in other places such as the
  ISOdate wrapper.
 
 
 
  What is it that you find objectionable about having a default for the
  file argument in read.table?  I think Martin has said that he doesn't
  want non-UI functions to be involved with UI functions, but I don't see
  that:  if your code works now, it will be completely unaffected by
  setting a default for the argument.  (Sorry if I summarized the argument
  incorrectly, Martin, I didn't look it up.)
 
  That would be my objection too.  UI should not be tied to the non-UI core.
  Its basically a loose coupling argument.

 I don't accept that argument, because in R everything* is interactive.
 There isn't a non-UI core.  The function arguments are part of the user
 interface.

 Duncan Murdoch

 * Well, maybe this should be restricted to functions visible to the
 user, but everything we've been discussing so far is visible and is part
 of the user interface.


Another idea is to implement a menu item in the Windows GUI that
does a read.table(file.choose(), ...).

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


Re: [R] importing a list

2006-05-10 Thread Berton Gunter
?dump  ?source

But do you really need to save the fitted object as a txt file?
Saving/loading it in native format (?save  ?load) and then using ?update
would seem to be more straightforward.

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 [EMAIL PROTECTED]
 Sent: Wednesday, May 10, 2006 8:24 AM
 To: R-help@stat.math.ethz.ch
 Subject: [R] importing a list
 
 Hi, all.
 I'm trying to automate some regression operations in R leaving the 
 possibility to modify the predictors in the regression.
 
 For example, I have saved in a list the results and then 
 exported as a txt 
 file, in which we can modify the predictors, putting for example 
 lm(y~x^2) instead of having lm(y~x) as in the original model.
 
 Now, I need to import in R the txt file as a list to evaluate 
 the model. 
 Is that possible?
 
 I played around
 with source() and file() but can't figure it out.
 
 Thanks.
 Grazia
 
 
 M. Grazia Pittau, Ph.D.
 Post-Doctoral Research Fellow
 Department of Statistics
 Columbia University
 1255 Amsterdam Avenue
 New York, NY  10027
 
 [EMAIL PROTECTED]
 Phone: 212.851.2160
 Fax: 212.851.2164
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


Re: [R] problems with optimize (again)

2006-05-10 Thread Dimitris Rizopoulos
you should use:

optmz - optimize(fitIT, interval = c(0.5, 4),
   ts_wave1 = test.data[, 1], ts_template = test.data[, 1])

calcFit(test.data[, 1], stretchWaveTime(test.data[, 1], optmz$minimum)

which should give the same as optmz$objective, i.e., the optmz$minimum 
is the value of 'ampFac' argument for which fitIT() attains its 
minimum value; the value of fitIT() at optmz$minimum is 
optmz$objective.

I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm



- Original Message - 
From: tom wright [EMAIL PROTECTED]
To: R-Stat Help R-help@stat.math.ethz.ch
Sent: Wednesday, May 10, 2006 2:18 PM
Subject: [R] problems with optimize (again)


 Can someone please explain what the $minimum result of the optimize
 function actually is?

 I'm trying to optimize the function:
 fitIT-function(ampFac,ts_wave1,ts_template){
template-stretchWaveTime(ts_template,ampFac)
fit-calcFit(ts_wave1,template)
return(fit)
 }

 with
optimize(f=fitIT,interval=c(0.5,4),ts_wave1=test.data[,1],ts_template=test.data[,1])
 $minimum
 [1] 3.764685

 $objective
 [1] 1.037864

 however when I run
 calcFit(test.data[,1],stretchWaveTime(test.data[,1],1.037864))
 [1] 0.3059954

 I thought $minimum and the result of the calcFit function should be 
 the
 same.

 As a further question I'm going to need to nest optimize functions 
 so I
 can optimize over two variables. How can I get the minimum and 
 objective
 back from the nested function f, as well as the value to be 
 minimised?

 I hope this makes sense and I apologise for the lack of reproducible
 code. If it will help I can include that in a further e-mail.
 Thanks
 Tom

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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

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


Re: [R] problems with optimize (again)

2006-05-10 Thread Uwe Ligges
tom wright wrote:

 Can someone please explain what the $minimum result of the optimize
 function actually is?
 
 I'm trying to optimize the function:
 fitIT-function(ampFac,ts_wave1,ts_template){
 template-stretchWaveTime(ts_template,ampFac)
 fit-calcFit(ts_wave1,template)
 return(fit)
 }
 
 with
 
optimize(f=fitIT,interval=c(0.5,4),ts_wave1=test.data[,1],ts_template=test.data[,1])
 
 $minimum
 [1] 3.764685
 
 $objective
 [1] 1.037864
 
 however when I run
 
calcFit(test.data[,1],stretchWaveTime(test.data[,1],1.037864)) 
 
 [1] 0.3059954


What is calcFit?

 I thought $minimum and the result of the calcFit function should be the
 same.

Why should to different algorithms (at least I guess so, since you don't 
say what calcFit() does) find the same *local* minimum?


 As a further question I'm going to need to nest optimize functions so I
 can optimize over two variables. How can I get the minimum and objective
 back from the nested function f, as well as the value to be minimised?


Use optim().

Uwe Ligges


 I hope this makes sense and I apologise for the lack of reproducible
 code. If it will help I can include that in a further e-mail.
 Thanks
 Tom
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] importing a list

2006-05-10 Thread Robert Citek
Hello Grazia,

On May 10, 2006, at 10:23 AM, [EMAIL PROTECTED] wrote:
 I'm trying to automate some regression operations in R leaving the
 possibility to modify the predictors in the regression.

 For example, I have saved in a list the results and then exported  
 as a txt
 file, in which we can modify the predictors, putting for example
 lm(y~x^2) instead of having lm(y~x) as in the original model.

 Now, I need to import in R the txt file as a list to evaluate the  
 model.
 Is that possible?

 I played around with source() and file() but can't figure it out.

What OS are you using?  When you say the list is in a text file, how  
is the text file structured, e.g. CSV, TSV, fixed-width, other?

Here's an example of creating, writing, and reading a data.frame:

d - data.frame(cbind(x=1, y=1:10))
write.table(d, file=r-data.txt, sep=\t, na=, quote=FALSE,  
row.names = FALSE)
d.new - read.delim(r-data.txt)

HTH.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

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


[R] Batch printing of existing postscript files with file names included

2006-05-10 Thread Christoph Scherber
Dear R users,

I have created a series of postscript files and I´d like to print them 
with the file name added to the printout. Is there a way of reading 
these files into R (e.g. using rimage after conversion to jpeg), adding 
the file name, and then sending the files to a windows printer?

I have already tried the rimage package, and several image batch 
conversion program, but none was so far able to do the job, unfortunately.

I´m using R 2.3.0 on Windows XP.

Thank you very much for your help!

Best regards
Christoph

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Duncan Murdoch
On 5/10/2006 12:15 PM, Jan T. Kim wrote:
 On Wed, May 10, 2006 at 11:26:55AM -0400, Duncan Murdoch wrote:
 On 5/10/2006 11:10 AM, Gabor Grothendieck wrote:
  On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
 
  What is it that you find objectionable about having a default for the
  file argument in read.table?  I think Martin has said that he doesn't
  want non-UI functions to be involved with UI functions, but I don't see
  that:  if your code works now, it will be completely unaffected by
  setting a default for the argument.  (Sorry if I summarized the argument
  incorrectly, Martin, I didn't look it up.)
  
  That would be my objection too.  UI should not be tied to the non-UI core.
  Its basically a loose coupling argument.
 
 I don't accept that argument, because in R everything* is interactive. 
 There isn't a non-UI core.  The function arguments are part of the user 
 interface.
 
 It seems to me that there might be a misunderstanding here; as the term
 user is used to refer to a person interacting with the computer on
 the one hand, and to refer to a programmer using R on the other hand.

One of the design goals of S and R is to blur the distinction between 
users and programmers.  It is a continuum.  R is designed to gently urge 
non-programmers to become programmers, because the designers think 
that's the way statistical computing should be done.

 Everything being part of the user interface, in the sense of
 every user-visible function being part of the API, does not and should
 not imply that everything should be interactive.

No, I didn't suggest that.  What I was suggesting is that it should be 
*convenient* to use read.table interactively, not that it should be 
required. (It's already possible, but not convenient, especially for a 
beginner who doesn't know the secret incantation.)

 In my experience, interactivity is a rather double-edged thing: On the
 one hand, it facilitates learning and exploration, but on the other
 hand, its improper use is frequently detrimental to reproducibility of
 scientific computation.

I definitely agree with that.  It should be convenient to use R 
non-interactively as well.  Anyone who wants reproducibility should be 
writing packages and scripts or vignettes that run non-interactively. 
That's why I am emphasizing that this change will have no effect on 
existing code.  I wouldn't suggest it if it did.

Duncan Murdoch

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


Re: [R] finding centroids of clusters created with hclust

2006-05-10 Thread Moritz Lennert
Replying to myself for the record:

Moritz Lennert wrote:
 Hello,
 
 Can someone point me to documentation or ideas on how to calculate the 
 centroids of clusters identified with hclust ?
 
 I would like to be able to chose the number of clusters (in the style of 
 cutree) and then get the centroids of these clusters.
 
 This seems like a quite obvious task to me, but I haven't been able to 
 put my hands on a relevant command.

Here's a simple function that does the job for me:

Variables:

data: matrix of original (absolute value) data introduced into hclust or 
HierClust
clust: result of a 'cutree' call on the results of the hclust or 
HierClust call

Value:

a matrix of relative values of the variables at the centroids of the types


function (data, clust) {
   nvars=length(data[1,])
   ntypes=max(clust)
   centroids-matrix(0,ncol=nvars,nrow=ntypes)
   for(i in 1:ntypes) {
  c-rep(0,nvars)
  n-0
  for(j in names(clust[clust==i])) {
 n-n+1
 c-c+data[j,]
  }
  centroids[i,]-c/n
   }
   rownames(centroids)-c(1:ntypes)
   colnames(centroids)-colnames(data)
   centroids
}

Moritz

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


Re: [R] Until the key pressed: FOR-LOOP-Clustering

2006-05-10 Thread Liaw, Andy
Not sure exactly what you're asking, but I'll take a stab at it:
Try adding par(ask=TRUE) before the for() loop.

Andy 

From: j.joshua thomas
 
 Hi All,
 
 These are the code that i used to plot the kmeans clustering.
 
  DataSetS01022-rbind(matrix(rnorm(50),ncol=2),
 + matrix(rnorm(50),ncol=2))
  colnames(DataSetS01022) -c(timeslot,em)  (cl 
 -kmeans(DataSetS01022,2)) plot (DataSetS01022, col=cl$cluster)  
 points(cl$centers, col = 1:2, pch = 8, cex=2)
 
 Now, i would like to do *the same process for 5 times*, so 
 that i can view the clusters in data have been moving and the 
 center changes with various results.
 (Animation-like)
 
 My main concern here, is how to put this in a *loop form* or 
 any other methods are available?
 
 I tried with:* clarax$clusinfo I thought of doing it to 
 activate Device (1)  (2)*
 **
 *Really need anyones help!*
 **
 *JJ*
 *---*
 
 
 
 --
 Lecturer J. Joshua Thomas
 KDU College Penang Campus
 Research Student,
 University Sains Malaysia
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


Re: [R] importing a list

2006-05-10 Thread grazia
Robert,
thanks first of all.
Actually, the txt file I want to read as a list is like that:


$y
$y$mod.1
[1] impute.1.y=glm(I(y0)~x+ z+ w,family=binomial(link =logit),data= 
data)

$y$mod.2
[1] impute.2.y=lm(I(log (y))~x+ z+ w,subset=y0)

$x
[1] impute.x=lm(x~y+ z+ w, data= data)

$z
[1] impute.z=lm(z~y+ x+ w,data= data)

that is a list of 4 elements with the first element
a list as well.

To save the file I'm using this function:

list2ascii - function(x, 
file=paste(deparse(substitute(x)),.txt,sep=)) {

tmp.wid = getOption(width)
options(width=1)
sink(file)
print(x)
sink()
options(width=tmp.wid)
return(invisible(NULL))
}

So, I should read it using
read.fwf(models.txt, width=getOption(width))

The problem is that I'm not getting back a list!
Probably I have to play with write.table?!!
thanks,
grazia




On Wed, 10 May 2006, Robert Citek wrote:

 Hello Grazia,

 On May 10, 2006, at 10:23 AM, [EMAIL PROTECTED] wrote:
 I'm trying to automate some regression operations in R leaving the
 possibility to modify the predictors in the regression.
 
 For example, I have saved in a list the results and then exported as a txt
 file, in which we can modify the predictors, putting for example
 lm(y~x^2) instead of having lm(y~x) as in the original model.
 
 Now, I need to import in R the txt file as a list to evaluate the model.
 Is that possible?
 
 I played around with source() and file() but can't figure it out.

 What OS are you using?  When you say the list is in a text file, how is the 
 text file structured, e.g. CSV, TSV, fixed-width, other?

 Here's an example of creating, writing, and reading a data.frame:

 d - data.frame(cbind(x=1, y=1:10))
 write.table(d, file=r-data.txt, sep=\t, na=, quote=FALSE, row.names = 
 FALSE)
 d.new - read.delim(r-data.txt)

 HTH.

 Regards,
 - Robert
 http://www.cwelug.org/downloads
 Help others get OpenSource software.  Distribute FLOSS
 for Windows, Linux, *BSD, and MacOS X with BitTorrent


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


[R] attach() warning message

2006-05-10 Thread J.M. Breiwick
Hi,

I am using R 2.3.0 and my .First() file has the following line which causes 
a warning:
attach(what=c:/r/jmb/.RData, pos=3)

I get the following message after .First() is loaded:

During startup - Warning message:
use of NULL environment is deprecated

Is there a simple fix that will eliminate this warning message? Thanks.

J. Breiwick

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


Re: [R] identify high dimension data point

2006-05-10 Thread Greg Snow
The tkBrush function in the TeachingDemos package may help.  If you just
want to see where a selected point apears in each of the pairwise plots
based on selecting it in 1 plot then this function will do that for you
(note it depends on having installed the tcltk package as well).

If you need the index of a selected point then you can do something
like:

out1 - tkBrush(mydata)
 
# now select the point of interest, click to make the change persistent.

which(out1$col != 'black')  # this gives the observation (row) number


Hope this helps,


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

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tong Wang
Sent: Wednesday, May 10, 2006 5:05 AM
To: R help
Subject: [R] identify high dimension data point

Hi there, 
I am having some trouble with the Identify() function,  it looks
that the identify() function only works on the plot of 2-dimension data
set.  In high-dimension case , if I use pairs() + identify() in hope to
observe all the components of the data point I selected, I get error
message.  Is there anyway to get around this ? Plus,  I also need it to
actually compare all the components of the picked data point with
mydataset to choose the closest one. 
Thanks million in advance. 

best

tong

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

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


Re: [R] finding centroids of clusters created with hclust

2006-05-10 Thread Gavin Simpson
On Wed, 2006-05-10 at 18:59 +0200, Moritz Lennert wrote:
 Replying to myself for the record:
 
 Moritz Lennert wrote:
  Hello,
  
  Can someone point me to documentation or ideas on how to calculate the 
  centroids of clusters identified with hclust ?
  
  I would like to be able to chose the number of clusters (in the style of 
  cutree) and then get the centroids of these clusters.
  
  This seems like a quite obvious task to me, but I haven't been able to 
  put my hands on a relevant command.

Sorry, Moritz, I meant to reply to your original post, but deleted it
from my emailer accidentally and hadn't had chance to use the archives
to follow up.

Anyway, Venables and Ripley's Modern Applied Statistics with S (4th Ed)
[and earlier editions - it is in my 3rd Edition for example] has an
example of doing what you want to do on page 318 of the 4th Edition.
They use the centre's of the hclust results as starting points for a
k-means, so we only need the preliminary bits of their example:

library(MASS)
swiss.x - as.matrix(swiss)
h - hclust(dist(swiss.x), method = average)
initial - tapply(swiss.x, list(rep(cutree(h, 3), ncol(swiss.x)),
col(swiss.x)),
  mean)
dimnames(initial) - list(NULL, dimnames(swiss.x)[[2]])
initial

Which gives almost the same output as your function:

fun -  function (data, clust) {
  nvars=length(data[1,])
  ntypes=max(clust)
  centroids-matrix(0,ncol=nvars,nrow=ntypes)
  for(i in 1:ntypes) {
c-rep(0,nvars)
n-0
for(j in names(clust[clust==i])) {
  n-n+1
  c-c+data[j,]
}
centroids[i,]-c/n
  }
  rownames(centroids)-c(1:ntypes)
  colnames(centroids)-colnames(data)
  centroids
}

fun(swiss.x, cutree(h, 3))

Wrapping the Venables  Ripley version into a function to give the same
output as your function:

##
## clust.means - function to find centroids of clusters
## based on example by Venables  Ripley, MASS 4thEd, Page 318 [1]
##
## x= input data as data.frame or matrix
## res.clust= object of class hclust
## groups   = number of groups to cut dendrogram into
##
## References:
##
## [1] Venables, W.N. and Ripley, B.D. (2002) Modern Applied Statistics 
## with S. 4th Edition. Springer.
clust.means - function(x, res.clust, groups)
  {
if(!is.matrix(x))
  x - as.matrix(x)
means - tapply(x, list(rep(cutree(res.clust, groups), ncol(x)),
  col(x)),
mean)
dimnames(means) - list(NULL, dimnames(x)[[2]])
return(as.data.frame(means))
  }

clust.means(swiss, h, 3)

Your function is faster here:

 system.time(for(i in 1:1) fun(swiss.x, cutree(h, 3)))
[1] 8.917 0.000 9.695 0.000 0.000
 
 system.time(for(i in 1:1) clust.means(swiss, h, 3))
[1] 31.642  0.008 35.348  0.000  0.000

But I think the example is instructive about using R. Sometimes
vectorisation can make a big time saving over a loop - here it doesn't.

HTH

G

 
 Here's a simple function that does the job for me:
 
 Variables:
 
 data: matrix of original (absolute value) data introduced into hclust or 
 HierClust
 clust: result of a 'cutree' call on the results of the hclust or 
 HierClust call
 
 Value:
 
 a matrix of relative values of the variables at the centroids of the types
 
 
 function (data, clust) {
nvars=length(data[1,])
ntypes=max(clust)
centroids-matrix(0,ncol=nvars,nrow=ntypes)
for(i in 1:ntypes) {
   c-rep(0,nvars)
   n-0
   for(j in names(clust[clust==i])) {
  n-n+1
  c-c+data[j,]
   }
   centroids[i,]-c/n
}
rownames(centroids)-c(1:ntypes)
colnames(centroids)-colnames(data)
centroids
 }
 
 Moritz
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
*  Note new Address, Telephone  Fax numbers from 6th April 2006  *
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson
ECRC  ENSIS  [t] +44 (0)20 7679 0522
UCL Department of Geography   [f] +44 (0)20 7679 0565
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street  [w] http://www.ucl.ac.uk/~ucfagls/cv/
London, UK.   [w] http://www.ucl.ac.uk/~ucfagls/
WC1E 6BT.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] importing a list

2006-05-10 Thread Marc Schwartz (via MN)
A search for the list2ascii() function, led me to this post by Mike
Prager:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66335.html

in which Mike specifically notes:

To write it to a file that can be read by R, I would suggest using 
dput instead.


Thus, instead of using list2ascii() on your list object, use:

sink(YourTextFile)
dput(YourListObject)
sink()

You can then re-read the text file back into R using:

source(YourTextFile)

provided of course that you don't compromise the integrity of the file
content when you edit the model formulae.

See ?sink (or ?capture.output) and ?dput for more help here.

However, I wholeheartedly support Bert's recommendation that you use
save()/load()/update(), since these functions enable you to work with R
objects directly in their native format _within R_, as opposed to
messing around with textual representations in an external editor where
you risk introducing errors through typos.

R is an incredibly powerful environment, when you work within it to take
advantage of its power, rather then trying to work around it to obviate
it.

HTH,

Marc Schwartz

On Wed, 2006-05-10 at 13:05 -0400, [EMAIL PROTECTED] wrote:
 Robert,
 thanks first of all.
 Actually, the txt file I want to read as a list is like that:
 
 
 $y
 $y$mod.1
 [1] impute.1.y=glm(I(y0)~x+ z+ w,family=binomial(link =logit),data= 
 data)
 
 $y$mod.2
 [1] impute.2.y=lm(I(log (y))~x+ z+ w,subset=y0)
 
 $x
 [1] impute.x=lm(x~y+ z+ w, data= data)
 
 $z
 [1] impute.z=lm(z~y+ x+ w,data= data)
 
 that is a list of 4 elements with the first element
 a list as well.
 
 To save the file I'm using this function:
 
 list2ascii - function(x, 
 file=paste(deparse(substitute(x)),.txt,sep=)) {
 
 tmp.wid = getOption(width)
 options(width=1)
 sink(file)
 print(x)
 sink()
 options(width=tmp.wid)
 return(invisible(NULL))
 }
 
 So, I should read it using
 read.fwf(models.txt, width=getOption(width))
 
 The problem is that I'm not getting back a list!
 Probably I have to play with write.table?!!
 thanks,
 grazia
 
 
 
 
 On Wed, 10 May 2006, Robert Citek wrote:
 
  Hello Grazia,
 
  On May 10, 2006, at 10:23 AM, [EMAIL PROTECTED] wrote:
  I'm trying to automate some regression operations in R leaving the
  possibility to modify the predictors in the regression.
  
  For example, I have saved in a list the results and then exported as a txt
  file, in which we can modify the predictors, putting for example
  lm(y~x^2) instead of having lm(y~x) as in the original model.
  
  Now, I need to import in R the txt file as a list to evaluate the model.
  Is that possible?
  
  I played around with source() and file() but can't figure it out.
 
  What OS are you using?  When you say the list is in a text file, how is the 
  text file structured, e.g. CSV, TSV, fixed-width, other?
 
  Here's an example of creating, writing, and reading a data.frame:
 
  d - data.frame(cbind(x=1, y=1:10))
  write.table(d, file=r-data.txt, sep=\t, na=, quote=FALSE, row.names = 
  FALSE)
  d.new - read.delim(r-data.txt)
 

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


Re: [R] importing a list

2006-05-10 Thread Marc Schwartz (via MN)
On Wed, 2006-05-10 at 13:19 -0500, Marc Schwartz (via MN) wrote:
 A search for the list2ascii() function, led me to this post by Mike
 Prager:
 
 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66335.html
 
 in which Mike specifically notes:
 
 To write it to a file that can be read by R, I would suggest using 
 dput instead.
 
 
 Thus, instead of using list2ascii() on your list object, use:
 
 sink(YourTextFile)
 dput(YourListObject)
 sink()
 
 You can then re-read the text file back into R using:
 
 source(YourTextFile)

Actually, quick correction here. That should be:

  NewListObject - dget(YourTextFile)

dget() will enable simple assignment of the textual input, whereas
source() will just evaluate it and assignment with source() creates a
list object, unless you use:
  
  NewListObject - source(YourTextFile)$value

Marc

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


Re: [R] attach() warning message

2006-05-10 Thread Duncan Murdoch
On 5/10/2006 2:02 PM, J.M. Breiwick wrote:
 Hi,
 
 I am using R 2.3.0 and my .First() file has the following line which causes 
 a warning:
 attach(what=c:/r/jmb/.RData, pos=3)
 
 I get the following message after .First() is loaded:
 
 During startup - Warning message:
 use of NULL environment is deprecated
 
 Is there a simple fix that will eliminate this warning message? Thanks.

This probably means you have some binary objects in your .RData which 
were produced under an earlier version of R and will not be compatible 
with R 2.4.x.  I think it will continue to make automatic conversions 
(we strive to be able to read old binary versions), but the automatic 
conversions might not be correct.

There are two things to do:

The simplest one is to ignore the warning, save your data from R 2.3.0, 
and hope that the automatic corrections were successful.  I recommend 
you backup the old file first, and test carefully afterwards.

A better solution is to load your .RData in the version of R that was 
used to create it, dump it in text format (using the dump() function), 
and then reload it into R 2.3.0 using source().  It is possible that 
this will create very small changes to some numerical values, since I 
don't think we guarantee that the text representation is always parsed 
to identical values.

If you've got a mixture of old and new items (because you have added new 
things), you may not be able to do this:  the old version of R may not 
be able to read the file.  In that case you can try dump() from R 2.3.0, 
  hoping that the automatic fixups were correct; you can look over the 
file (if it's not too large) to check.

In future, I'd recommend that you don't keep things in binary format; R 
changes, and you might run into this sort of problem again.  We try to 
keep backwards compatibility, but it's not always possible.

Duncan Murdoch

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


Re: [R] importing a list

2006-05-10 Thread grazia
Marc,
it's perfect
THANKS a lot for your help.
grazia

On Wed, 10 May 2006, Marc Schwartz (via MN) wrote:

 On Wed, 2006-05-10 at 13:19 -0500, Marc Schwartz (via MN) wrote:
 A search for the list2ascii() function, led me to this post by Mike
 Prager:

 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66335.html

 in which Mike specifically notes:

 To write it to a file that can be read by R, I would suggest using
 dput instead.


 Thus, instead of using list2ascii() on your list object, use:

 sink(YourTextFile)
 dput(YourListObject)
 sink()

 You can then re-read the text file back into R using:

 source(YourTextFile)

 Actually, quick correction here. That should be:

  NewListObject - dget(YourTextFile)

 dget() will enable simple assignment of the textual input, whereas
 source() will just evaluate it and assignment with source() creates a
 list object, unless you use:

  NewListObject - source(YourTextFile)$value

 Marc



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


[R] command completion?

2006-05-10 Thread Robert Citek

Does R have command or object name completion?

R has several functions of modern shells built into it e.g. history  
mechanism, command-line editing, emacs key bindings.  However, it  
doesn't seem to have command or object name completion.  For example,  
in bash I can begin typing a command and then press the tab key to  
have the shell fill in the rest of the command (works for environment  
variables and filenames, too).  Does command completion exist and I'm  
not using it correctly or don't have it turned on, or is it really  
not there?

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

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


[R] integer vector to a string

2006-05-10 Thread Søren Merser
hi there
is there a way that i can coerce a vector of integers to ONE  string with 
the numbers comma separated like:
1:500  -1,2,3, ..., 500

i've tried deparse, but it divides the result into a vector of string 
(depending on the setting of width with a max of 500)

regards soren

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


Re: [R] command completion?

2006-05-10 Thread Duncan Murdoch
On 5/10/2006 2:52 PM, Robert Citek wrote:
 Does R have command or object name completion?
 
 R has several functions of modern shells built into it e.g. history  
 mechanism, command-line editing, emacs key bindings.  However, it  
 doesn't seem to have command or object name completion.  For example,  
 in bash I can begin typing a command and then press the tab key to  
 have the shell fill in the rest of the command (works for environment  
 variables and filenames, too).  Does command completion exist and I'm  
 not using it correctly or don't have it turned on, or is it really  
 not there?

It's not there, because some of the shells that run R supply it. I don't 
use one, but I think a couple of the popular ones are ESS and the Mac OS 
GUI.

It would be a nice addition to the Windows GUI, but I don't know anyone 
who is working on it.  I don't think it would be a welcome change to the 
console versions; some of them use readline's filename completion which 
would almost certainly be broken by this.  Others need to run under ESS.

Duncan Murdoch

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


Re: [R] integer vector to a string

2006-05-10 Thread Duncan Murdoch
On 5/10/2006 2:49 PM, Søren Merser wrote:
 hi there
 is there a way that i can coerce a vector of integers to ONE  string with 
 the numbers comma separated like:
 1:500  -1,2,3, ..., 500
 
 i've tried deparse, but it divides the result into a vector of string 
 (depending on the setting of width with a max of 500)

paste(1:500, collapse=,)

Duncan Murdoch

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


Re: [R] integer vector to a string

2006-05-10 Thread Peter Dalgaard
Søren Merser [EMAIL PROTECTED] writes:

 hi there
 is there a way that i can coerce a vector of integers to ONE  string with 
 the numbers comma separated like:
 1:500  -1,2,3, ..., 500
 
 i've tried deparse, but it divides the result into a vector of string 
 (depending on the setting of width with a max of 500)

paste(1:500, collapse=,)

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


Re: [R] integer vector to a string

2006-05-10 Thread Dimitrios Rizopoulos
probably you need ?paste, e.g.,

paste(1:500, collapse = ,)

I hope it helps.

Best,
Dimitris


Quoting Søren Merser [EMAIL PROTECTED]:

 hi there
 is there a way that i can coerce a vector of integers to ONE  string
 with 
 the numbers comma separated like:
 1:500  -1,2,3, ..., 500
 
 i've tried deparse, but it divides the result into a vector of string
 
 (depending on the setting of width with a max of 500)
 
 regards soren
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Jan T. Kim
On Wed, May 10, 2006 at 12:56:23PM -0400, Duncan Murdoch wrote:
 On 5/10/2006 12:15 PM, Jan T. Kim wrote:
  On Wed, May 10, 2006 at 11:26:55AM -0400, Duncan Murdoch wrote:
  On 5/10/2006 11:10 AM, Gabor Grothendieck wrote:
   On 5/10/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
  
   What is it that you find objectionable about having a default for the
   file argument in read.table?  I think Martin has said that he doesn't
   want non-UI functions to be involved with UI functions, but I don't see
   that:  if your code works now, it will be completely unaffected by
   setting a default for the argument.  (Sorry if I summarized the argument
   incorrectly, Martin, I didn't look it up.)
   
   That would be my objection too.  UI should not be tied to the non-UI 
   core.
   Its basically a loose coupling argument.
  
  I don't accept that argument, because in R everything* is interactive. 
  There isn't a non-UI core.  The function arguments are part of the user 
  interface.
  
  It seems to me that there might be a misunderstanding here; as the term
  user is used to refer to a person interacting with the computer on
  the one hand, and to refer to a programmer using R on the other hand.
 
 One of the design goals of S and R is to blur the distinction between 
 users and programmers.  It is a continuum.  R is designed to gently urge 
 non-programmers to become programmers, because the designers think 
 that's the way statistical computing should be done.

That's an idea I like very much too -- much better than the currently
popular idea of protecting users from the unfriendliness of
programming, anyway...

  Everything being part of the user interface, in the sense of
  every user-visible function being part of the API, does not and should
  not imply that everything should be interactive.
 
 No, I didn't suggest that.  What I was suggesting is that it should be 
 *convenient* to use read.table interactively, not that it should be 
 required.  (It's already possible, but not convenient, especially for a 
 beginner who doesn't know the secret incantation.)

Well, not knowing a secret is always inconvenient...  ;-)

  In my experience, interactivity is a rather double-edged thing: On the
  one hand, it facilitates learning and exploration, but on the other
  hand, its improper use is frequently detrimental to reproducibility of
  scientific computation.
 
 I definitely agree with that.  It should be convenient to use R 
 non-interactively as well.  Anyone who wants reproducibility should be 
 writing packages and scripts or vignettes that run non-interactively. 

Ok, I fully agree with this -- seems that I've interpreted the statement
that in R everything is interactive a bit too narrowly.

 That's why I am emphasizing that this change will have no effect on 
 existing code.  I wouldn't suggest it if it did.

That's an important point too, obviously.

I'm not entirely convinced about the convenience aspect, as I find file
choosers of all sorts disruptive to workflow... but that's perhaps a
matter of personal taste.

Best regards, Jan
-- 
 +- Jan T. Kim ---+
 | email: [EMAIL PROTECTED]   |
 | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=  hierarchical systems are for files, not for humans  =-*

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


[R] Courses - R/Splus Advanced Programming ***by the R Development Core Tean Guru In Seattle and San Francisco ***June/July***

2006-05-10 Thread elvis


   XLSolutions  Corporation  ([1]www.xlsolutions-corp.com)  is  proud  to
   announce
   our***   R/S  Advanced  Programming  ***courses  in  Seattle  and  San
   Francisco
   this summer by the R Development Core Team Guru!

   (1) R/Splus Advanced Programming *** Seattle/June 8-9, 2006 ***

   ***  San  Francisco / July 13-14, 2006
   ***

  [2]http://www.xlsolutions-corp.com/Radv.htm
   (2) R/Splus Fundamentals and Programming Techniques
  *** Boston / June 29-30, 2006***
   *** Seattle/June 5-6, 2006 ***
  [3]http://www.xlsolutions-corp.com/Rfund.htm
   Ask for group discount and reserve your seat Now - Earlybird Rates.
   Payment due after theclass!EmailSueTurner:
   [EMAIL PROTECTED]
   (1) R/Splus Advanced Programming

   Course Outline:

   - Overview of R/S fundamentals: Syntax and Semantics
   - Class and Inheritance in R/S-Plus
   - Concepts, Construction and good use of language objects
   - Coercion and efficiency
   - Object-oriented programming in R and S-Plus
   - Advanced manipulation tools: Parse, Deparse, Substitute, etc.
   - How to fully take advantage of Vectorization
   - Generic and Method Functions
   - Search path, databases and frames Visibility
   - Working with large objects
   - Handling Properly Recursion and iterative calculations
   - Managing loops; For (S-Plus) and for() loops
   - Consequences of Lazy Evaluation
   - Efficient Code practices for large computations
   - Memory management and Resource monitoring
   - Writing R/S-Plus functions to call compiled code
   - Writing and debugging compiled code for R/S-Plus system
   - Connecting R/S-Plus to External Data Sources
   - Understanding the structure of model fitting functions in R/S-Plus
   - Designing and Packaging efficiently a new model function
   It'll also deal with lots of S-Plus efficiency issues and any special
   topics from participants is welcome.

   (2) R/Splus Fundamentals and Programming Techniques

   Course outline.

   - An Overview of R and S
   - Data Manipulation and Graphics
   - Using Lattice Graphics
   - A Comparison of R and S-Plus
   - How can R Complement SAS?
   - Writing Functions
   - Avoiding Loops
   - Vectorization
   - Statistical Modeling
   - Project Management
   - Techniques for Effective use of R and S
   - Enhancing Plots
   - Using High-level Plotting Functions
   - Building and Distributing Packages (libraries)
   - Connecting; ODBC, Rweb, Orca via sockets and via Rjava

   Email us for group discounts.
   Email Sue Turner: [EMAIL PROTECTED]
   Phone: 206-686-1578
   Visit us: [6]www.xlsolutions-corp.com/training.htm
   Please let us know if you and your colleagues are interested in this
   class to take advantage of group discount. Register now to secure your
   seat!

   Cheers,
   Elvis Miller, PhD
   Manager Training.
   XLSolutions Corporation
   206 686 1578
   [7]www.xlsolutions-corp.com
   [EMAIL PROTECTED]
   2 Courses - (1) R/Splus Advanced Programming (2) R/Splus Fundamentals

References

   1. http://www.xlsolutions-corp.com/
   2. http://www.xlsolutions-corp.com/Radv.htm
   3. http://www.xlsolutions-corp.com/Rfund.htm
   4. mailto:[EMAIL PROTECTED]
   5. mailto:[EMAIL PROTECTED]
   6. http://www.xlsolutions-corp.com/training.htm
   7. http://www.xlsolutions-corp.com/
   8. mailto:[EMAIL PROTECTED]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Can't there be a cd command?

2006-05-10 Thread Manuel López-Ibáñez
Jan T. Kim wrote:
 
 That's an idea I like very much too -- much better than the currently
 popular idea of protecting users from the unfriendliness of
 programming, anyway...
 

It is just my opinion that the amount of mail in R-help speaks volumes 
about the current friendliness [1], or lack thereof, of R. Perhaps I 
am just the only one who thinks this way...

[1] http://en.wikipedia.org/wiki/Usability


__ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com

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


Re: [R] command completion?

2006-05-10 Thread François Pinard
[Duncan Murdoch]
[Robert Citek]

 Does R have command or object name completion?

[...] I don't think it would be a welcome change to the console 
versions; some of them use readline's filename completion which would 
almost certainly be broken by this.

We have to put things in perspective, here.  In my opinion, object name 
completion would be a lot more useful than filename completion, because 
in R, we name R objects much more often than we name files.

Others need to run under ESS.

While this is a good things for Emacs lovers, the requirement is rather 
unwelcome for pagans!  :-)

-- 
François Pinard   http://pinard.progiciels-bpi.ca

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


Re: [R] command completion?

2006-05-10 Thread Berton Gunter
Is the following a fortunes package candidate?


 Others need to run under ESS.
 
 While this is a good things for Emacs lovers, the requirement 
 is rather 
 unwelcome for pagans!  :-)
 
 -- 
 François Pinard   http://pinard.progiciels-bpi.ca
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


:-)

-- Bert

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Greg Snow
When talking about user friendlyness of computer software I like the analogy of 
cars vs. busses:

Busses are very easy to use, you just need to know which bus to get on, where 
to get on, and where to get off (and you need to pay your fare).  Cars on the 
other hand require much more work, you need to have some type of map or 
directions (even if the map is in your head), you need to put gas in every now 
and then, you need to know the rules of the road (have some type of drivers 
licence).  The big advantage of the car is that it can take you a bunch of 
places that the bus does not go and it is quicker for some trips that would 
require transfering between busses.

Using this analogy programs like SPSS are busses, easy to use for the standard 
things, but very frustrating if you want to do something that is not already 
preprogrammed.

R is a 4-wheel drive SUV (though environmentally friendly) with a bike on the 
back, a kayak on top, good walking and running shoes in the pasenger seat, and 
mountain climbing and spelunking gear in the back.

R can take you anywhere you want to go if you take time to leard how to use the 
equipment, but that is going to take longer than learning where the bus stops 
are in SPSS.

Now there are tools like Rcmdr that help get you started (maybe a gps unit in 
the R suv above), but if we make R too user friendly then we limit what can be 
done with it.

I think the volume of mail in R-help is partly due to lack of friendliness, but 
a lot of it is due to the flexibility as well, if it did less, there would be 
less to learn and ask questions about.  I for one prefer to do a little more 
work learning the program in exchange for being able to do a lot more with it.


To mangle a famous Einstien quote:  Statistical packages should be made as 
user friendly as possible, but no friendlier.

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

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manuel 
López-Ibáñez
Sent: Wednesday, May 10, 2006 2:19 PM
To: r-help@stat.math.ethz.ch
Subject: Re: [R] Can't there be a cd command?

Jan T. Kim wrote:
 
 That's an idea I like very much too -- much better than the currently 
 popular idea of protecting users from the unfriendliness of 
 programming, anyway...
 

It is just my opinion that the amount of mail in R-help speaks volumes about 
the current friendliness [1], or lack thereof, of R. Perhaps I am just the 
only one who thinks this way...

[1] http://en.wikipedia.org/wiki/Usability


__
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com

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

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


Re: [R] command completion?

2006-05-10 Thread Achim Zeileis
On Wed, 10 May 2006 13:26:32 -0700 Berton Gunter wrote:

 Is the following a fortunes package candidate?

...promoted to fortunes package member in the devel-version.

thx,
Z

 
  Others need to run under ESS.
  
  While this is a good things for Emacs lovers, the requirement 
  is rather 
  unwelcome for pagans!  :-)
  
  -- 
  François Pinard   http://pinard.progiciels-bpi.ca
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
  
 
 
 :-)
 
 -- Bert
 


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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Berton Gunter

...another fortunes package candidate? I especially liked the sections
beginning R is a 4 wheel drive SUV..., but a lot of it is great IMHO. Well
said! Bestimmt!

-- Bert

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Greg Snow
 Sent: Wednesday, May 10, 2006 1:37 PM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] Can't there be a cd command?
 
 When talking about user friendlyness of computer software I 
 like the analogy of cars vs. busses:
 
 Busses are very easy to use, you just need to know which bus 
 to get on, where to get on, and where to get off (and you 
 need to pay your fare).  Cars on the other hand require much 
 more work, you need to have some type of map or directions 
 (even if the map is in your head), you need to put gas in 
 every now and then, you need to know the rules of the road 
 (have some type of drivers licence).  The big advantage of 
 the car is that it can take you a bunch of places that the 
 bus does not go and it is quicker for some trips that would 
 require transfering between busses.
 
 Using this analogy programs like SPSS are busses, easy to use 
 for the standard things, but very frustrating if you want to 
 do something that is not already preprogrammed.
 
 R is a 4-wheel drive SUV (though environmentally friendly) 
 with a bike on the back, a kayak on top, good walking and 
 running shoes in the pasenger seat, and mountain climbing and 
 spelunking gear in the back.
 
 R can take you anywhere you want to go if you take time to 
 leard how to use the equipment, but that is going to take 
 longer than learning where the bus stops are in SPSS.
 
 Now there are tools like Rcmdr that help get you started 
 (maybe a gps unit in the R suv above), but if we make R too 
 user friendly then we limit what can be done with it.
 
 I think the volume of mail in R-help is partly due to lack of 
 friendliness, but a lot of it is due to the flexibility as 
 well, if it did less, there would be less to learn and ask 
 questions about.  I for one prefer to do a little more work 
 learning the program in exchange for being able to do a lot 
 more with it.
 
 
 To mangle a famous Einstien quote:  Statistical packages 
 should be made as user friendly as possible, but no friendlier.
 
 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 (801) 408-8111
  
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Manuel 
 López-Ibáñez
 Sent: Wednesday, May 10, 2006 2:19 PM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] Can't there be a cd command?
 
 Jan T. Kim wrote:
  
  That's an idea I like very much too -- much better than the 
 currently 
  popular idea of protecting users from the unfriendliness of 
  programming, anyway...
  
 
 It is just my opinion that the amount of mail in R-help 
 speaks volumes about the current friendliness [1], or lack 
 thereof, of R. Perhaps I am just the only one who thinks this way...
 
 [1] http://en.wikipedia.org/wiki/Usability
 
   
 __
 LLama Gratis a cualquier PC del Mundo. 
 Llamadas a fijos y móviles desde 1 céntimo por minuto. 
 http://es.voice.yahoo.com
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


[R] help with writing output from two different arrays to two columns in an output file

2006-05-10 Thread Arnav Ghosh
Hi,
   I am very new to R and I have written the following block of code to
generate a gamma distribution for variable x (which is an array) and a
function y whose array values depend on the individual array values of
x.
The code is as follows:
n=1000
x=rgamma(n,1.5,2)
y=vector(numeric,n)
for (i in 1:n){
y[i]=(2937/5*exp(-1/1000*x[i])/x[i])
}
now I want to know how I can use write/write.data or anything similar to
write the output from x[i] and y[i] to two different colums simultaneously
in an output file (say output.txt).

Thanks in advance,
Arnav

[[alternative HTML version deleted]]

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


[R] Unique?

2006-05-10 Thread Guenther, Cameron

Hello,
I have sample data set that looks like:

YEARMONTH   DAY CONTINUESPL TIMEFISH
TIMEUNITAREACOUNTY  DEPTH   DEPUNIT GEARTRIPID
CONVUNIT
19921   26  1   SP0073928   8
H   7   25  4   NA  100
02163399054 161
19921   26  1   SP0073928   8
H   7   25  4   NA  100
02163399054 8
19921   26  2   SP0004228   8
H   7   25  4   NA  100
02163399054 161
19921   26  2   SP0004228   8
H   7   25  4   NA  100
02163399054 8
19921   25  NA  SP0052652   8
H   7   25  4   NA  100
02163399057 85
19921   26  NA  SP0037940   8
H   7   25  4   NA  100
02163399058 70
19921   27  NA  SP0072357   8
H   7   25  4   NA  100
02163399059 15
19921   27  NA  SP0072357   8
H   7   25  4   NA  100
02163399059 20
19921   27  NA  SP0026324   8
H   7   25  4   NA  100
02163399060 8
19921   28  1   SP0072357   8
H   7   25  4   NA  100
02163399062 200

How can I use unique to extract the rows that have repeated tripid's
only, not a unique value for each variable but only for TRIPID.  I then
want to condense the unique values by summing the CONVUNIT for each
unique value of TRIPID.  I posted a similar question last week and
received a sufficient answer of how to do this without using uniqe.  The
solution below worked just fine on this sample data set but the full
data set has 446,000 rows of data and my computer and R simply cannot
handle this follwing code on data this large.

conds-by(Step4,Step4$TRIPID,function(x)
replace(x[1,],CONVUNIT,sum(x$CONVUNIT)))
Step5-do.call(rbind,conds)

Thank you,

Cameron Guenther, Ph.D. 
Associate Research Scientist
FWC/FWRI, Marine Fisheries Research
100 8th Avenue S.E.
St. Petersburg, FL 33701
(727)896-8626 Ext. 4305
[EMAIL PROTECTED]

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Achim Zeileis
On Wed, 10 May 2006 13:51:06 -0700 Berton Gunter wrote:

 ...another fortunes package candidate?

Hehe, yes, this time I was quicker ;-)

 I especially liked the sections
 beginning R is a 4 wheel drive SUV..., but a lot of it is great
 IMHO. Well said!

Indeed.

 Bestimmt!

Ja, das auch...
Z

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


[R] Splines?

2006-05-10 Thread Myers, Brent
I think I have a spline problem, and I would like to implement the
solution in S. There are a lot of spline algorithms and I am looking for
some direction on what is most appropriate. I need a spline that can be
made to extrapolate certain data points as described below. Of course it
needs to happen algorithmically as I have lots of this data. Can a
Bezier be fit to data?

 

Consider a material volume sampled in discrete non-uniform intervals.
There is a continuous trend in properties that is integrated over each
interval. We are aware of the specific form of the continuous trend, but
it is concealed by the interval nature of the data. The specific need is
to identify the 'true' location and value of the minima and maxima of
the function representing the data. Perhaps an example...

 

In the following figure, the numbers represent the sampled layers: the
height of the bars is the value of the sampled property. The x axis is
depth into the material volume. The asterisk represents the true value
and location of the minima and maxima. We know that they are lower and
higher than the interval sampled data, and (critically) that the value
of the maxima or maxima is offset from the center of the sampled volume,
depending on the trajectory of the change between sampled layers.
Perhaps you can imagine a smooth line connecting the asterisks which
preserves the area of the corresponding bars. 

 

  *

  

 3

 3

*3 *

 3 444

 222 3 444 5*5

 2*2 3 444 555 6*6

 222 3 444 555 666

 


[[alternative HTML version deleted]]

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


Re: [R] Unique?

2006-05-10 Thread Robert Citek

On May 10, 2006, at 4:02 PM, Guenther, Cameron wrote:
 How can I use unique to extract the rows that have repeated tripid's
 only, not a unique value for each variable but only for TRIPID.  I  
 then
 want to condense the unique values by summing the CONVUNIT for each
 unique value of TRIPID.

Thanks, Cameron, for this question.  This type of manipulation would  
be relatively simple to do in a RDBMS (e.g. MySQL, PostgreSQL,  
Oracle, etc.)  But I'm curious to see how one would do the same in  
R.  So, if folks send you solutions off-list, please do post them  
back to the list.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

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


Re: [R] help with writing output from two different arrays to two columns in an output file

2006-05-10 Thread Robert Citek

Hello Arnav,

On May 10, 2006, at 3:56 PM, Arnav Ghosh wrote:
 The code is as follows:
 n=1000
 x=rgamma(n,1.5,2)
 y=vector(numeric,n)
 for (i in 1:n){
 y[i]=(2937/5*exp(-1/1000*x[i])/x[i])
 }
 now I want to know how I can use write/write.data or anything  
 similar to
 write the output from x[i] and y[i] to two different colums  
 simultaneously
 in an output file (say output.txt).

One way would be to create a data frame.  I tend to think of  
data.frames like sheets in a spreadsheet or tables in a database.   
Once you have your data in a data.frame, then you could write to/read  
from a file.  For example, within R:

# create the data.frame
myDataFrame - data.frame(x,y)
# write it to a file
write.table(myDataFrame, file = output.txt)
# read it from a file into a new data.frame
newDataFrame - read.table(output.txt)

BTW, one new resource I discovered was the wiki.  The page you may be  
interested in:

http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:import_table

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

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


[R] Keeping scientific format on assignment

2006-05-10 Thread Joe Byers

I am new to R and can't seem to find and answer for this after search CRAN.

I am calculating Box-Ljung stats over the lags 1-25 to build a table
from the acf and pacf statistics.  I want to retrieve the p-value from
the box.test data frame and assign it in a vector.  The problem is with
the assignment that truncates the p-value to 0.  For example, the
box.test object has a p-value of 2e-14 when I do
a-box.test.object$p-value;
a;
the value of a is 0 not 2e-14.

How do I keep the precision and format of the p-value.  I have tried
as.numeric(...), changing options (digits and sciprec), and can't seem
to figure it out.

Thank you
Joe



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

[R] Concatenating data frame

2006-05-10 Thread Charles Cheung
Hello, I have searched through the R-help archive and find that the easiest 
way to concatenate data records in a dataframe is to use rbind()


I know we can do that using rbind, but it is slow when we are doing rbind 
thousands of times to a growing list, each time adding one or two records to 
the ever growing existing data because in

existingRecords-rbind(existingRecords, aNewRecordToBeAdded),

I am making a copy of the data each time rbind is called!

Is there a way to avoid these data copying?


Thank you in advance!

Charles

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


[R] Legend titles in log plots broken? (ver. 2.2.1)

2006-05-10 Thread Rob Steele
Legend titles work in linear plots:

curve(1/x, xlim = c(0, 1))
legend(x = 'topright', inset = 0.04,
legend = '1/x', lty = 1,
title = 'Legend Title')

But when you change to a log plot on either dimension things get screwy:

curve(1/x, xlim = c(0, 1), log = 'y')
legend(x = 'topright', inset = 0.04,
legend = '1/x', lty = 1,
title = 'Legend Title')

If you save the value legend() returns you can look at it and see that 
it's messed up:

l - legend(x = 'topright', inset = 0.04,
 legend = '1/x', lty = 1,
 title = 'Legend Title')

  l
$rect
$rect$w
[1] 0.2349272

$rect$h
[1] 0.2727899

$rect$left
[1] 0.7618728

$rect$top
[1] 1.9936


$text
$text$x
[1] 0.9188374

$text$y
[1] 1.81174


  R.Version()
$platform
[1] i686-redhat-linux-gnu

$arch
[1] i686

$os
[1] linux-gnu

$system
[1] i686, linux-gnu

$status
[1] 

$major
[1] 2

$minor
[1] 2.1

$year
[1] 2005

$month
[1] 12

$day
[1] 20

$svn rev
[1] 36812

$language
[1] R

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


Re: [R] Unique?

2006-05-10 Thread Francisco J. Zagmutt
If you only care about the sum of CONVUNIT by each TRIPID then you can use 
tapply i.e.:

step4-data.frame(TRIPID=rep(c(111,222,333),3),CONVUNIT=rpois(9,40))
result-tapply(step4$CONVUNIT,INDEX=step4$TRIPID,FUN=sum)
result
111 222 333
115 107 123

Is this what you wanted to do?  I can't think of anything faster than tapply 
for your problem.

I hope this helps

Francisco




From: Guenther, Cameron [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] Unique?
Date: Wed, 10 May 2006 17:02:33 -0400


Hello,
I have sample data set that looks like:

YEAR   MONTH   DAY CONTINUESPL TIMEFISH
TIMEUNIT   AREACOUNTY  DEPTH   DEPUNIT GEARTRIPID
CONVUNIT
1992   1   26  1   SP0073928   8
H  7   25  4   NA  100
02163399054161
1992   1   26  1   SP0073928   8
H  7   25  4   NA  100
021633990548
1992   1   26  2   SP0004228   8
H  7   25  4   NA  100
02163399054161
1992   1   26  2   SP0004228   8
H  7   25  4   NA  100
021633990548
1992   1   25  NA  SP0052652   8
H  7   25  4   NA  100
0216339905785
1992   1   26  NA  SP0037940   8
H  7   25  4   NA  100
0216339905870
1992   1   27  NA  SP0072357   8
H  7   25  4   NA  100
0216339905915
1992   1   27  NA  SP0072357   8
H  7   25  4   NA  100
0216339905920
1992   1   27  NA  SP0026324   8
H  7   25  4   NA  100
021633990608
1992   1   28  1   SP0072357   8
H  7   25  4   NA  100
02163399062200

How can I use unique to extract the rows that have repeated tripid's
only, not a unique value for each variable but only for TRIPID.  I then
want to condense the unique values by summing the CONVUNIT for each
unique value of TRIPID.  I posted a similar question last week and
received a sufficient answer of how to do this without using uniqe.  The
solution below worked just fine on this sample data set but the full
data set has 446,000 rows of data and my computer and R simply cannot
handle this follwing code on data this large.

conds-by(Step4,Step4$TRIPID,function(x)
replace(x[1,],CONVUNIT,sum(x$CONVUNIT)))
Step5-do.call(rbind,conds)

Thank you,

Cameron Guenther, Ph.D.
Associate Research Scientist
FWC/FWRI, Marine Fisheries Research
100 8th Avenue S.E.
St. Petersburg, FL 33701
(727)896-8626 Ext. 4305
[EMAIL PROTECTED]

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

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


Re: [R] Unique?

2006-05-10 Thread Dave Armstrong
Dear Cameron,

This is not with unique, but it gets the job done.  Just create a new
variable that is the three variables concatenated together.  Then, you can
just sum by this variable, like the following:

mymat - matrix(letters, ncol=3, nrow=260)
mymat - as.data.frame(mymat)
mymat$dat - rnorm(260)
mymat$id - paste(mymat[,1], mymat[,2], mymat[,3])
aggregate(mymat$dat, list(mymat$id), sum)

HTH,
Dave.

On 5/10/06, Robert Citek [EMAIL PROTECTED] wrote:


 On May 10, 2006, at 4:02 PM, Guenther, Cameron wrote:
  How can I use unique to extract the rows that have repeated tripid's
  only, not a unique value for each variable but only for TRIPID.  I
  then
  want to condense the unique values by summing the CONVUNIT for each
  unique value of TRIPID.

 Thanks, Cameron, for this question.  This type of manipulation would
 be relatively simple to do in a RDBMS (e.g. MySQL, PostgreSQL,
 Oracle, etc.)  But I'm curious to see how one would do the same in
 R.  So, if folks send you solutions off-list, please do post them
 back to the list.

 Regards,
 - Robert
 http://www.cwelug.org/downloads
 Help others get OpenSource software.  Distribute FLOSS
 for Windows, Linux, *BSD, and MacOS X with BitTorrent

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




--
Dave Armstrong
University of Maryland
Dept of Government and Politics
3140 Tydings Hall
College Park, MD 20742
Office: 2103L Cole Field House
Phone: 301-405-9735
e-mail: [EMAIL PROTECTED]
web: www.davearmstrong-ps.com

Facts are meaningless.  You can use facts to prove anything that's even
remotely true. - Homer Simpson

To this day, philosophers suffer from Plato's disease: the assumption that
reality fundamentally consists of
abstract essences best described by words or geometry. (In truth, reality is
largely a probabilistic affair best
described by statistics) - Steve Sailer The Unexpected Uselessness of
Philosophy

[[alternative HTML version deleted]]

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


Re: [R] Concatenating data frame

2006-05-10 Thread jim holtman
Put the intermediate results in a list and then use do.call:

result - list()
for (i in 1:100){
result[[i]] - data.frame(id=sample(letters,1), value=i)
}
newDataFrame - do.call('rbind', result)




On 5/10/06, Charles Cheung [EMAIL PROTECTED] wrote:

 Hello, I have searched through the R-help archive and find that the
 easiest
 way to concatenate data records in a dataframe is to use rbind()


 I know we can do that using rbind, but it is slow when we are doing rbind
 thousands of times to a growing list, each time adding one or two records
 to
 the ever growing existing data because in

 existingRecords-rbind(existingRecords, aNewRecordToBeAdded),

 I am making a copy of the data each time rbind is called!

 Is there a way to avoid these data copying?


 Thank you in advance!

 Charles

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




--
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What the problem you are trying to solve?

[[alternative HTML version deleted]]

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


[R] post hoc comparison in repeated measure

2006-05-10 Thread array chip
I haven't heard from anyone with my previous post. I
guess I should post my dataset and my code here:

The dataset has one factor as treatment with 4 levels
(treatment1, treatment2, treatment3 and control), and
another factor as time (36 time points). On average
Each treatment group has 10 subjects with each
followed up at each time points. The response variable
is numeric, serum protein amount. So the between
subject factor is treatment, and the within subject
factor is time. I ran a 2-way ANOVA without
interaction with repeated measures considering time as
the within subject factor:

dat-read.table(dat.txt, sep='\t', header=T,
row.names=1)

attach(dat)
## run aov:
fit-aov(x~as.factor(treatment)+as.factor(Time)+Error(as.factor(animal)))
summary(fit)

## it should produce a ANOVA table as follow:

Error: as.factor(animal)
 Df  Sum Sq Mean Sq F value 
Pr(F)  
as.factor(treatment)  3 1405900  468633  3.0584
0.04051 *
Residuals36 5516274  153230   
  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.'
0.1 ' ' 1 

Error: Within
  Df   Sum Sq  Mean Sq F value   
Pr(F)
as.factor(Time)   35  7298866   208539  22.796 
2.2e-16 ***
Residuals   1365 12487181 9148
 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.'
0.1 ' ' 1 

As you can see, the treatnment effect is marginally
significant. So I decided to do all pairwise
comparisons on treatments at each time point using t
tests. I tried 2 ways to do the t tests: one is the
regular t tests, i.e. only using the data in
comparison at each time point for t test computation,
then yes, I do see a lot of significant comparisons;
the 2nd approach is to use the MSE from ANOVA (i.e.
153230) as the error term for t test calculation; then
I don't see any significant comparisons which I think
is inconsistent with the marginally significant p
value (0.04) for treatment main effect. Below is my
code, did I do something wrong here, or my assumption
above is not right: significant main effect doesnot
necessarily mean at least one pairwise comparisons
must be significant.

## to do pairwise regular t test:
pval-list()
for (j in seq(5,180,5) ) {
pval[[as.character(j)]]-pairwise.t.test(dat2$x[dat2$Time==j],dat2$treatment[dat2$Time==j],pool.sd=F,var.equal=T,p.adjust.method='none')$p.value
}
sort(unlist(pval)[!is.na(unlist(pval))])

## as you can see, there are indeed many significant
pairwise comparisons

## to do pairwise t tests using MSE from ANOVA
pval - NULL
for (i in 1:3) {
for (k in (i+1):4) {
for (j in seq(5,180,5) ) {
   
## ANOVA post test
pval - c(pval,
2*(1-pt(abs(mean(x[Time==jtreatment==k])-mean(x[Time==jtreatment==i]))/sqrt(153230*(1/sum(treatment[Time==j]==i)+1/sum(treatment[Time==j]==k))),
df=sum(treatment[Time==j]==i)+sum(treatment[Time==j]==k)-2)))

}
}
}   
sort(pval)
## As you can see, none of the p values is significant

Can anyone explain?

Thanks

BTW, is there a R function that can do post hoc
comparison on repeated measure ANOVA (from avo()
with Error term)?



__


x   Timeanimal  treatment
1   498 5   1   1
2   411 10  1   1
3   317 15  1   1
4   276 20  1   1
5   256 25  1   1
6   289 30  1   1
7   149 35  1   1
8   261 40  1   1
9   224 45  1   1
10  178 50  1   1
11  199 55  1   1
12  211 60  1   1
13  334 65  1   1
14  286 70  1   1
15  199 75  1   1
16  323 80  1   1
17  125 85  1   1
18  77  90  1   1
19  236 95  1   1
20  191 100 1   1
21  72  105 1   1
22  192 110 1   1
23  317 115 1   1
24  288 120 1   1
25  148 125 1   1
26  104 130 1   1
27  59  135 1   1
28  68  140 1   1
29  181 145 1   1
30  177 150 1   1
31  142 155 1   1
32  251 160 1   1
33  110 165 1   1
34  156 170 1   1
35  112 175 1   1
36  103 180 1   1
37  509 5   2   1
38  371 10  2   1
39  324 15  2   1
40  321 20  2   1
41  353 25  2   1
42  392 30  2   1
43  282 35  2   1
44  256 40  2   1
45  321 45  2   1
46  250 50  2   1
47  371 55  2   1
48  419 60  2   1
49  361 65  2   1
50  359 70  2   1
51  411 75  2   1
52  275 80  2   1
53  231 85  2   1
54  

[R] lattice package plots

2006-05-10 Thread sundlm

I am using the lattice packge for its levelplot and contourplot.  Is it
possible to adjust the line thickness of the 'box' and tickmarks in these 
plots?

Thanks for the attention,
Matt Sundling

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


Re: [R] Concatenating data frame

2006-05-10 Thread Francisco J. Zagmutt
And adding to Jim's solution, you may be able to further improve the speed 
of your code by pre-allocating the list size i.e

result - vector(list,100)
for (i in 1:100){
  result[[i]] - data.frame(id=sample(letters,1), value=i)
}
newDataFrame - do.call('rbind', result)

Cheers

Francisco

From: jim holtman [EMAIL PROTECTED]
To: Charles Cheung [EMAIL PROTECTED]
CC: r-help@stat.math.ethz.ch
Subject: Re: [R] Concatenating data frame
Date: Wed, 10 May 2006 19:02:15 -0400

Put the intermediate results in a list and then use do.call:

result - list()
for (i in 1:100){
 result[[i]] - data.frame(id=sample(letters,1), value=i)
}
newDataFrame - do.call('rbind', result)




On 5/10/06, Charles Cheung [EMAIL PROTECTED] wrote:
 
  Hello, I have searched through the R-help archive and find that the
  easiest
  way to concatenate data records in a dataframe is to use rbind()
 
 
  I know we can do that using rbind, but it is slow when we are doing 
rbind
  thousands of times to a growing list, each time adding one or two 
records
  to
  the ever growing existing data because in
 
  existingRecords-rbind(existingRecords, aNewRecordToBeAdded),
 
  I am making a copy of the data each time rbind is called!
 
  Is there a way to avoid these data copying?
 
 
  Thank you in advance!
 
  Charles
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What the problem you are trying to solve?

   [[alternative HTML version deleted]]

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

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


[R] Contour plot overlayed with line plot

2006-05-10 Thread Jonathan Greenberg
I apologize for what may be a newbie question: I have two sets of data, one
is X,Y,Z data that I'd like to make a contour plot of (Z defining the
contours), and a second set of X,Y data (Y as a function of X) which I would
like made into a line plot OVERLAYED on the contour plot (X and Y from both
plots are in the same units and will have overlapping values).  Any
suggestions on how to do this in R?  Thanks!

--j 

-- 
Jonathan A. Greenberg, PhD
NRC Research Associate
NASA Ames Research Center
MS 242-4
Moffett Field, CA 94035-1000
650-604-5896
AIM: jgrn307
MSN: [EMAIL PROTECTED]

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


Re: [R] nlme plot residuals per group

2006-05-10 Thread Spencer Graves
  Your example is not self contained, and I don't know enough to 
replicate it myself, so I can't tell you what caused it or how to fix 
it.  However, I can outline the type of thing I've often done with this 
kind of problem:

  1.  First, can you get the plots you want using examples from the 
book and distributed with the 'nlme' package?  If no, might that provide 
a simple, self-contained example for a refined post?

  2.  If you get the plots you want from one of the standard examples, 
how does your example that doesn't work differ from the published 
example that does?  That comparison might provide the insight you need 
to solve the problem.  If it doesn't, I would then experiment with both 
my example and the published example until I either solved my problem or 
produced a revision of the published example that illustrated my 
problem.  That revised example might then provide the core for a refined 
post.

  3.  However, if it were me, I'd carry it further, making a local copy 
of the appropriate function, using 'debug', and walking through the code 
line by line until I found where it broke.  By the time I've done this, 
I've typically figured out the problem.  To do this, you need to know 
about the 'method' function, plus possibly 'getAnywhere'.

  hope this helps,
  Spencer Graves

Osman Al-Radi wrote:
 dear list:
 
 I used the nlme library according to the great Pinheiro/Bates book, on
 R2.3, WinXp
 
 Lac.lme is an lme object with unbalanced data, group is a factor
 variable with three levels, when I tried to plot the residuals by
 group I got this error msg:
 
 plot(Lac.lme,resid(.,type='p')~fitted(.)|group)
 Error in limits.and.aspect(prepanel.default.xyplot, prepanel = prepanel,  :
 need at least one panel
 
 Also When I try to use the auPred() function I get the follwoing error msg:
 plot(augPred(Lac.lme))
 Error in tapply(as.character(object[[nm]]), groups, FUN[[dClass]]) :
 arguments must have same length
 
 Any suggestions?
 
 Thanks
 
 
 --
 Osman O. Al-Radi, MD, MSc, FRCSC
 Fellow, Cardiovascular Surgery
 The Hospital for Sick Children
 University of Toronto, Canada
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] Can't there be a cd command?

2006-05-10 Thread Robert Citek

On May 10, 2006, at 3:37 PM, Greg Snow wrote:
 R is a 4-wheel drive SUV (though environmentally friendly) with a  
 bike on the back, a kayak on top, good walking and running shoes in  
 the pasenger seat, and mountain climbing and spelunking gear in the  
 back.

But mapping R to a SUV makes R sound too much like a car, which many  
people know how to drive.  That is, someone who knows how to drive a  
car pretty much knows how to drive an SUV.  The SUV analogy implies  
that someone who knows another computer languages, e.g C, perl, VB,  
Java, SQL, would be able to use R.  Unfortunately, that is in all  
likelihood not the case.  R has a rather specialized syntax it uses  
to manipulate data.  It's not like C or perl or VB or Java or SQL.   
So, knowing those languages helps a little but not much.

Because of that, I would say R is more like a helicopter, a HUEY  
perhaps.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

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


Re: [R] post hoc comparison in repeated measure

2006-05-10 Thread Richard M. Heiberger
This is how I would do it.


arraychip - read.table(arraychip.dat, sep='\t',
header=T, row.names=1)
for (i in 2:4) arraychip[[i]] - factor(arraychip[[i]])


## run aov:
fit - aov(x ~ treatment + Time + Error(animal), data=arraychip)
summary(fit)

## single stratum for the same ANOVA
fit2 - aov(x ~ treatment + animal + Time, data=arraychip)
summary(fit2)

trt.means - model.tables(fit2, cterms=treatment, type=means)
treat.means - as.vector(trt.means$tables$treatment)
treat.n - as.vector(trt.means$n$treatment)
names(treat.means) - levels(arraychip$treatment)


## this expression works in R and S-Plus
mi.mj - outer(treat.means, treat.means, -)
s2 - summary(fit2)$Mean Sq[2] ## S-Plus
s2 - summary(fit2)[[1]][animal,Mean Sq] ## R
s2.n - s2 / treat.n
si.sj - sqrt(outer(s2.n, s2.n, +))
q.tukey - qtukey(.95, 4 ,36) /sqrt(2)

mi.mj
lower - mi.mj - q.tukey*si.sj
upper - mi.mj + q.tukey*si.sj
lower
upper


## in S-Plus you can also use
multicomp.default(treat.means,
  df.residual=summary(fit2)$Df[2],
  vmat=diag(
## rep(
summary(fit2)$Mean Sq[2]
##   ,  length(trt.means))
/ treat.n
 ),
  method=tukey)

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


Re: [R] large data set, error: cannot allocate vector

2006-05-10 Thread Mark Stephens
Robert,

You are hitting a known problem with data.frame ... row names.   The row
names alone are the reason the data.frame takes 10 times more memory than
the vector.  Your 100MM integer vector takes 381MB when you scan() it right?
[4bytes*10^8/1024^2]  But when you try and create a data.frame instead,
something like 3.8GB would be required by the data.frame.  This is beyond
the practical 32bit limit, and nothing you do with memory options will solve
that.

 The good news is that Prof Ripley has fixed the problem with data.frame row
names in the latest development version of R.  You could try that,  it
should be much more efficient i.e. a data.frame with a single integer column
length 100MM should have object.size 381MB, just like a vector.

However, how many columns do you have to deal with?3GB allows
100,000,000 x 7 columns of integer in memory.  That doesn't leave any room
for copies, or types greater in size than integer, so you are still
limited.  Above that, as others have suggested,  you need to connect to an
RDMS,  or go 64-bit is much easier if that is possible for you.

 I'd be interested to hear how you get on.

Regards,
Mark

 Message: 41
 Date: Tue, 9 May 2006 15:27:58 -0500
 From: Robert Citek [EMAIL PROTECTED]
 Subject: Re: [R] large data set, error: cannot allocate vector
 To: r-help@stat.math.ethz.ch
 Message-ID:
 [EMAIL PROTECTED]
 Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed


 On May 9, 2006, at 1:32 PM, Jason Barnhart wrote:

  1) So the original problem remains unsolved?

 The question was answered but the problem remains unsolved.  The
 question was, why am I getting an error cannot allocate vector when
 reading in a 100 MM integer list.  The answer appears to be:

 1) R loads the entire data set into RAM
 2) on a 32-bit system R max'es out at 3 GB
 3) loading 100 MM integer entries into a data.frame requires more
 than 3 GB of RAM (5-10 GB based on projections from 10 MM entries)

 So, the new question is, how does one work around such limits?


[[alternative HTML version deleted]]

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


Re: [R] zero-inflated mixed models

2006-05-10 Thread Spencer Graves
  I've never heard of a Hurdle model before, but have you looked at 
'lmer' associated with library(lme4)?  For documentation, see the 
following:

  * Douglas Bates. Fitting linear mixed models in R. R News, 
5(1):27-30, May 2005 (www.r-project.org - newsletter).

  * vignette(MlmSoftRev) in library(mlmRev).  (If you don't know 
about vignettes, you need to know that you get both an Adobe Acrobat 
file as well as an R script file to play with as you read the *.PDF. 
The *.PDF should open, at least under Windows, from 
'vignette(MlmSoftRev)', and the *.R file should appear with 
'edit(vignette(MlmSoftRev))' -- or 
'Stangle(vignette(MlmSoftRev)$file)' if you use ESS.)

  hope this helps,
  Spencer Graves

Jeff Miller wrote:
 Does anyone know of an existing R package or code to run a mixed Hurdle
 model?
 
  
 
 I found glmmADMB, but that seems to be ZIP.
 
  
 
 Any recommendations?
 
  
 
 Thanks,
 
 Jeff
 
  
 
  
 
  
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] ape comparative analysis query

2006-05-10 Thread Simon Blomberg
Chris Knight wrote:

 This raises various questions:

 1) Was I misleading myself that my independent contrasts were valid in
 the first place?
   
I think partly. Independent contrasts were designed for data for tip 
taxa only, not ancestral state data. One of the steps in the algorithm 
requires a correction to account for the fact that ordinarily the values 
for traits at nodes are estimated and not known, basically lengthening 
the branch length to that node by a certain amount (See Felsenstein's 
original paper). If you have known ancestral states, then you should not 
make this correction.
 2) What is it, if anything, about the root taxon that causes this issue,
 given that other taxa also have zero branch lengths?
   
When converting a tree to a correlation matrix for use in GLS or GEE, 
the Brownian motion assumption implies that the covariances among taxa 
are represented by their shared branch length from the root, and the 
height of each terminal taxon is equal to the variance of the trait for 
that taxon. If the tree is ultrametric, then the variances are equal. In 
your case, the root has zero covariance with each taxon, and zero 
variance. Now, the error in the gls call is caused by a division by zero 
in the calculation of the correlation matrix, because the root has zero 
variance. try:

vcv.phylo(tree)
vcv.phylo(tree, cor=TRUE)

 3) Is there any way of getting around this and including data on the
 root taxon, or am I better off just dropping it (ultimately I want to
 work with much larger trees (up to tens of thousands of taxa) where that
 one piece of information will become relatively less important)
   
I'm surprised that you have known values for the root data. Are you sure 
that the root taxon is not actually an outgroup? If so, it will have 
some branch length (variance), and the model should fit OK.

HTH,

Simon.

 Any help very much appreciated,

 Chris

 I'm working with ape 1.8-2 in R 2.1.1 under ubuntu 'Breezy' linux
 (unfortunately 2.1.1 is the latest easily available in breezy)



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


Re: [R] command completion? [Broadcast]

2006-05-10 Thread Liaw, Andy
From: François Pinard
 
 [Duncan Murdoch]
 [Robert Citek]
 
  Does R have command or object name completion?
 
 [...] I don't think it would be a welcome change to the console 
 versions; some of them use readline's filename completion 
 which would 
 almost certainly be broken by this.
 
 We have to put things in perspective, here.  In my opinion, 
 object name completion would be a lot more useful than 
 filename completion, because in R, we name R objects much 
 more often than we name files.
 
 Others need to run under ESS.
 
 While this is a good things for Emacs lovers, the requirement 
 is rather unwelcome for pagans!  :-)

If ESS is too Catholic for you, JGR might be the Reformation...

Andy
 
 -- 
 François Pinard   http://pinard.progiciels-bpi.ca
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


  1   2   >