Re: [R] Problem using Tobit models in R (Testing and controlling for distributional assumptions and endogeneity)

2007-11-29 Thread Malte Brockmann
Roger, thanks for your reply and especially for pointing out that quantreg does 
not calculate the SCLS estimator as I thought. You are also certainly right 
about the covariance matrices, I meant the difference to be psd.

Nevertheless, my main questions remain open: How to I test distributional 
assumptions and endogeneity for Tobit models? In case I cannot reject 
endogeneity, how do I model structural equations with censored dependent 
variables?





-Ursprüngliche Nachricht-
Von: roger koenker [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 28. November 2007 22:14
An: Malte Brockmann
Cc: r-help@r-project.org
Betreff: Re: [R] Problem using Tobit models in R (Testing and controlling for 
distributional assumptions and endogeneity)


url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Champaign, IL 61820


On Nov 28, 2007, at 2:45 PM, Malte Brockmann wrote:


 Dear R-Community,

 I am currently using Tobit models (survreg in the survival package).

 1a) Does R provide a straight-forward way to test distributional  
 assumptions for tobit models?
 1b) If not: I tried to apply the Hausman-test proposed in Newey  
 (1987), Journal of Econometrics, on the Tobit estimator and the  
 symmetrically censored least squares estimator proposed by Powell  
 (1986) (quantreg package).

This symmetrically censored least squares estimator  is NOT what is  
computed by the quantreg package.
What is computed is the Powell quantile regression estimator.

 Unfortunately, quantreg only provides covariance matrices based on  
 the bootstrap which are not positive semi-definite,

The bootstrapped covariance provided by quantreg is the usual sample  
covariance matrix of the bootstrapped
realizations and is therefore necessarily positive semi-definite.   
Perhaps what you meant to say was that the
difference between the two covariance matrices that you have computed  
was not psd;  this could easily happen.
Nothing ensures that the Powell QR estimate is less efficient than  
the usual (normal theory) tobit estimator,
indeed there are very plausible conditions under which this is not  
the case.

 therefore the hausman test statistic based on the difference  
 between both covariance matrices can be negative. Newey proposes 2  
 ways to calculate positive semi-definite covariance matrices: Is  
 there a way to implement any of these without manually coding (or  
 adapting) the tobit and SCLS estimation procedures to extract the  
 necessary information needed for the estimation (first derivative  
 of loglik w.r.t. theta, etc.)?

 2) I apply the test for endogeneity proposed by Smith and Blundell  
 (1986), Econometrica, and one of my variables turns out to be  
 endogenous. Does R have a package for simultaneous equations with  
 censored dependent variables? As far as I know, the sem package  
 does estimate these types of equations.

 Thanks in advance
 Malte
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Re placing values job

2007-11-29 Thread seanpor

fyi On my machine match runs *much* faster...

 t0 - Sys.time(); for (i in 1:reps) { match(Y,X) }; print(Sys.time() - t0)
Time difference of 0.1570001 secs
 t0 - Sys.time(); for (i in 1:reps) { sapply(Y,function(Y){which(Y==X)})
 }; print(Sys.time() - t0)
Time difference of 6.093 secs
 6.09/.157
[1] 38.78981

Regards,
Sean


Peter Dalgaard wrote:
 
 Ingmar Visser wrote:
 does this do what you want?

 sapply(y,function(y){which(y==x)})
   
 Maybe, but match(Y,X) would be more to the point.
 
 hth, Ingmar

 On 28 Nov 2007, at 15:53, Serguei Kaniovski wrote:

   
 Hallo,

 I have two vectors of different lengths which contain the same set of
 values:

 X  -c(2,6,1,7,4,3,5)
 Y - c(1,1,6,4,6,1,4,1,2,3,6,6,1,2,4,4,5,4,1,7,6,6,4,4,7,1,2)

 How can I replace the values in Y with the index (!) of the  
 corresponding
 values in X. So 2 appears in X in the first coordinate, so all 2�s  
 in Y
 should be replaced by 1, etc.

 Thank you for your help,
 Serguei

 
 Austrian Institute of Economic Research (WIFO)

 P.O.Box 91  Tel.: +43-1-7982601-231
 1103 Vienna, AustriaFax: +43-1-7989386

 Mail: [EMAIL PROTECTED]
 http://www.wifo.ac.at/Serguei.Kaniovski
 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

 Ingmar Visser
 Department of Psychology, University of Amsterdam
 Roetersstraat 15
 1018 WB Amsterdam
 The Netherlands
 t: +31-20-5256723



  [[alternative HTML version deleted]]

   
 

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
   
 
 
 -- 
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@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Replacing-values-job-tf4889131.html#a14021232
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ftable as latex (with Hmisc?)

2007-11-29 Thread Dieter Menne
Richard M. Heiberger rmh at temple.edu writes:

 
 I think this does what you are asking for.  It should be
 relatively easy to write a method
 
 latex.ftable()
 
 based on this.  One or two row.vars and one or two col.vars
 should be straightforward (with n.rgroup and n.cgroup used
 for the second row and column).
 
... sample followed

Thanks, this works for most cases. I feared I had missed something in
summary(...,table).

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R crashes using quantreg censored estimation (method fcen)

2007-11-29 Thread Malte Brockmann

Dear List,

my R session crashes if I repeatedly run the summary function on a quantreg 
object generated using the censored estimation method or if I set the number of 
bootstrap repititions reasonably high. Are there any known incompabilities 
between quantreg and Windows Vista  AMD64? The error is reproducable using R 
2.6.1 and R 2.5.1.

 sessionInfo()
R version 2.6.1 (2007-11-26) 
i386-pc-mingw32 

locale:
LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252

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

other attached packages:
[1] quantreg_4.10 SparseM_0.74

Thanks,
Malte




-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Jared O'Connell
Gesendet: Donnerstag, 29. November 2007 08:57
An: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Betreff: Re: [R] Recommended textbooks for R?

This page may be helpful :)

 http://www.r-project.org/doc/bib/R-books.html

Modern Applied Statistics with S is quite broad and very good.

On Nov 28, 2007 4:38 PM, Max [EMAIL PROTECTED] wrote:
 Hi everyone!

 I've recently begun to learn R for my job as the IT department suffers
 from lack of funding for new software. I was talking to the guy in
 charge of Requisitions and have found out the budget for books is in
 great shape.

 So, I'm curious what books people know of that have R examples and are
 good for:

 1.) Uni and Multivariate Time Series Analysis/Forecasting

 2.) GLMs (at this point it looks like I'll be focusing on nominal and
 ordinal regression models)

 3.) Survival Models

 4.) Multiple Regression

 Any suggestions would be awesome. :)

 thanks,

 -Max

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Clustering

2007-11-29 Thread Eleni Christodoulou
Thank you very much! I had misunderstood it's true...

On Nov 28, 2007 6:28 PM, Birgit Lemcke [EMAIL PROTECTED] wrote:

 Hello Eleni,

 as far as I understood and used agnes() the method argument
 determines only the clustering method.
 If you use diss=TRUE the distances should be taken from the distance
 matrix.

 Birgit

 Am 28.11.2007 um 12:18 schrieb Eleni Christodoulou:

  Hello all!
 
  I am performingsome clustering analysis on microarray data using
  agnes{cluster} and I have created my own dissimilarity matrix
  according to a
  distance measure different from euclidean or manhattan etc. My
  question
  is,  if I choose for example method=complete, how are the distances
  between the elements calculated? Are they taken form the dissimilarity
  matrix I have provided as the first argument?
  clust.complete.agnes-agnes(as.dist(D),diss=TRUE,method=complete)
 
 
  Thank you very much,
  Eleni
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-
  guide.html
  and provide commented, minimal, self-contained, reproducible code.

 Birgit Lemcke
 Institut für Systematische Botanik
 Zollikerstrasse 107
 CH-8008 Zürich
 Switzerland
 Ph: +41 (0)44 634 8351
 [EMAIL PROTECTED]







[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Influence of subdataset

2007-11-29 Thread Marcel Sandow
Dear r-helpers!

Two closely related questions:

1) I would like to analyse the influence of a subdataset on the whole dataset 
(50 out of 350 datapoints) linear regression slope. I have read about 
influence.measures but this analyses only single datapoint. 

2) I would like to compare the slope of the whole dataset with the slope of a 
subdataset consisting of the maximum values of 10 equal x-axis classes.

any suggestions?

Thanks

Marcel 

__

Marcel Sandow

Leibniz Institute of Marine Sciences - IFM-Geomar
Experimental Ecology: Foodwebs
Düsternbrooker Weg 20
24105 Kiel
Germany

Fon: +49-431-600-4404
Fax: +49-431-600-1515

Homepage: http://www.ifm-geomar.de
E-mail: [EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R crashes using quantreg censored estimation (method fcen)

2007-11-29 Thread Gavin Simpson
On Thu, 2007-11-29 at 09:09 +0100, Malte Brockmann wrote:
 Dear List,
 
 my R session crashes if I repeatedly run the summary function on a
 quantreg object generated using the censored estimation method or if I
 set the number of bootstrap repititions reasonably high. Are there any
 known incompabilities between quantreg and Windows Vista  AMD64? The
 error is reproducable using R 2.6.1 and R 2.5.1.

Err, what does this have to do with Jared's reply to Max's posting about
suitable textbooks and R?

Please don't jump on a thread to ask your own question. Start your own
thread.

If you want people to help you with your problem, you are probably going
to have to give a reproducible example - my R session crashes is way
below what is requested in the posting guide. Even the statements about
what you did are not enough - people need to be able to reproduce your
problem on their machines.

Read the posting guide (URL in the footer of this email) and resend a
message to the list - a new one mind, so you start a new thread. And
make sure you include a reproducible example. If you can't send your
data, try it with one of the data sets that come with quantreg and if it
fails with that also, use that data set in your example.

You should also consider contacting the maintainer of quantreg.

HTH

G

 
  sessionInfo()
 R version 2.6.1 (2007-11-26) 
 i386-pc-mingw32 
 
 locale:
 LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods
 base 
 
 other attached packages:
 [1] quantreg_4.10 SparseM_0.74
 
 Thanks,
 Malte
 
 
 
 
 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Jared 
 O'Connell
 Gesendet: Donnerstag, 29. November 2007 08:57
 An: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Betreff: Re: [R] Recommended textbooks for R?
 
 This page may be helpful :)
 
  http://www.r-project.org/doc/bib/R-books.html
 
 Modern Applied Statistics with S is quite broad and very good.
 
 On Nov 28, 2007 4:38 PM, Max [EMAIL PROTECTED] wrote:
  Hi everyone!
 
  I've recently begun to learn R for my job as the IT department suffers
  from lack of funding for new software. I was talking to the guy in
  charge of Requisitions and have found out the budget for books is in
  great shape.
 
  So, I'm curious what books people know of that have R examples and are
  good for:
 
  1.) Uni and Multivariate Time Series Analysis/Forecasting
 
  2.) GLMs (at this point it looks like I'll be focusing on nominal and
  ordinal regression models)
 
  3.) Survival Models
 
  4.) Multiple Regression
 
  Any suggestions would be awesome. :)
 
  thanks,
 
  -Max
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] library(RII)

2007-11-29 Thread Maria del Carmen olvera
Dear all

 I'm Manme from Spain. I could not solve one problem , so I still have to ask 
your help. 
 
I have a deaths and atrisk dataset. I would like to calculate IRR of the 
dataset but before I want to choose the smoothing parameter and I have the 
following error message:
 
RII.CVplot(obs, pob, loglambda = seq(-2,18,len=21))
Error in plot.window(xlim, ylim, log, asp, ...) : need finites value de 'ylim'
Moreover: Warning messages:
1: nothing argument finite for min; return Inf in: min(x) 
2: nothing argument finite for max; return -Inf in: max(x) 
 
Do you have any idea what can be the problem? 
 
Thanks you


   
__ 
¿Chef por primera vez?
Sé un mejor Cocinillas. 

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R , Eclipse

2007-11-29 Thread zheboyang
Hi ! Everybody!
I am learning R, and I installed R on my laptop(OpenSUSE). Because some 
my work was done under Eclipse , so I use the StatET plug-in for 
Eclipse. Most work well,  but when I plot graphics, It can't display the 
picture. Why? How to start te graphic device?
Any ideas on how to solve it was required. Thanks very much!
boyang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Testing normality

2007-11-29 Thread pedrosmarques


Hi,

I'm doing kolmogorv-smirnov test but I don't know what conclusions to take, I 
want to know if my data has a normal distribution:

 ks.test(dados1,pnorm)

One-sample Kolmogorov-Smirnov test

data:  dados1 
D = 0.972, p-value  2.2e-16
alternative hypothesis: two-sided 

Warning message:
cannot compute correct p-values with ties in: ks.test(dados1, pnorm) 


Best regards,

Pedro Marques

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Testing normality

2007-11-29 Thread Dietrich Trenkler
[EMAIL PROTECTED] schrieb:
 Hi,

 I'm doing kolmogorv-smirnov test but I don't know what conclusions to take, I 
 want to know if my data has a normal distribution:

   
 ks.test(dados1,pnorm)
 

 One-sample Kolmogorov-Smirnov test

 data:  dados1 
 D = 0.972, p-value  2.2e-16
 alternative hypothesis: two-sided 

 Warning message:
 cannot compute correct p-values with ties in: ks.test(dados1, pnorm) 


 Best regards,

 Pedro Marques

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

   
Your approach amounts to testing if  dados1 is a sample from a standard 
normal distribution.
Is that what you want?

Regards

D. Trenkler

-- 
Dietrich Trenkler c/o Universitaet Osnabrueck 
Rolandstr. 8; D-49069 Osnabrueck, Germany
email: [EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to perform Bayesian analysis in R?(corrected)

2007-11-29 Thread adilshah
 Dear Members i'm trying to access different packages used for Bayesian
analysis, but
failed to integrate after making the likelihood of the model the model
like this
 a= exp(b)/summation(exp(b))
where 'b' = half of the natural log of 'a'
please If some one knows about this type of integration for posterior
distribution then pleae inform me
SYED ADIL HUSSAIN
MPHIL SCHOLER
QAU, ISLAMABAD




This is Virus Free Email Scanned by QAU's McAfee Virus Scanner
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL
and is thus for use only by the intended recipient. If you received this in 
error, please contact the sender and delete the e-mail
and its attachments from all computers.
www.qau.edu.pk
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] image() plot with z not in matrix format

2007-11-29 Thread mdgi
Hello R cracks

The image() function requires strictly increasing x and y values and z as a 
matrix.

Actually, I don't have equally spaced variables, but anyway want to plot an 
colored image() (with z-information).

An example of my problem is here:

a-data.frame(rnorm(100), rnorm(100), runif(100)*100)

How can I plot this data as an image (x=a[,1], y=a[,2] and z=a[,3])- according 
to ?image.
It has to be possible to adapt the grid size so that every grid cell in the 
plot is coloured consequently.

Thanks for your help

Marc
--

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] sqlQuery of variable of type varchar - confusion with .

2007-11-29 Thread Søren Højsgaard
Dear list,
I have a rather large dataset in SAS which I export to a SQLite database for 
subsequent use in R.
 
One of the columns is
cowidp  
1881501224.2
1881501224.2
 
and the column is stored as a character in SAS. It becomes a varchar in the 
database (it should be - it is an identifier; not a number). Reading this into 
R gives
  cowidp
1 1881501224
2 1881501224

- i.e. the .2 is stripped off - and it becomes a numeric variable
 
However, if I store replace . with _ in my SAS data then the column in my 
database is
 
cowidp  
1881501224_2
1881501224_2
 
Reading into R gives
cowidp
1 1881501224_2
2 1881501224_2

as it should be - it becomes a factor
 
Is the fact that the .-part does not seem to work a bug in sqlQuery (or 
somewhere else) or is it the intention that things containing a . are 
converted into numeric values if possible?
 
Regards
Søren
 
 
 
 
 
 
 
 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Odp: image() plot with z not in matrix format

2007-11-29 Thread Petr PIKAL
Hi

library(akima)
a-data.frame(rnorm(100), rnorm(100), runif(100)*100)
image(interp(a[,1], a[,2], a[,3]))

Petr
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 29.11.2007 12:52:32:

 Hello R cracks
 
 The image() function requires strictly increasing x and y values and z 
as a matrix.
 
 Actually, I don't have equally spaced variables, but anyway want to plot 
an 
 colored image() (with z-information).
 
 An example of my problem is here:
 
 a-data.frame(rnorm(100), rnorm(100), runif(100)*100)
 
 How can I plot this data as an image (x=a[,1], y=a[,2] and z=a[,3])- 
 according to ?image.
 It has to be possible to adapt the grid size so that every grid cell in 
the 
 plot is coloured consequently.
 
 Thanks for your help
 
 Marc
 --
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R crashes using quantreg censored estimation (method fcen)

2007-11-29 Thread Malte Brockmann
Thanks for your advice, Gavin. I hope to comply with the posting guide this 
time.

With crashing I meant that the R-session is simply terminated without an 
error message (Vista, R2.6.1 and R2.5.1 with precompiled packages, sessionInfo 
see below). I could reproduce the error on a linux machine (R2.5.1-1 for which 
I have compiled the packages on my own). On the linux machine I at least get 
the following error message:

*** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: .Fortran(xys, as.integer(m), as.integer(n), as.integer(p), 
as.integer(R), as.integer(m + 5), as.integer(p + 2), as.double(x), 
as.double(y), as.double(tau), as.double(tol), flag = integer(R), coef = 
double(p * R), resid = double(m), integer(m), double((m + 5) * (p + 
2)), double(m), as.integer(1), sol = double((p + 2)), dsol = double(m), 
lsol = as.integer(0), xx = double(m * p), yy = double(m), 
as.integer(s), PACKAGE = quantreg)
 2: boot.rq.xy(x, y, s, tau)
 3: boot.rq(x[s, ], y[s], tau, ...)
 4: summary.fcrq(model.powell, R = r)
 5: summary(model.powell, R = 1e+06)

I used the following command to generate the model:
model.powell - rq(y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9, 
method=fcen, data=data_test)
summary(model.powell, R=100)

I used 100 replications to make sure that the error is triggered

I uploaded the data to www.esbf.de/quantreg/data_test.RData






-Ursprüngliche Nachricht-
Von: Gavin Simpson [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 29. November 2007 11:45
An: Malte Brockmann
Cc: [EMAIL PROTECTED]
Betreff: Re: [R] R crashes using quantreg censored estimation (method fcen)

On Thu, 2007-11-29 at 09:09 +0100, Malte Brockmann wrote:
 Dear List,
 
 my R session crashes if I repeatedly run the summary function on a
 quantreg object generated using the censored estimation method or if I
 set the number of bootstrap repititions reasonably high. Are there any
 known incompabilities between quantreg and Windows Vista  AMD64? The
 error is reproducable using R 2.6.1 and R 2.5.1.

Err, what does this have to do with Jared's reply to Max's posting about
suitable textbooks and R?

Please don't jump on a thread to ask your own question. Start your own
thread.

If you want people to help you with your problem, you are probably going
to have to give a reproducible example - my R session crashes is way
below what is requested in the posting guide. Even the statements about
what you did are not enough - people need to be able to reproduce your
problem on their machines.

Read the posting guide (URL in the footer of this email) and resend a
message to the list - a new one mind, so you start a new thread. And
make sure you include a reproducible example. If you can't send your
data, try it with one of the data sets that come with quantreg and if it
fails with that also, use that data set in your example.

You should also consider contacting the maintainer of quantreg.

HTH

G

 
  sessionInfo()
 R version 2.6.1 (2007-11-26) 
 i386-pc-mingw32 
 
 locale:
 LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods
 base 
 
 other attached packages:
 [1] quantreg_4.10 SparseM_0.74
 
 Thanks,
 Malte 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] sqlQuery of variable of type varchar - confusion with .

2007-11-29 Thread Duncan Murdoch
On 11/29/2007 7:03 AM, Søren Højsgaard wrote:
 Dear list,
 I have a rather large dataset in SAS which I export to a SQLite database for 
 subsequent use in R.
  
 One of the columns is
 cowidp
 1881501224.2  
 1881501224.2  
  
 and the column is stored as a character in SAS. It becomes a varchar in the 
 database (it should be - it is an identifier; not a number). Reading this 
 into R gives
   cowidp
 1 1881501224
 2 1881501224
 
 - i.e. the .2 is stripped off - and it becomes a numeric variable
  
 However, if I store replace . with _ in my SAS data then the column in my 
 database is
  
 cowidp
 1881501224_2  
 1881501224_2  
  
 Reading into R gives
 cowidp
 1 1881501224_2
 2 1881501224_2
 
 as it should be - it becomes a factor
  
 Is the fact that the .-part does not seem to work a bug in sqlQuery (or 
 somewhere else) or is it the intention that things containing a . are 
 converted into numeric values if possible?

If you're using sqlQuery from RODBC, then the as.is argument of 
sqlGetResults is relevant.  It defaults to FALSE, and tries to convert 
things based on how they look.

Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] sqlQuery of variable of type varchar - confusion with .

2007-11-29 Thread Prof Brian Ripley

On Thu, 29 Nov 2007, Søren Højsgaard wrote:


Dear list,


I have a rather large dataset in SAS which I export to a 
SQLite database for subsequent use in R.


One of the columns is
cowidp
1881501224.2
1881501224.2

and the column is stored as a character in SAS. It becomes a varchar in 
the database (it should be - it is an identifier; not a number). Reading 
this into R gives


How?  You haven't actually said, but I am surmising that you are using 
package RODBC with the default options, in which case this is exactly what 
the help page ?sqlQuery says should happen.



 cowidp
1 1881501224
2 1881501224

- i.e. the .2 is stripped off - and it becomes a numeric variable

However, if I store replace . with _ in my SAS data then the column in my 
database is

cowidp
1881501224_2
1881501224_2

Reading into R gives
   cowidp
1 1881501224_2
2 1881501224_2

as it should be - it becomes a factor

Is the fact that the .-part does not seem to work a bug in sqlQuery 
(or somewhere else) or is it the intention that things containing a . 
are converted into numeric values if possible?


See the 'as.is' argument to sqlGetResults(), which can be passed from 
sqlQuery().  It is exactly the same as read.table() in this respect.


--
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] empty cells in ftable

2007-11-29 Thread temiz
hello

when I enter:
ftable(xtabs(cnt~jeo+slp+pcurv+asp+hey),data=dt)

it gives a frequncy table. But some cells are empty.
like this:

192   72  0
3   68  0
4   99  0
5  110  0
6   97  0
7   74  0
8   46  0
.
.
.


(Those empty cells must have previous non empty values.)

how can I get a table  that  does not contain empty  cells ?

Is this the proper table that will be used in logistic regression ?

regards

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R crashes using quantreg censored estimation (method fcen)

2007-11-29 Thread roger koenker
1.  As the posting guide advises,  queries about packages should be  
sent in the first instance
to the package author/maintainer before posting to the list.

2.  As the posting guide also advises, a _minimal_ reproducible  
example is desirable not one
that claims that somewhere in the middle of 1,000,000 bootstrap  
replications something goes
wrong.

I'll try to take a look at this with valgrind, but I can't promise  
any immediate resolution.


url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Champaign, IL 61820


On Nov 29, 2007, at 6:32 AM, Malte Brockmann wrote:

 Thanks for your advice, Gavin. I hope to comply with the posting  
 guide this time.

 With crashing I meant that the R-session is simply terminated  
 without an error message (Vista, R2.6.1 and R2.5.1 with precompiled  
 packages, sessionInfo see below). I could reproduce the error on a  
 linux machine (R2.5.1-1 for which I have compiled the packages on  
 my own). On the linux machine I at least get the following error  
 message:

 *** caught segfault ***
 address (nil), cause 'unknown'

 Traceback:
  1: .Fortran(xys, as.integer(m), as.integer(n), as.integer 
 (p), as.integer(R), as.integer(m + 5), as.integer(p + 2),  
 as.double(x), as.double(y), as.double(tau), as.double(tol),  
 flag = integer(R), coef = double(p * R), resid = double(m),  
 integer(m), double((m + 5) * (p + 2)), double(m), as.integer 
 (1), sol = double((p + 2)), dsol = double(m), lsol =  
 as.integer(0), xx = double(m * p), yy = double(m),  
 as.integer(s), PACKAGE = quantreg)
  2: boot.rq.xy(x, y, s, tau)
  3: boot.rq(x[s, ], y[s], tau, ...)
  4: summary.fcrq(model.powell, R = r)
  5: summary(model.powell, R = 1e+06)

 I used the following command to generate the model:
 model.powell - rq(y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9,  
 method=fcen, data=data_test)
 summary(model.powell, R=100)

 I used 100 replications to make sure that the error is triggered

 I uploaded the data to www.esbf.de/quantreg/data_test.RData






 -Ursprüngliche Nachricht-
 Von: Gavin Simpson [mailto:[EMAIL PROTECTED]
 Gesendet: Donnerstag, 29. November 2007 11:45
 An: Malte Brockmann
 Cc: [EMAIL PROTECTED]
 Betreff: Re: [R] R crashes using quantreg censored estimation  
 (method fcen)

 On Thu, 2007-11-29 at 09:09 +0100, Malte Brockmann wrote:
 Dear List,

 my R session crashes if I repeatedly run the summary function on a
 quantreg object generated using the censored estimation method or  
 if I
 set the number of bootstrap repititions reasonably high. Are there  
 any
 known incompabilities between quantreg and Windows Vista  AMD64? The
 error is reproducable using R 2.6.1 and R 2.5.1.

 Err, what does this have to do with Jared's reply to Max's posting  
 about
 suitable textbooks and R?

 Please don't jump on a thread to ask your own question. Start your own
 thread.

 If you want people to help you with your problem, you are probably  
 going
 to have to give a reproducible example - my R session crashes is way
 below what is requested in the posting guide. Even the statements  
 about
 what you did are not enough - people need to be able to reproduce your
 problem on their machines.

 Read the posting guide (URL in the footer of this email) and resend a
 message to the list - a new one mind, so you start a new thread. And
 make sure you include a reproducible example. If you can't send your
 data, try it with one of the data sets that come with quantreg and  
 if it
 fails with that also, use that data set in your example.

 You should also consider contacting the maintainer of quantreg.

 HTH

 G


 sessionInfo()
 R version 2.6.1 (2007-11-26)
 i386-pc-mingw32

 locale:
 LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany. 
 1252;LC_MONETARY=German_Germany. 
 1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252

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

 other attached packages:
 [1] quantreg_4.10 SparseM_0.74

 Thanks,
 Malte
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.
 -- 
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  Dr. Gavin Simpson [t] +44 (0)20 7679 0522
  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
  Pearson Building, [e] 

Re: [R] How to perform Bayesian analysis in R?(corrected)

2007-11-29 Thread Ben Bolker



adilshah wrote:
 
  Dear Members i'm trying to access different packages used for Bayesian
 analysis, but
 failed to integrate after making the likelihood of the model the model
 like this
  a= exp(b)/summation(exp(b))
 where 'b' = half of the natural log of 'a'
 please If some one knows about this type of integration for posterior
 distribution then pleae inform me
 SYED ADIL HUSSAIN
 MPHIL SCHOLER
 QAU, ISLAMABAD
 
 

You haven't provided enough information for us to help you.
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

 cheers
Ben Bolker

-- 
View this message in context: 
http://www.nabble.com/How-to-perform-Bayesian-analysis-in-R-%28corrected%29-tf4896524.html#a14025892
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Boxplots from lme objects

2007-11-29 Thread CG Pettersson
Dear all!

W_XP, R 2.6.0

I am evaluating variety trails over several years, where the different
cultivars have not been present in the dataset the same number of years.

I use lme{nlme} to fit random effect models and estimable{gmodels} to
extract the fixed effects. The general model is:

lme(y ~ cultivar, data = data, na.action=na.omit,
random = ~ 1 | year/trial/rep)

The dataset is from six years and I only run the analyse on a subset
dataframe consisting the cultivars grown the last year (25 out of 82 for
the moment). All this runs well to produce tables, but what about
graphics?

How do I make boxplots from the lme objects? Producing the boxplots, I
want only 6 or 7 cultivars out of the 25 available in the object - so I
also need a way to subset the information in the lme objects.

Thank you

/CG




-- 
CG Pettersson, Ph.D.
Swedish University of Agricultural Sciences (SLU)
Dept. of Crop Production Ecology. Box 7043.
SE-750 07 Uppsala, Sweden
[EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ggplot2 melt function value

2007-11-29 Thread hadley wickham
  Hi:I recently started using the melt function and
  found that it is very useful and powerful,however I
  can't seem to find the way to change the default
  column header value to my custom column name.

 melted data are data frames. You can names[..]-myvalue for renaming, but 
 make
 sure you don't need the column for reshaping afterwards.

In the next version of reshape, cast will default (with a message) to
using the last column of the data.frame if value and (all) columns are
not available.  This was a nice suggestion from Antony Unwin.

Hadley

-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Question about using “par”

2007-11-29 Thread cathelf

Hi, 
Sorry for bothering your guys again. I am trying to use par to put 6
figures into 3 rows and 2 columns. My code is:
 
op - par(mfrow = c(1, 2))
xyplot(x1+x2+x3 ~ y, data=resulta, type=l, pch=LETTERS[1:3], lty=c(1:3),
main=For k=3, theata1=1)
xyplot(x1+x2+x3  ~ y, data=resultb, type=l, pch=LETTERS[1:3], lty=c(1:3),
main=For k=3, theata1=5)
xyplot(x1+x2+x3  ~ y, data=resultc, type=l, pch=LETTERS[1:3], lty=c(1:3),
main=For k=5, theata1=1)
xyplot(x1+x2+x3  ~ y, data=resultd, type=l, pch=LETTERS[1:3], lty=c(1:3),
main=For k=5, theata1=5)
xyplot(x1+x2+x3 ~ y, data=resulte, type=l, pch=LETTERS[1:3], lty=c(1:3),
main=For k=10, theata1=1)
xyplot(x1+x2+x3  ~ y, data=resultf, type=l, pch=LETTERS[1:3], lty=c(1:3),
main=For k=10, theata1=5)
par(op)
 
 
But I can only get one figure in one page, not 6 figures in one page. Is
there any other parameter I should specify? There is no error indicated.
 
Thank you so much!
Catherine

-- 
View this message in context: 
http://www.nabble.com/Question-about-using-%E2%80%9Cpar%E2%80%9D-tf4894997.html#a14019058
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] LOCFIT:Automatic bandwidth selection for kernel regression

2007-11-29 Thread learnerminer

Hello all!

I have recently started using the LOCFIT package, together with Clive
Loader's book.  I need to implement some method for automatic (plug-in)
bandwidth selection in a multivariate kernel regression.  From the book, and
the LOCFIT documentation,  it is not clear whether this is possible.  As far
as I can see, the only time the various automated procedures, e.g., SJPI,
are used is in the kdeb function, which is for preparing a summary
comparison of various selection methods, and only for a univariate kernel
density.  Does anyone here know of a way to implement automatic (plug-in)
bandwidth selection for kernel regression, maybe with some R function that
calls LOCFIT?  Or can you suggest a good alternative package for this,
either in R/Matlab or a stand-alone?

Thanks a lot, and regards
-- 
View this message in context: 
http://www.nabble.com/LOCFIT%3AAutomatic-bandwidth-selection-for-kernel-regression-tf4895390.html#a14020237
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] MS Excel Data

2007-11-29 Thread faisal afzal siddiqui
I am using MS Excel (Windos Operating system), how I
import/export data between MS_Excel and R.

Regds
Faisal Afzal SIddiqui
+92-300-9297089
[EMAIL PROTECTED]


  

Never miss a thing.  Make Yahoo your home page.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MS Excel Data

2007-11-29 Thread Prof Brian Ripley
On Wed, 28 Nov 2007, faisal afzal siddiqui wrote:

 I am using MS Excel (Windos Operating system), how I
 import/export data between MS_Excel and R.

Why not read the 'R Data Import/Export' manual?  It ships with R, or can 
be accessed from http://cran.r-project.org/manuals.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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Doing PCA

2007-11-29 Thread Amit Patel
Hi Fellow R enthusiasts
 I have managed to reshape my data using a much shorter script than before. 
Woohoo
However now I have new problems. The code is below. There are no problems with 
the create matrix section.
The problem code is highlighted in bold. I am trying to do PCA on the data.  
Here are the errors.

Error1 
code :  OGSscaled = rangescale(OGS)
error message : Error in dim(newX) - c(prod(d.call), d2) : 
  dims [product 47960] do not match the length of object [43600]

Error2
I tried to do PCA without rangescaling
code :OGSpca - prcomp(OGS, center=FALSE)
error message : Error in svd(x, nu = 0) : infinite or missing values in
 'x'
 

CODE
##
###  Create matrix ###
##

# load packages
require(reshape)
source(rangescale.r)

#Open the csv file
OGSdata - read.table(MG3199.csv,sep=,,header=TRUE)



#create matrix
x.m - melt(OGSdata, measure.var=pct)
OGS - cast(x.m, mci ~ sample)

##
###  PCA  
##

#scale profiles
OGSscaled = rangescale(OGS)

#do PCA
result = prcomp(OGS, center=FALSE)

#obtain scores matrix
scores=result$rotation

#PC1 vs PC2 plot
plot(scores[,1], scores[,2], xlab=PC1, ylab=PC2)

#add labels (0.005 and 0.003 offset to aviod obscuring points

Kind Regards
Amit Patel




  ___

now.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Survreg(), Surv() and interval-censored data

2007-11-29 Thread Terry Therneau

The question (slightly rephrased) was
  Why does survreg(Surv(T.1, T.2, type='interval2') ~1, data=x) fail, when x is

 T.1  T.2  Status
1  0.000   0.62873036  1
2  0.000   2.07039068  1
3  0.000   1.40297214  1
4  0.000   0.09112871  1
5  0.000   0.75115280  1
6  0.000   2.36476839  1
...



  The default model for survreg is a Weibull, for which a survival time of 
exactly zero is not a valid value.  Your example triggers this error message. 

  This is a bug in survreg.  In the 10+ years the code has been available, no 
one has ever specified this particular data: a (0,x] interval for a Weibull.  
Congratulations!  Fixing this will require some thought, however.
  
  To work around the problem, change 0 to NA, which marks the observation as 
left-censored.  
  
Terry Therneau
(author of survreg)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about using “par”

2007-11-29 Thread Dieter Menne
cathelf cathelf at hotmail.com writes:

 Sorry for bothering your guys again. I am trying to use par to put 6
 figures into 3 rows and 2 columns. My code is:
 
 op - par(mfrow = c(1, 2))
 xyplot(x1+x2+x3 ~ y, data=resulta, type=l, pch=LETTERS[1:3], lty=c(1:3),
 main=For k=3, theata1=1)
 xyplot(x1+x2+x3  ~ y, data=resultb, type=l, pch=LETTERS[1:3], lty=c(1:3),
 main=For k=3, theata1=5)

  
 But I can only get one figure in one page, not 6 figures in one page. Is
 there any other parameter I should specify? There is no error indicated.

Rule of thumb: what's documented under the header trellis or lattice does not
use par.

xyplot is a lattice/trellis function, which does not honor par(...) settings,
but uses package grid for layout and everthing else.

So either use standard plot 
  plot(rnorm(100),rnorm(100))

or do something like:

p = xyplot(whatever)
print(p,split=c(1,1,2,2), more=TRUE)
p = xyplot(whoever,...
print(p,split=c(1,2,2,2), more=TRUE)

See print.trellis for details.

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Time Series Issues, Stationarity ..

2007-11-29 Thread John C Frain
Look at the R help files for predict.Arima rather than using forecast
to forecast an ARIMA model.  You might plot your data and the first
difference and you should be able to come to a conclusion about
stationarity.  With your very small data set you need a very
parsimonious model.  Knowledge about the nature of the data set would
also be important.  I see no seasonal effect in the data and wonder
why you are proposing to allow two seasonal differences.  Probably
some form of smoothing would be more suitable in your case.

Best Regards

John

On 29/11/2007, Ozcan Asilkan [EMAIL PROTECTED] wrote:
 Hi ohn,

 Thank you for your reply. I read in a few documents that if a Time Series
 data is NONStationary, ARIMA models must be used. So, if we suppose that my
 data is non-stationary, is it basically enough just to use the arima()
 function in R to make a future forecast ? Does arima function implicitly
 convert my data into stationary status by handling differencing, removing
 seasonality, etc. ? Or must I explicitly convert my data to stationary form
 in order to use arima() ?

 and here' s my code. I' ll appreciate your help making suggestions.. Thank
 you very much.

  Best regards..
  Ozzy

 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Loading the library...
 library(forecast)

 # my input data having 3 years of monthly data (36 data)
 invec -
 c(15289,14282,16153,15885,15369,15488,15462,14697,15512,15506,15271,15111,14963,15150,15061,14896,15147,14967,15026,15102,14880,15181,14979,15300,15377,15323,15462,15422,15598,15518,15497,15593,15348,15453,15361,15361)

 # converting to TS
 invecTS - ts(invec, start = c(2005,1), frequency = 12)

 # using arima function
 invecTSAR = arima(invecTS, order = c(0,1,1), seasonal = list(order = c(0, 2,
 0) ) )

 # making a further 2 years forecasting (=24 months)
 invecTSARPR - forecast(invecTSAR,24)

 # and plotting
 plot(invecTSARPR,xlab=TIME, ylab=PRICE (€), fcol=red,plot.conf=F)

 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


 On Nov 26, 2007 10:30 PM, Uwe Ligges
 [EMAIL PROTECTED] wrote:
 
 
 
  Ozcan Asilkan wrote:
   Hello,
  
 

-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] Package dlm version 0.8-1

2007-11-29 Thread Giovanni Petris

I uploaded a new version of package dlm to CRAN. 

dlm provides functions for maximum likelihood, Kalman filtering and
smoothing, and Bayesian analysis of Gaussian linear state space
models, also known as Dynamic Linear Models.  

The most important visible changes from the previous version are the
following.

1) Missing values are now allowed in the observations.

2) Extractor and replacement functions for the matrices defining a dlm
   are now available.

3) The function for Kalman smoothing, dlmSmooth, can take as
   arguments a data vector and a dlm object. Previously the argument
   had to be the output from dlmFilter.

4) In addition to the + method function for objects of class dlm,
   used to build complex models from simple components, all having the
   same dimensionality of the observation vector, there is now an
   outer sum, %+%, which creates a joint model from independent
   dlm's. This is useful to specify models for multivariate
   observations. 

5) Minimal support for Markov chain Monte Carlo output analysis has
   been added, with functions mcmcSD, mcmcMean, ergMean. 

Thanks to Michael Lavine for suggesting the outer sum in (4).

Please let me know of any problems. Comments and suggestions are
very welcome. 

Giovanni Petris

-- 

Giovanni Petris  [EMAIL PROTECTED]
Department of Mathematical Sciences
University of Arkansas - Fayetteville
http://definetti.uark.edu/~gpetris/

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Odp: MS Excel Data

2007-11-29 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 29.11.2007 04:54:18:

 I am using MS Excel (Windos Operating system), how I
 import/export data between MS_Excel and R.

What data and how often. There are few options from add on packages 
through ODBC to copy and paste. If you bother to read any documentation 
about R you coud find it easily.

Eg. if you know Google you can ask

R export data excel

and the first hit reveals you one possibility.

Regards
Petr

 
 Regds
 Faisal Afzal SIddiqui
 +92-300-9297089
 [EMAIL PROTECTED]
 
 
 
 

 Never miss a thing.  Make Yahoo your home page.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Re commended textbooks for R?

2007-11-29 Thread aaront

I am currently using: ---John Maindonald and John Braun. Data Analysis and
Graphics Using R--- and find it very useful, note that there now is a 2007
edition.

Most of the texts mentioned in the previous link have reviews on Amazon.


Jared O'Connell-2 wrote:
 
 This page may be helpful :)
 
  http://www.r-project.org/doc/bib/R-books.html
 
 Modern Applied Statistics with S is quite broad and very good.
 
 On Nov 28, 2007 4:38 PM, Max [EMAIL PROTECTED] wrote:
 Hi everyone!

 I've recently begun to learn R for my job as the IT department suffers
 from lack of funding for new software. I was talking to the guy in
 charge of Requisitions and have found out the budget for books is in
 great shape.

 So, I'm curious what books people know of that have R examples and are
 good for:

 1.) Uni and Multivariate Time Series Analysis/Forecasting

 2.) GLMs (at this point it looks like I'll be focusing on nominal and
 ordinal regression models)

 3.) Survival Models

 4.) Multiple Regression

 Any suggestions would be awesome. :)

 thanks,

 -Max

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Recommended-textbooks-for-R--tf4895638.html#a14027317
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] rpvm error when loading

2007-11-29 Thread Lenzo, Antonino
Hello,

I get this error when issuing the library command (with rpvm) in R:

=
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

 library(rpvm)
Error in dyn.load(x, as.logical(local), as.logical(now)) : 
unable to load shared library
'/usr/local/lib/R/library/rpvm/libs/rpvm.so':
  /usr/local/lib/R/library/rpvm/libs/rpvm.so: cannot restore segment
prot after reloc: Permission denied
Error in library(rpvm) : .First.lib failed for 'rpvm'
 
=

I have successfully loaded R and PVM.  Both of these are working for me.
But I don't understand why I am getting the above-listed error.  Can
anyone provide some insight?

Thanks!
A Lenzo

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Listing factor levels for elements of letters in an rpart plot

2007-11-29 Thread Cliff Behrens
I would like to create a list of factor levels represented by elements 
of letters shown in an rpart plot.  It seems that the order of levels 
for a factor are different than the alphabetized order returned a simple 
list command, e.g., rpartModel$factor_name. 

I was also wondering how best to model factors with many levels, or does 
the classification algorithm already subset these?  I was thinking of 
thresholding observations on some minimum count for each level.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Recommended textbooks for R?

2007-11-29 Thread Wensui Liu
my favorite is MASS by B. Ripley. I bought it 6 yrs ago and am still
browsing it when I have time.

On Nov 28, 2007 10:38 AM, Max [EMAIL PROTECTED] wrote:
 Hi everyone!

 I've recently begun to learn R for my job as the IT department suffers
 from lack of funding for new software. I was talking to the guy in
 charge of Requisitions and have found out the budget for books is in
 great shape.

 So, I'm curious what books people know of that have R examples and are
 good for:

 1.) Uni and Multivariate Time Series Analysis/Forecasting

 2.) GLMs (at this point it looks like I'll be focusing on nominal and
 ordinal regression models)

 3.) Survival Models

 4.) Multiple Regression

 Any suggestions would be awesome. :)

 thanks,

 -Max

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
===
WenSui Liu
Statistical Project Manager
ChoicePoint Precision Marketing
(http://spaces.msn.com/statcompute/blog)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Re commended textbooks for R?

2007-11-29 Thread Max
Thanks guys for the recomendations! :)



aaront wrote on 11/29/2007 :
 I am currently using: ---John Maindonald and John Braun. Data Analysis and
 Graphics Using R--- and find it very useful, note that there now is a 2007
 edition.

 Most of the texts mentioned in the previous link have reviews on Amazon.


 Jared O'Connell-2 wrote:
 
 This page may be helpful :)
 
  http://www.r-project.org/doc/bib/R-books.html
 
 Modern Applied Statistics with S is quite broad and very good.
 
 On Nov 28, 2007 4:38 PM, Max [EMAIL PROTECTED] wrote:
 Hi everyone!
 
 I've recently begun to learn R for my job as the IT department suffers
 from lack of funding for new software. I was talking to the guy in
 charge of Requisitions and have found out the budget for books is in
 great shape.
 
 So, I'm curious what books people know of that have R examples and are
 good for:
 
 1.) Uni and Multivariate Time Series Analysis/Forecasting
 
 2.) GLMs (at this point it looks like I'll be focusing on nominal and
 ordinal regression models)
 
 3.) Survival Models
 
 4.) Multiple Regression
 
 Any suggestions would be awesome. :)
 
 thanks,
 
 -Max
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to manipulate a data frame

2007-11-29 Thread affy snp
Dear list,
I have a data frame like:

 log2.ratios[1:3,1:4]
   Clone  a1 a2 a3
1 GS1-232B23  -0.0207500 0.17553833  0.21939333
2 RP11-82D16  -0.1896667 0.02645167 -0.03112333
3 RP11-62M23  -0.1761700 0.08214500 -0.04877000

how to make it to look like:

 log2.ratios[1:3,1:4]
 a1 a2 a3
 a4
GS1-232B23  -0.0207500 0.17553833  0.21939333 0.0008
RP11-82D16  -0.1896667 0.02645167 -0.03112333 0.007
RP11-62M23  -0.1761700 0.08214500 -0.048770000.7666

I tried as.matrix(log2.ratios) and it seems it is not working.

Thanks a lot!

Allen

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R as server application

2007-11-29 Thread Scionforbai
I found this link:

http://jesus-loves-grass.blogspot.com/search/label/R%20server

Which points to RSOAP and Rserver.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to read in a txt file with some blanks

2007-11-29 Thread affy snp
Hi Jim,
Thanks! The pattern for blanks varies. It could
be any of scenarios you outlined. Other folks
pointed out the problem can be solved by
specifying sep=\t in read.table().

Best,
  Allen

On Nov 28, 2007 10:12 PM, jim holtman [EMAIL PROTECTED] wrote:

 The question is what do the 'blanks' mean?  I assume that they are
 separating the variables since that is the default for read.table.

 So what is the difference between:

 1) 1 2   one blank
 2) 1  2  two blanks
 3) 1   2 three blanks
 4)

 How are these different conditions supposed to be interpreted?  Now
 you replace the blanks with commas and that might do it for you. This
 would mean that 1  2 (which would be two variables where there are 2
 blanks) would now be 1,,2  which would be three variables.  So you
 need to define what is supposed to happen in these cases.

 On Nov 28, 2007 8:21 PM, affy snp [EMAIL PROTECTED] wrote:
  Hi Jim,
 
  Thanks a lot! I would like the blanks to be read as NAs.
  I tried
 
  cgh-read.table(file= WM115A.txt,header = TRUE,fill = TRUE,na.strings=
  NA)
 
  but the blanks were just filled by their flanking columns.
 
  Best,
   Allen
 
 
 
 
  On Nov 28, 2007 7:42 PM, jim holtman [EMAIL PROTECTED] wrote:
   If the data is fixed field, then read.fwf.  Else blanks are normally
   allowed delimiters.  How do you want to interprete blanks?  There are
   number of ways, none of which you have specified.
  
  
  
  
   On Nov 28, 2007 6:46 PM, affy snp  [EMAIL PROTECTED] wrote:
Hi list,
Is there a way to read in a txt file with some blanks? The ideal way
  could
be to replace blanks with NAs.
   
Thanks a lot!
   
Allen
   
  
  
  
   [[alternative HTML version deleted]]
   
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
   
  
  
  
   --
   Jim Holtman
   Cincinnati, OH
   +1 513 646 9390
  
   What is the problem you are trying to solve?
  
 
 



 --
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem you are trying to solve?


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] re lative importance of predictors

2007-11-29 Thread Ulrike Grömping

Hi Robert,

relaimpo does work with a (non-robust) linear model, i.e. calculations in
relaimpo are using correlations between variables, and it is not possible to
incorporate things like the Huber psi function. I am not an expert on robust
regression, but I try to answer your question from the relaimpo point of
view.

If you run relaimpo on an rlm object, it will calculate relative importances
based on the linear model with your prior weights (that you optionally
specify with weights in rlm). 
I suppose it would be more appropriate to run relaimpo on your model with
the weights as determined by rlm (stored in the w component of the output
object, if I correctly interpret the help on rlm); you would have to do that
explicitly, at least currently, since relaimpo uses the weights() function
on the linear model object, and weights(rlm) returns the weights component
of the output object. If a relative importance calculation within a linear
model with modified weights (from w=) is a desirable solution for (at
least special cases of) rlm objects, this can be incorporated into a future
version of relaimpo as the default for these cases. I think it won't be
possible to incorporate psi-functions.

While I am at it: When trying out rlm, I was surprised that specifying w=
without simultaneously using the weights=-option apparently interprets w=
as weights=, i.e. the weights component of the resulting rlm object contains
the initial w-values. On the other hand, when specifying both the weights
and the w option, the weights component of the resulting rlm object contains
the weights only and ignores the w-Option. This seems to me somewhat
inconsistent.

Regards, Ulrike


robert.ptacnik wrote:
 
 Hei Group,
 
 I want to compare the relative importance of predictors in a multiple
 linear regression y~a+bx1+cx2...
 
 However, bptest indicates heteroskedasticity of my model. I therefore
 perform a robust regression (rlm), in combination with bootstrapping (as
 outlined in J. Fox, Bootstrapping Regression Models).
 
 Now I want to compare the relative importance of my predictors. Can I rely
 on the output of 'relaimpo' here? (which takes 'lm', not 'rlm' objects).
 
 Thanks,
 Robert
 
 
 
 
 --
 NIVAs hovedkontor har flyttet til nye lokaler i CIENS - Forskningssenter
 for miljø og samfunn; Gaustadalléen 21, 0349 Oslo. Meld deg på vårt
 nyhetsbrev på www.niva.no
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/relative-importance-of-predictors-tf4897731.html#a14028871
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] str() options

2007-11-29 Thread Thompson, David (MNR)
Beautiful!

Exactly what I was looking for.

Thank you, Gabor
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: November 27, 2007 05:02 PM
To: Thompson, David (MNR)
Subject: Re: [R] str() options

On Nov 27, 2007 1:55 PM, Thompson, David (MNR)
[EMAIL PROTECTED] wrote:
 Hello,

 Is there a way to have str() and ls.str() return all factor levels?


str is an S3 generic so you can define your own str.factor.  Here
we show the usual str and then show it again after we have
added our own str.factor:

 str(iris)
'data.frame':   150 obs. of  5 variables:
 $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
 $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
 $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
 $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
 $ Species : Factor w/ 3 levels setosa,versicolor,..: 1 1 1 1
1 1 1 1 1 1 ...

 str.factor - function(object, ...) {
+ cat(factor w/, nlevels(object), levels, levels(object), \n)
+ }
 str(iris)
'data.frame':   150 obs. of  5 variables:
 $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
 $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
 $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
 $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
 $ Species :factor w/ 3 levels setosa versicolor virginica


*
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
[EMAIL PROTECTED]
http://ofri.mnr.gov.on.ca

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to manipulate a data frame

2007-11-29 Thread Ben Bolker



affy snp wrote:
 
 Dear list,
 I have a data frame like:
 
 log2.ratios[1:3,1:4]
Clone  a1 a2 a3
 1 GS1-232B23  -0.0207500 0.17553833  0.21939333
 2 RP11-82D16  -0.1896667 0.02645167 -0.03112333
 3 RP11-62M23  -0.1761700 0.08214500 -0.04877000
 
 how to make it to look like:
 
 log2.ratios[1:3,1:4]
  a1 a2 a3
  a4
 GS1-232B23  -0.0207500 0.17553833  0.21939333 0.0008
 RP11-82D16  -0.1896667 0.02645167 -0.03112333 0.007
 RP11-62M23  -0.1761700 0.08214500 -0.048770000.7666
 

log2.ratios = data.frame(
  Clone=c(GS1-232B23,
RP11-82D16,
RP11-62M23),
  a1= c(-0.0207500,-0.1896667,-0.1761700),
  a2 = c(0.17553833,0.02645167,0.08214500),
  a3 = c(0.21939333,-0.03112333,-0.04877000),
  a4 = c(0.0008,0.007,0.7666))

log2.ratios[1:3,1:4]

rownames(log2.ratios) - as.character(log2.ratios[,1])
log2.ratios - log2.ratios[,-1]  



-- 
View this message in context: 
http://www.nabble.com/How-to-manipulate-a-data-frame-tf4898180.html#a14030339
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about using “par”

2007-11-29 Thread Charilaos Skiadas
On top of which, you should expect a setting of mfrow=c(1,2) like you  
have to only allow you to put two figures in 1 row and 2 columns.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

On Nov 29, 2007, at 9:35 AM, Dieter Menne wrote:

 cathelf cathelf at hotmail.com writes:

 Sorry for bothering your guys again. I am trying to use par to  
 put 6
 figures into 3 rows and 2 columns. My code is:

 op - par(mfrow = c(1, 2))
 xyplot(x1+x2+x3 ~ y, data=resulta, type=l, pch=LETTERS[1:3],  
 lty=c(1:3),
 main=For k=3, theata1=1)
 xyplot(x1+x2+x3  ~ y, data=resultb, type=l, pch=LETTERS[1:3],  
 lty=c(1:3),
 main=For k=3, theata1=5)
 

 But I can only get one figure in one page, not 6 figures in one  
 page. Is
 there any other parameter I should specify? There is no error  
 indicated.

 Rule of thumb: what's documented under the header trellis or  
 lattice does not
 use par.

 xyplot is a lattice/trellis function, which does not honor par(...)  
 settings,
 but uses package grid for layout and everthing else.

 So either use standard plot
   plot(rnorm(100),rnorm(100))

 or do something like:

 p = xyplot(whatever)
 print(p,split=c(1,1,2,2), more=TRUE)
 p = xyplot(whoever,...
 print(p,split=c(1,2,2,2), more=TRUE)

 See print.trellis for details.

 Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Bootstrap Correlation Coefficient with Moving Block Bootstrap

2007-11-29 Thread Andreas Klein
Hello.

I have got two problems in bootstrapping from
dependent data sets.

Given two time-series x and y. Both consisting of n
observations with x consisting of dependent and y
consisting of independent observations over time. Also
assume, that the optimal block-length l is given.

To obtain my bootstrap sample, I have to draw
pairwise, but there is the problem of dependence of
the x-observations and so if I draw the third
observation of y, I cannot simply draw the third
observation of x (to retain the serial correlation
structure between x and y), because I devided x into
blocks of length l and I have to draw blocks, then I
draw from x.

1.
How can I compute a bootstrap sample of the
correlation coefficient between x and y with respect
to the dependence in time-series of x?

2.
How does it look like, if x and y both consist of
dependent observations?



I hope you can help me. I got really stuck with this
problem.

Sincerly
Klein.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Data sets with usage in documentation object but not in code

2007-11-29 Thread Prof Brian Ripley
On Thu, 29 Nov 2007, Jonathan Weeks wrote:

 All,

 I recently made some changes to my package and ran R CMD check, but I
 am getting a warning regarding my data sets.

 I am running R 2.6.1 I have an image (.RData) file containing five
 data sets in the data subdirectory and an .Rd file for each of the
 data sets in the man subdirectory. When I run the check I get the
 warning
 Data sets with usage in documentation object dataset name but not
 in code for each dataset. I did not get this warning with R 2.5

 Does anyone have a suggestion for how to handle this?

Show us a small reproducible example, or (failing that) make the package 
available for test?  It's hard to guess at the cause, and hundreds of 
packages do similar things.

-- 
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to align the text in the legend

2007-11-29 Thread Wang, Zhaoming (NIH/NCI) [C]
Hello,

 

I tried to align lines of text in the legend of a plot.  It always
defaults to the central alignment.  How can I adjust it to be left
alignment?

Here is the code fragment written in python using Rpy module:

 

  text = 'Quantiles #Loci\n'

  text += '%s %6d\n' % (' 100',totalloci)

  text += '%s %6d\n' % ('  95',per95cntloci)

  text += '%s %6d\n' % ('  50',per50cntloci)

  r.legend(20,30,text,cex=0.6,bty='n')

 

 

Thanks

Zhaoming


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] coloring leaves in clustering

2007-11-29 Thread Martin Maechler
 EC == Eleni Christodoulou [EMAIL PROTECTED]
 on Thu, 29 Nov 2007 18:25:46 +0200 writes:

EC Hello everyone,
EC I wanted to know if it was possible to change the color of certain 
leaves in
EC a hclust object in order to make my graph more readable. I know I can 
color
EC certain groups but I would like to enter a vector telling the plot 
function
EC which leaves to color in which color.

Yes, you can do this.
Produce a dendrogram (S3 class) object from your hclust result

 hc - hclust(...)
 X - as.dendrogram(hc)

and then work with that (add 'nodePar' properties to certain nodes).

  example(plot.dendrogram)

gives you a glimpse of the possibilities.
Someone else will have to give you details,
or provide you with utility functions maybe using
dendrapply() to achieve what you want.

Regards,
Martin Maechler, ETH Zurich

EC Thanks in advance,

EC Eleni

EC [[alternative HTML version deleted]]
^

Please do avoid the above by *NOT* sending [text plus html] e-mails,
{as the posting guide has been asking ..}

EC 

EC PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
EC .

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Data sets with usage in documentation object but not in code

2007-11-29 Thread Peter Dalgaard
Prof Brian Ripley wrote:
 On Thu, 29 Nov 2007, Jonathan Weeks wrote:

   
 All,

 I recently made some changes to my package and ran R CMD check, but I
 am getting a warning regarding my data sets.

 I am running R 2.6.1 I have an image (.RData) file containing five
 data sets in the data subdirectory and an .Rd file for each of the
 data sets in the man subdirectory. When I run the check I get the
 warning
 Data sets with usage in documentation object dataset name but not
 in code for each dataset. I did not get this warning with R 2.5

 Does anyone have a suggestion for how to handle this?
 

 Show us a small reproducible example, or (failing that) make the package 
 available for test?  It's hard to guess at the cause, and hundreds of 
 packages do similar things.

   
You could also look at the output of

tools:::list_data_in_pkg(yourPkg) 

and see if it makes you any wiser. (AFAICS, this is the list that the
usage lines get compared to)

-- 
   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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to manipulate a data frame

2007-11-29 Thread affy snp
Thanks a lot, Petr.
Allen

On Nov 29, 2007 12:12 PM, Petr PIKAL [EMAIL PROTECTED] wrote:

 Hi

 I just guess what you want but maybe

 rownames(log2.ratios) -log2ratios$Clone

 changes rownames and then you could get your output (after getting rid of
 first column).

 If you just want an output to spreadsheet without row names column, look
 at ?write.table especially row.names option.

 regards
 Petr
 [EMAIL PROTECTED]

 [EMAIL PROTECTED] napsal dne 29.11.2007 17:06:57:

  Dear list,
  I have a data frame like:
 
   log2.ratios[1:3,1:4]
 Clone  a1 a2 a3
  1 GS1-232B23  -0.0207500 0.17553833  0.21939333
  2 RP11-82D16  -0.1896667 0.02645167 -0.03112333
  3 RP11-62M23  -0.1761700 0.08214500 -0.04877000
 
  how to make it to look like:
 
   log2.ratios[1:3,1:4]
   a1 a2 a3
   a4
  GS1-232B23  -0.0207500 0.17553833  0.21939333 0.0008
  RP11-82D16  -0.1896667 0.02645167 -0.03112333 0.007
  RP11-62M23  -0.1761700 0.08214500 -0.048770000.7666
 
  I tried as.matrix(log2.ratios) and it seems it is not working.
 
  Thanks a lot!
 
  Allen
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Odp: How to align the text in the legend

2007-11-29 Thread Petr PIKAL
Well, did you look at xjust, yjust options of legend?
And maybe it would be worth to check adj graphic parameter see ?par

Petr

[EMAIL PROTECTED] napsal dne 29.11.2007 18:14:55:

 Hello,
 
 
 
 I tried to align lines of text in the legend of a plot.  It always
 defaults to the central alignment.  How can I adjust it to be left
 alignment?
 
 Here is the code fragment written in python using Rpy module:
 
 
 
   text = 'Quantiles #Loci\n'
 
   text += '%s %6d\n' % (' 100',totalloci)
 
   text += '%s %6d\n' % ('  95',per95cntloci)
 
   text += '%s %6d\n' % ('  50',per50cntloci)
 
   r.legend(20,30,text,cex=0.6,bty='n')
 
 
 
 
 
 Thanks
 
 Zhaoming
 
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Working with time series class object

2007-11-29 Thread lmiceli

  Hi

  I have a daily time series dataset, witch is very irregular spaced.

  The data is stored in a text file with the fields;

  day;month;year;stock1 price; stock2 price;...;stockN price

  The problem is that a script like described below, will result in a not
  very useful time count in the object.

  For example, ts.plot does not produce a good time format in the
  horizontal axis.

  So, what is a correct way to work with irregular time series? Is there
  another class that work with irregular time series?

  script:
  Object -ts(data =dataset, start = 1, end = dim(dataset)[1],deltat = 1,
  ts.eps = getOption(ts.eps), class =mts)

  Where dataset is a numerical matrix with the data.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to take the ave of two rows in a data frame

2007-11-29 Thread affy snp
 Dear list,
 I have a data frame like:

  log2.ratios[1:3,1:4]
ID  a1 a2 a3
 1 GS1-232B23  -0.0207500 0.17553833  0.21939333
 2 RP11-82D16  -0.1896667 0.02645167 -0.03112333
 3 RP11-62M23  -0.1761700 0.08214500 -0.04877000
 4 RP11-62M23  0.2761700 -0.15214500 -0.05877000


the 3rd and 4th rows are of the same ID, I would like to take the avarage of
these
two rows and get the data frame to:

ID  a1 a2 a3
1 GS1-232B23  -0.0207500 0.17553833  0.21939333
2 RP11-82D16  -0.1896667 0.02645167 -0.03112333
3 RP11-62M23  -0.05 -0.035   0.094135

Can anyone suggest how to deal with this (to take the ave of two rows of the
same ID ) more quickly?

Thanks a bunch!

Allen

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Question on structuring variances using the lme4 package

2007-11-29 Thread Catherine A. Holt

I am modeling the effects of an environmental variable (X) on fish recruitment 
(Y) for several, ecologically related species (i) using a mixed-effects model. 
The linear relationship between X and Y includes a fixed effect that is common 
across all species and random effects that vary by species. In the lmer() 
notation from the package lme4:

Model- lmer(Y ~ X +(X|i))

Because the residuals of the model are autocorrelated and the variances differ 
among species, I would like to include an AR(1) process, and species-specific 
variances. I have been unable to do this so far in lme4. In the older “nlme” 
package, this was possible using:

Model-update (weights=varIdent(form= ~1|i), correlation = corAR1(form = ~ 
years|i)

Is this possible in lme4, and if so, how? Any help would be much appreciated. 
Cheers,

Carrie Holt, Ph.D., M.Sc., B.Sc.(Honours)
University of Washington
School of Aquatic  Fishery Sciences
Box 355020
Seattle, WA 98195
USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MS Excel Data

2007-11-29 Thread AA
The package RODBC by Pr. Ripley is very helpful for this
(Thanks To B. Ripley).
Also see the package xlsReadWrite (thanks to H.P Suter).
The latter is maybe easier to use.
Good luck
AA.

- Original Message - 
From: faisal afzal siddiqui [EMAIL PROTECTED]
To: r-help@r-project.org
Sent: Wednesday, November 28, 2007 10:54 PM
Subject: [R] MS Excel Data


I am using MS Excel (Windos Operating system), how I
 import/export data between MS_Excel and R.

 Regds
 Faisal Afzal SIddiqui
 +92-300-9297089
 [EMAIL PROTECTED]


 
 
 Never miss a thing.  Make Yahoo your home page.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] image() plot with z not in matrix format

2007-11-29 Thread Julian Burgos
Hello Marc,

Well, image() requires data values in a regular grid.  So you need to 
interpolate your data to a regular grid before you do your plot.  There 
are many interpolation methods, but a good place to start is to do 
linear interpolation.  You should first use expand.grid() to create the 
regular grid where to interpolate your data.  Then use the interp() 
function (in the akima package) to do the interpolation.  Finally, to do 
the plot you can use image() or better yet, the plot.surface() function 
in the 'fields' package, which is an improved version of the image() 
function.

I hope that helps,

Julian


[EMAIL PROTECTED] wrote:
 Hello R cracks
 
 The image() function requires strictly increasing x and y values and z as a 
 matrix.
 
 Actually, I don't have equally spaced variables, but anyway want to plot an 
 colored image() (with z-information).
 
 An example of my problem is here:
 
 a-data.frame(rnorm(100), rnorm(100), runif(100)*100)
 
 How can I plot this data as an image (x=a[,1], y=a[,2] and z=a[,3])- 
 according to ?image.
 It has to be possible to adapt the grid size so that every grid cell in the 
 plot is coloured consequently.
 
 Thanks for your help
 
 Marc
 --
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] fatal error from R function gls

2007-11-29 Thread Maura E Monville
I would appreciate some help with the followiing error ... what did I do
wrong
and what is the woraroud.

 library(nlme)
  glmod - gls(A ~ T +cosP +cos2P +cos4P +cos5P +sin3P +sin5P +cosP2 +sinP3
+P2, correlation=corAR1(),method=ML)
Error: cannot allocate vector of size 491.3 Mb

I have a bunch of humans'  breathing signals. The recording frequency was 30
samples per second.
The only relevant variables are: amplitude, phase (inhale - exhale),
timestamp (time at which each amplitude sample was recorded).
I have to get rid of the time trend of the amplitude, and be left with the
amplitude explained by the phase.
Before devising a way to remove such a trend, it is necessary (I think) to
figure out whether its nature
that is whether such a time trend is linear or not.
*General question:
**Is there any technique and/or method to figure out the nature of the time
trend in a series of data ?*

Thank you in advance to anyone who provides any suggestion.

Best,
-- 
Maura E.M

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Anova(car) SS digits

2007-11-29 Thread Tyler Smith
Hi,

When I use Anova(car) to produce type III SS, 'Sum Sq' is reported in
integers:

 Anova(bot.lm3, type =III)
Anova Table (Type III tests)

Response: bottemp
 Sum Sq  DfF value  Pr(F)
(Intercept)   45295   1 29436.4440  2e-16
fungroup  3   2 0.8259 0.44006
numsp.fun11   2 3.4503 0.03460
block   419   468.0017  2e-16
fungroup:numsp.fun6   4 1.0317 0.39340
fungroup:block9   8 0.7429 0.65346
numsp.fun:block  12   8 0.9501 0.47795
fungroup:numsp.fun:block 27  16 1.0920 0.36882
Residuals   205 133   

I have tried specifying digits = 7 in the call to Anova, but that
doesn't change anything. The output from another stats program for the
same data confirms that the ouptut above is correct, but is rounded to
the nearest integer. The dataset is too large to post here, but I can
confirm that I get the expected results from the examples in ?Anova,
as well as for type = 'II' on my own data. This output, and relevant
options() and sessionInfo are pasted below. What am I doing wrong?

Thanks,

Tyler

  mod - lm(conformity ~ fcategory*partner.status, data=Moore, 
+contrasts=list(fcategory=contr.sum, partner.status=contr.sum))
  Anova(mod)
Anova Table (Type II tests)

Response: conformity
 Sum Sq Df F value   Pr(F)
fcategory 11.61  2  0.2770 0.759564
partner.status   212.21  1 10.1207 0.002874
fcategory:partner.status 175.49  2  4.1846 0.022572
Residuals817.76 39 
  Anova(mod, type=III)
Anova Table (Type III tests)

Response: conformity
 Sum Sq Df  F valuePr(F)
(Intercept)  5752.8  1 274.3592  2.2e-16
fcategory  36.0  2   0.8589  0.431492
partner.status239.6  1  11.4250  0.001657
fcategory:partner.status  175.5  2   4.1846  0.022572
Residuals 817.8 39   

 Anova(bot.lm3, type =II)
Anova Table (Type II tests)

Response: bottemp
 Sum Sq  Df F value  Pr(F)
fungroup   1.87   2  0.6069 0.54656
numsp.fun 11.14   2  3.6214 0.02942
block486.47   4 79.0379  2e-16
fungroup:numsp.fun 6.32   4  1.0275 0.39553
fungroup:block11.43   8  0.9283 0.49542
numsp.fun:block   11.29   8  0.9169 0.50473
fungroup:numsp.fun:block  26.89  16  1.0920 0.36882
Residuals204.65 133

 options('digits')
$digits
[1] 7

 options('contrasts')
$contrasts
[1] contr.sum  contr.poly

 sessionInfo()
R version 2.5.1 (2007-06-27) 
i486-pc-linux-gnu 

locale:

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

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

other attached packages:
car 
1.2-7

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] error in utils:::menuInstallPkgs() for R 2.6.1

2007-11-29 Thread Monica Pisica

Hi,
 
I have upgraded on Windows from R 2.5.1 to R2.6.1 and when i've tried to 
install packages with utils:::menuInstallPkgs() i've got the following error 
(which i never got before)
 
Warning: unable to access index for repository 
http://cran.hostingzero.com/bin/windows/contrib/2.6
Do you have any idea why?
 
Sys.info()  sysname   release   
version  nodename Windows 
 NT 5.1 (build 2600) Service Pack 2   
  machine
x86
Thanks,
 
Monica
 
 
_
Your smile counts. The more smiles you share, the more we donate.  Join in.
www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Wireframe graph: black and white shading instead of color

2007-11-29 Thread David Afshartous


All,

The code below produces a color 3D graph.  I'd like to make it black and
white shading.  I tried setting col.regions to FALSE but this just made it
completely white.  I want the graph to look exactly as is, except black (or
grey) and white shading.  Is this possible?

Cheers,
David


p.list = c(.01, .1, .25, .5, .75, .9)
cov.list = c(.2, .1, .05)  ### leave out .01



X = rep(p.list, 3) 
Y = rep(cov.list, 1, each=6)
Z = c(2475.00,   225.00,75.00,25.00, 8.33,
2.78,  9900.00, 900.00,   300.00,   100.00,
33.33,11.11, 39600.00,  3600.00,
1200.00,   400.00,   133.33,44.4)


lattice.options(default.theme = col.whitebg)



wireframe(Z ~ X * Y, scales = list(arrows = FALSE),

   bg = white, drape = TRUE, shade = FALSE, colorkey = FALSE,
xlab = p, ylab = C.O.V., zlab =n)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] extracting items from R objects and using them in \Sexpr with Sweave--problem with $

2007-11-29 Thread Christopher W. Ryan
Running R 2.5.1 on WinXP with Tinn-R, and using Sweave via MikTex.

I am having trouble with the code below:


---
lowerCI95=
lowerCI95713 - t.test(data713, alternative=greater)
lowerCI95713.bound - lowerCI95713$conf.int[1]
@

Thus a lower 95\% confidence bound on the mean octane concentration is
\Sexpr{lowerCI95713.bound}.

ttest=
t.test713 - t.test(data713, mu=87, alternative=greater)
p.value - t.test713$p.value
@

-


When I Sweave and then pdflatex the files, the output pdf file contains
the verbatim text:

Thus a lower 95% confidence bound on the mean octane concentration is
lowerCI95713.bound.

That is, LaTeX is not recognizing and processing \Sexpr.  When I look at
my .tex file in an editor with LaTeX syntax highlighting, I see that
LaTeX is interpreting everything between the two $ in the original code
(one before conf.int and one before p.value) as a math environment.  I
think that's why the \Sexpr is not getting processed into the single
number as it should.

Any ideas how to make this work?  The $ is the only way I know how to
access components of R objects.

Thank you.

--Chris
-- 
Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
40 Arch Street, Johnson City, NY  13790
cryanatbinghamtondotedu
PGP public keys available at http://home.stny.rr.com/ryancw/

If you want to build a ship, don't drum up the men to gather wood,
divide the work and give orders. Instead, teach them to yearn for the
vast and endless sea.  [Antoine de St. Exupery]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question on structuring variances using the lme4 package

2007-11-29 Thread Dieter Menne
Catherine A. Holt caholt at u.washington.edu writes:

 I am modeling the effects of an environmental variable (X) on fish recruitment
(Y) for several,
 ecologically related species (i) using a mixed-effects model. The linear
relationship between X and Y
 includes a fixed effect that is common across all species and random effects
that vary by species. In the
 lmer() notation from the package lme4:
 
 Model- lmer(Y ~ X +(X|i))
 
 Because the residuals of the model are autocorrelated and the variances differ
among species, I would like
 to include an AR(1) process, and species-specific variances. I have been
unable to do this so far in lme4.
 In the older “nlme” package, this was possible using:
 
 Model-update (weights=varIdent(form= ~1|i), correlation = corAR1(form = ~
years|i)
 
 Is this possible in lme4, and if so, how? Any help would be much appreciated. 
 Cheers,

No, it is not (yet) possible. Any reason not use lme? It works, and it is
stable, and well documented (Pinheiro/Bates)? 

lmer is a package in development, it has been made public mainly to provide
feedback to the author, Douglas Bates. 

See also the special list 

http://news.gmane.org/gmane.comp.lang.r.lme4.devel

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] error in utils:::menuInstallPkgs() for R 2.6.1

2007-11-29 Thread Uwe Ligges


Monica Pisica wrote:
 Hi,
  
 I have upgraded on Windows from R 2.5.1 to R2.6.1 and when i've tried to 
 install packages with utils:::menuInstallPkgs() i've got the following error 
 (which i never got before)
  
 Warning: unable to access index for repository 
 http://cran.hostingzero.com/bin/windows/contrib/2.6

This CRAN mirror seems to be offline. Just choose another one.

Uwe


 Do you have any idea why?
  
 Sys.info()  sysname   release 
   version  nodename 
 Windows  NT 5.1 (build 2600) Service Pack 2 
   
   machine
 x86
 Thanks,
  
 Monica
  
  
 _
 Your smile counts. The more smiles you share, the more we donate.  Join in.
 www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline
   [[alternative HTML version deleted]]
 
 
 
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MS Excel Data

2007-11-29 Thread Gabor Grothendieck
On Nov 29, 2007 3:01 PM, Bert Gunter [EMAIL PROTECTED] wrote:
 This has been discussed on this list many times before. Google on Import
 Excel R. Note also that there are potential problems (loss of digits) due
 to Excel idiosyncracies depending on what you do.
 http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html  provides
 some details.

 Finally, I have found that for rectangular data sets with no missing fields
 in Excel (tables), cutting and read.tabling **the data only ** is a
 simple(but probably not without risk) way to do it:

 (after cutting the data only in Excel to the clipboard) in R:

 newdat - read.table(clipboard, head=FALSE, row.names=NULL)

 The columns can then be named via names(newdat) - ...

 I omit column headers because in most of the Excel data I get the column
 names have spaces and other non-alphanumeric characters which R cannot
 easily digest. One could separately scan() just the vector of column headers
 and use regular expressions to extract the names. But for small tables, I
 find it easier just to create the names manually.

You can include headers with spaces in the copy with:

DF - read.delim(clipboard)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Anova(car) SS digits

2007-11-29 Thread Tyler Smith
On 2007-11-29, John Fox [EMAIL PROTECTED] wrote:

 Anova() creates an object of class anova which then gets printed by the
 print method for anova objects. The reason that the sums of squares for
 the type II tests are rounded like this is because of the large value for
 the intercept. Although Anova() doesn't take a digits argument,
 print.anova() does, and so, e.g., you could use the command

 print(Anova(bot.lm3, type =III), digits=7)

 I hope this helps,
  John

Very much. Thanks!

Tyler

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wireframe graph: black and white shading instead of color

2007-11-29 Thread Deepayan Sarkar
On 11/29/07, David Afshartous [EMAIL PROTECTED] wrote:


 All,

 The code below produces a color 3D graph.  I'd like to make it black and
 white shading.  I tried setting col.regions to FALSE but this just made it
 completely white.  I want the graph to look exactly as is, except black (or
 grey) and white shading.  Is this possible?

Perhaps you want something like

wireframe(Z ~ X * Y, drape = TRUE, par.settings = standard.theme(color = FALSE))

Generally, for black and white output, the recommended approach is to
start a device using

trellis.device(..., color = FALSE)

The call above attaches the resulting settings to the particular
object rather than the device.

-Deepayan



 Cheers,
 David


 p.list = c(.01, .1, .25, .5, .75, .9)
 cov.list = c(.2, .1, .05)  ### leave out .01



 X = rep(p.list, 3)
 Y = rep(cov.list, 1, each=6)
 Z = c(2475.00,   225.00,75.00,25.00, 8.33,
 2.78,  9900.00, 900.00,   300.00,   100.00,
 33.33,11.11, 39600.00,  3600.00,
 1200.00,   400.00,   133.33,44.4)


 lattice.options(default.theme = col.whitebg)



 wireframe(Z ~ X * Y, scales = list(arrows = FALSE),

bg = white, drape = TRUE, shade = FALSE, colorkey = FALSE,
 xlab = p, ylab = C.O.V., zlab =n)

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to align the text in the legend

2007-11-29 Thread Wang, Zhaoming (NIH/NCI) [C]
Thanks Petr!
I checked both of your suggestions and nothing seems working for me.
I don't understand why the well-formatted text string got re-aligned in
the legend of plot.

This is what I got:
Quantitles   #Samples
 1002759
  95 121
  50  0

And here is what I'm looking for:
Quantitles   #Samples
 100 2759
  95  121
  500


-Original Message-
From: Petr PIKAL [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 29, 2007 12:35 PM
To: Wang, Zhaoming (NIH/NCI) [C]
Cc: r-help@r-project.org
Subject: Odp: [R] How to align the text in the legend

Well, did you look at xjust, yjust options of legend?
And maybe it would be worth to check adj graphic parameter see ?par

Petr

[EMAIL PROTECTED] napsal dne 29.11.2007 18:14:55:

 Hello,
 
 
 
 I tried to align lines of text in the legend of a plot.  It always
 defaults to the central alignment.  How can I adjust it to be left
 alignment?
 
 Here is the code fragment written in python using Rpy module:
 
 
 
   text = 'Quantiles #Loci\n'
 
   text += '%s %6d\n' % (' 100',totalloci)
 
   text += '%s %6d\n' % ('  95',per95cntloci)
 
   text += '%s %6d\n' % ('  50',per50cntloci)
 
   r.legend(20,30,text,cex=0.6,bty='n')
 
 
 
 
 
 Thanks
 
 Zhaoming
 
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to align the text in the legend

2007-11-29 Thread jim holtman
Have you tried a non-proportional font like Courier?

On Nov 29, 2007 12:14 PM, Wang, Zhaoming (NIH/NCI) [C]
[EMAIL PROTECTED] wrote:
 Hello,



 I tried to align lines of text in the legend of a plot.  It always
 defaults to the central alignment.  How can I adjust it to be left
 alignment?

 Here is the code fragment written in python using Rpy module:



  text = 'Quantiles #Loci\n'

  text += '%s %6d\n' % (' 100',totalloci)

  text += '%s %6d\n' % ('  95',per95cntloci)

  text += '%s %6d\n' % ('  50',per50cntloci)

  r.legend(20,30,text,cex=0.6,bty='n')





 Thanks

 Zhaoming


[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to align the text in the legend

2007-11-29 Thread Wang, Zhaoming (NIH/NCI) [C]
Can you give me a little more in detail?  I'm new to this.
Thanks
Zhaoming

-Original Message-
From: jim holtman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 29, 2007 4:05 PM
To: Wang, Zhaoming (NIH/NCI) [C]
Cc: r-help@r-project.org
Subject: Re: [R] How to align the text in the legend

Have you tried a non-proportional font like Courier?

On Nov 29, 2007 12:14 PM, Wang, Zhaoming (NIH/NCI) [C]
[EMAIL PROTECTED] wrote:
 Hello,



 I tried to align lines of text in the legend of a plot.  It always
 defaults to the central alignment.  How can I adjust it to be left
 alignment?

 Here is the code fragment written in python using Rpy module:



  text = 'Quantiles #Loci\n'

  text += '%s %6d\n' % (' 100',totalloci)

  text += '%s %6d\n' % ('  95',per95cntloci)

  text += '%s %6d\n' % ('  50',per50cntloci)

  r.legend(20,30,text,cex=0.6,bty='n')





 Thanks

 Zhaoming


[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] extracting items from R objects and using them in \Sexpr with Sweave--problem with $

2007-11-29 Thread Charles C. Berry
On Thu, 29 Nov 2007, Christopher W. Ryan wrote:

 Running R 2.5.1 on WinXP with Tinn-R, and using Sweave via MikTex.

 I am having trouble with the code below:


 ---
 lowerCI95=
 lowerCI95713 - t.test(data713, alternative=greater)
 lowerCI95713.bound - lowerCI95713$conf.int[1]
 @

 Thus a lower 95\% confidence bound on the mean octane concentration is
 \Sexpr{lowerCI95713.bound}.

 ttest=
 t.test713 - t.test(data713, mu=87, alternative=greater)
 p.value - t.test713$p.value
 @

 -


 When I Sweave and then pdflatex the files, the output pdf file contains
 the verbatim text:

 Thus a lower 95% confidence bound on the mean octane concentration is
 lowerCI95713.bound.

Adding

data713 - rnorm(10)

at the start of the first chunk (provide commented, minimal, 
self-contained, reproducible code), and running this as

 sessionInfo()
R version 2.6.0 (2007-10-03)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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


I got

Thus a lower 95\% confidence bound on the mean octane concentration is
-0.204003137749730.



 That is, LaTeX is not recognizing and processing \Sexpr.


Nor should it. That is Sweave's job.

When I look at
 my .tex file in an editor with LaTeX syntax highlighting, I see that
 LaTeX is interpreting everything between the two $ in the original code
 (one before conf.int and one before p.value) as a math environment.  I
 think that's why the \Sexpr is not getting processed into the single
 number as it should.

 Any ideas how to make this work?  The $ is the only way I know how to
 access components of R objects.

First, give us commented, minimal, self-contained, reproducible code.

I suspect there is something upstream of what you provided that 
caused the problem. Perhaps narrowing your focus will reveal what it is, 
but in any case we must guess what your problem is without reproducible 
code.

HTH,

Chuck

p.s. Time for you and me both to upgrade to R-2.6.1




 Thank you.

 --Chris
 -- 
 Christopher W. Ryan, MD
 SUNY Upstate Medical University Clinical Campus at Binghamton
 40 Arch Street, Johnson City, NY  13790
 cryanatbinghamtondotedu
 PGP public keys available at http://home.stny.rr.com/ryancw/

 If you want to build a ship, don't drum up the men to gather wood,
 divide the work and give orders. Instead, teach them to yearn for the
 vast and endless sea.  [Antoine de St. Exupery]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How can R be used to solve algebra equations?

2007-11-29 Thread Søren Højsgaard
The Ryacas package might be able to do it...
Søren



Fra: [EMAIL PROTECTED] på vegne af francogrex
Sendt: to 29-11-2007 22:00
Til: r-help@r-project.org
Emne: [R] How can R be used to solve algebra equations?




suppose I have this equation:
(x^2+y^2+3z^3)/(5*z^2*x^3)=0

and I want to find x in relation to the other variables which actually is:

x=sqrt(-3*z^3-y^2) or x=-sqrt(-3*z^3-y^2)

Can R give me this expression solution? I know there is uniroot, but here I
want the expression not the value, because I do  not have values for y and
z.

Thanks
--
View this message in context: 
http://www.nabble.com/How-can-R-be-used-to-solve-algebra-equations--tf4899794.html#a14034422
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How can R be used to solve algebra equations?

2007-11-29 Thread Gabor Grothendieck
Yes, try this:


 library(Ryacas)
Loading required package: XML
 x - Sym(x)
 y - Sym(y)
 z - Sym(z)
 Solve((x^2+y^2+3*z^3)/(5*z^2*x^3)==0, x)
[1] Starting Yacas!
expression(list(x == root(-(4 * (y^2 + 3 * z^3)), 2)/2, x ==
-root(-(4 * (y^2 + 3 * z^3)), 2)/2))



On Nov 29, 2007 5:06 PM, Søren Højsgaard [EMAIL PROTECTED] wrote:
 The Ryacas package might be able to do it...
 Søren

 

 Fra: [EMAIL PROTECTED] på vegne af francogrex
 Sendt: to 29-11-2007 22:00
 Til: r-help@r-project.org
 Emne: [R] How can R be used to solve algebra equations?





 suppose I have this equation:
 (x^2+y^2+3z^3)/(5*z^2*x^3)=0

 and I want to find x in relation to the other variables which actually is:

 x=sqrt(-3*z^3-y^2) or x=-sqrt(-3*z^3-y^2)

 Can R give me this expression solution? I know there is uniroot, but here I
 want the expression not the value, because I do  not have values for y and
 z.

 Thanks
 --
 View this message in context: 
 http://www.nabble.com/How-can-R-be-used-to-solve-algebra-equations--tf4899794.html#a14034422
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to align the text in the legend

2007-11-29 Thread jim holtman
try this when plotting the legend:

plot(...)
par(family='mono')
legend('topright', legend=)

This should use fixed width fonts for your legend.

On Nov 29, 2007 4:20 PM, Wang, Zhaoming (NIH/NCI) [C]
[EMAIL PROTECTED] wrote:
 Can you give me a little more in detail?  I'm new to this.
 Thanks
 Zhaoming


 -Original Message-
 From: jim holtman [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 29, 2007 4:05 PM
 To: Wang, Zhaoming (NIH/NCI) [C]
 Cc: r-help@r-project.org
 Subject: Re: [R] How to align the text in the legend

 Have you tried a non-proportional font like Courier?

 On Nov 29, 2007 12:14 PM, Wang, Zhaoming (NIH/NCI) [C]
 [EMAIL PROTECTED] wrote:
  Hello,
 
 
 
  I tried to align lines of text in the legend of a plot.  It always
  defaults to the central alignment.  How can I adjust it to be left
  alignment?
 
  Here is the code fragment written in python using Rpy module:
 
 
 
   text = 'Quantiles #Loci\n'
 
   text += '%s %6d\n' % (' 100',totalloci)
 
   text += '%s %6d\n' % ('  95',per95cntloci)
 
   text += '%s %6d\n' % ('  50',per50cntloci)
 
   r.legend(20,30,text,cex=0.6,bty='n')
 
 
 
 
 
  Thanks
 
  Zhaoming
 
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 



 --
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem you are trying to solve?




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How can R be used to solve algebra equations?

2007-11-29 Thread Daniel Lakeland
On Thu, Nov 29, 2007 at 01:00:59PM -0800, francogrex wrote:
 
 suppose I have this equation:
 (x^2+y^2+3z^3)/(5*z^2*x^3)=0
 
 and I want to find x in relation to the other variables which actually is:
 
 x=sqrt(-3*z^3-y^2) or x=-sqrt(-3*z^3-y^2)
 
 Can R give me this expression solution? I know there is uniroot, but here I
 want the expression not the value, because I do  not have values for y and
 z.

I suggest the use of maxima rather than R. The two complement each
other very nicely: http://maxima.sf.net



-- 
Daniel Lakeland
[EMAIL PROTECTED]
http://www.street-artists.org/~dlakelan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to align the text in the legend

2007-11-29 Thread Wang, Zhaoming (NIH/NCI) [C]
Thanks Jim!  And it does work!!

Zhaoming

-Original Message-
From: jim holtman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 29, 2007 5:26 PM
To: Wang, Zhaoming (NIH/NCI) [C]
Cc: r-help@r-project.org
Subject: Re: [R] How to align the text in the legend

try this when plotting the legend:

plot(...)
par(family='mono')
legend('topright', legend=)

This should use fixed width fonts for your legend.

On Nov 29, 2007 4:20 PM, Wang, Zhaoming (NIH/NCI) [C]
[EMAIL PROTECTED] wrote:
 Can you give me a little more in detail?  I'm new to this.
 Thanks
 Zhaoming


 -Original Message-
 From: jim holtman [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 29, 2007 4:05 PM
 To: Wang, Zhaoming (NIH/NCI) [C]
 Cc: r-help@r-project.org
 Subject: Re: [R] How to align the text in the legend

 Have you tried a non-proportional font like Courier?

 On Nov 29, 2007 12:14 PM, Wang, Zhaoming (NIH/NCI) [C]
 [EMAIL PROTECTED] wrote:
  Hello,
 
 
 
  I tried to align lines of text in the legend of a plot.  It always
  defaults to the central alignment.  How can I adjust it to be left
  alignment?
 
  Here is the code fragment written in python using Rpy module:
 
 
 
   text = 'Quantiles #Loci\n'
 
   text += '%s %6d\n' % (' 100',totalloci)
 
   text += '%s %6d\n' % ('  95',per95cntloci)
 
   text += '%s %6d\n' % ('  50',per50cntloci)
 
   r.legend(20,30,text,cex=0.6,bty='n')
 
 
 
 
 
  Thanks
 
  Zhaoming
 
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 



 --
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem you are trying to solve?




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How can R be used to solve algebra equations?

2007-11-29 Thread Sundar Dorai-Raj


francogrex said the following on 11/29/2007 1:00 PM:
 suppose I have this equation:
 (x^2+y^2+3z^3)/(5*z^2*x^3)=0
 
 and I want to find x in relation to the other variables which actually is:
 
 x=sqrt(-3*z^3-y^2) or x=-sqrt(-3*z^3-y^2)
 
 Can R give me this expression solution? I know there is uniroot, but here I
 want the expression not the value, because I do  not have values for y and
 z.
 
 Thanks

Try:

library(Ryacas)
yacas(Solve((x^2+y^2+3*z^3)/(5*z^2*x^3)==0, x))

expression(list(x == root(-(4 * (y^2 + 3 * z^3)), 2)/2, x ==
 -root(-(4 * (y^2 + 3 * z^3)), 2)/2))

HTH,

--sundar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] configure the margin of the plot

2007-11-29 Thread Wang, Zhaoming (NIH/NCI) [C]
I'm trying to put two plots side-by-side in two panels.  Since the
y-axis of the two plots is the same, I want to leave out the y-axis of
the second plot.

 

And the two plots look quite separate from each other.  Is there any way
to have them stay closer to each other?  I've tried to adjust mar option
of par but it has a global effect as I see the left margin of the first
plot will be adjusted as well. 

 

Below is the code fragment:

 

r.par(mfrow=[1,2],mar=[5,4,1,1])

r.plot(x,hets,xlim=[0,105],xlab='Samples(%)',ylab='Heterozygosity(%)',co
l=colors,cex=0.6)

...

plot(completion,hets,xlim=[40,100],xlab=Sample
Completion(%),ylab=,col=colors,axes=False,cex=0.6)

 

 

Thanks

Zhaoming


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] List operations in R

2007-11-29 Thread Srinivas Iyyer
hello:

I am very confused when it comes to list operations in
R.

I seek help in the following problem.

I have two different vectors 

myIDs - a character vector with no names to their
elements

x2 - another character vector derived from unlisting a
list where an element has both a name and value. 

I am not happy the way x2 is with names and values to
every element. 


 myIDs[1:10]
 [1] 54898 7083  7031  7083  4175  4605 
7494  5111  960   990

 class(myIDs)
[1] character




Similarly x2 objects is

 x2[1:4]
  1000_at   1001_at 1002_f_at 1003_s_at 
   559570751557 643 

 class(x2)
[1] character


I am not happy the way x2 is right now. I do not want
names of the elements. I want to write to another
object x3 that has only values of the elements and not
their names. 

How can I do that?

I can give a [[]] to get the value of element.
 x2[[1]]
[1] 5595

When I try to give a range of numbers:
 x2[[1:4]]
Error in x2[[1:4]] : attempt to select more than one
element


Frustrated, I wanted to create another object z, and
append all values of x2 to z.

 z = c()
 for(i in 1:length(x2)){
+ append(z,x2[[i]],after=length(z))}
 length(z)
[1] 0


now z is empty. this is really frustrating. Can
someone help me please how to deal in this situation.

Thanks
Sri


  

Be a better pen pal.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] configure the margin of the plot

2007-11-29 Thread jim holtman
try this:

layout(cbind(1,2))
par(mar=c(4,4,2,0))
plot(0)
par(mar=c(4,0,2,0))
plot(0, yaxt='n', ylab='')


On Nov 29, 2007 5:41 PM, Wang, Zhaoming (NIH/NCI) [C]
[EMAIL PROTECTED] wrote:
 I'm trying to put two plots side-by-side in two panels.  Since the
 y-axis of the two plots is the same, I want to leave out the y-axis of
 the second plot.



 And the two plots look quite separate from each other.  Is there any way
 to have them stay closer to each other?  I've tried to adjust mar option
 of par but it has a global effect as I see the left margin of the first
 plot will be adjusted as well.



 Below is the code fragment:



 r.par(mfrow=[1,2],mar=[5,4,1,1])

 r.plot(x,hets,xlim=[0,105],xlab='Samples(%)',ylab='Heterozygosity(%)',co
 l=colors,cex=0.6)

 ...

 plot(completion,hets,xlim=[40,100],xlab=Sample
 Completion(%),ylab=,col=colors,axes=False,cex=0.6)





 Thanks

 Zhaoming


[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] List operations in R

2007-11-29 Thread Rolf Turner
?unname
?unlist

cheers,

Rolf Turner

On 30/11/2007, at 1:07 PM, Srinivas Iyyer wrote:

 hello:

 I am very confused when it comes to list operations in
 R.

 I seek help in the following problem.

 I have two different vectors

 myIDs - a character vector with no names to their
 elements

 x2 - another character vector derived from unlisting a
 list where an element has both a name and value.

 I am not happy the way x2 is with names and values to
 every element.


 myIDs[1:10]
  [1] 54898 7083  7031  7083  4175  4605
 7494  5111  960   990

 class(myIDs)
 [1] character




 Similarly x2 objects is

 x2[1:4]
   1000_at   1001_at 1002_f_at 1003_s_at
559570751557 643

 class(x2)
 [1] character


 I am not happy the way x2 is right now. I do not want
 names of the elements. I want to write to another
 object x3 that has only values of the elements and not
 their names.

 How can I do that?

 I can give a [[]] to get the value of element.
 x2[[1]]
 [1] 5595

 When I try to give a range of numbers:
 x2[[1:4]]
 Error in x2[[1:4]] : attempt to select more than one
 element


 Frustrated, I wanted to create another object z, and
 append all values of x2 to z.

 z = c()
 for(i in 1:length(x2)){
 + append(z,x2[[i]],after=length(z))}
 length(z)
 [1] 0


 now z is empty. this is really frustrating. Can
 someone help me please how to deal in this situation.

 Thanks
 Sri



 __ 
 __
 Be a better pen pal.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MS Excel Data

2007-11-29 Thread apjaworski
Here is a very crude function I use quite often.  It tries to recognize
whether you have headers or not by checking the very first character.  If
it is numeric, it assumes that there are no headers. The suppressWarnings
gets rid of a warning one gets when trying to coerce a character to
numeric.   The main advantage of the function is that you do not have to
type too much :-)

clip - function(){
if(is.na(suppressWarnings(as.numeric(scan(clipboard, what=,
nmax=1)
   read.delim(clipboard)
else
   read.delim(clipboard, header=FALSE)

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Bert Gunter   
 [EMAIL PROTECTED] 
 ne.comTo 
 Sent by:  'Gabor Grothendieck'  
 [EMAIL PROTECTED] [EMAIL PROTECTED]   
 project.orgcc 
   r-help@r-project.org
   Subject 
 11/29/2007 06:39  Re: [R] MS Excel Data   
 PM
   
   
   
   
   




Better yet! Thanks Gabor.

-- Bert

-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 29, 2007 12:10 PM
To: Bert Gunter
Cc: r-help@r-project.org
Subject: Re: [R] MS Excel Data

On Nov 29, 2007 3:01 PM, Bert Gunter [EMAIL PROTECTED] wrote:
 This has been discussed on this list many times before. Google on Import
 Excel R. Note also that there are potential problems (loss of digits)
due
 to Excel idiosyncracies depending on what you do.
 http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html
provides
 some details.

 Finally, I have found that for rectangular data sets with no missing
fields
 in Excel (tables), cutting and read.tabling **the data only ** is a
 simple(but probably not without risk) way to do it:

 (after cutting the data only in Excel to the clipboard) in R:

 newdat - read.table(clipboard, head=FALSE, row.names=NULL)

 The columns can then be named via names(newdat) - ...

 I omit column headers because in most of the Excel data I get the column
 names have spaces and other non-alphanumeric characters which R cannot
 easily digest. One could separately scan() just the vector of column
headers
 and use regular expressions to extract the names. But for small tables, I
 find it easier just to create the names manually.

You can include headers with spaces in the copy with:

DF - read.delim(clipboard)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MS Excel Data

2007-11-29 Thread Bert Gunter
Better yet! Thanks Gabor.

-- Bert

-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 29, 2007 12:10 PM
To: Bert Gunter
Cc: r-help@r-project.org
Subject: Re: [R] MS Excel Data

On Nov 29, 2007 3:01 PM, Bert Gunter [EMAIL PROTECTED] wrote:
 This has been discussed on this list many times before. Google on Import
 Excel R. Note also that there are potential problems (loss of digits) due
 to Excel idiosyncracies depending on what you do.
 http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html  provides
 some details.

 Finally, I have found that for rectangular data sets with no missing
fields
 in Excel (tables), cutting and read.tabling **the data only ** is a
 simple(but probably not without risk) way to do it:

 (after cutting the data only in Excel to the clipboard) in R:

 newdat - read.table(clipboard, head=FALSE, row.names=NULL)

 The columns can then be named via names(newdat) - ...

 I omit column headers because in most of the Excel data I get the column
 names have spaces and other non-alphanumeric characters which R cannot
 easily digest. One could separately scan() just the vector of column
headers
 and use regular expressions to extract the names. But for small tables, I
 find it easier just to create the names manually.

You can include headers with spaces in the copy with:

DF - read.delim(clipboard)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Controlling Postscript output, size and orientation

2007-11-29 Thread Nathan Vandergrift

I'm trying to get my graphics so that I can use them in LaTeX to create (via
) a pdf presentation.

I've tried controlling inner and outer margins and figure size using par(),
to no avail. The ps output keeps appearing as a portrait page with a
centered figure. Nothing I have been able to do so far has changed that.
Below is the code:


par(bg=yellow,
lab=c(10,5,7)
#mai=c(1.25, 1, 0.2, 0.2),
#pin=c(6,4)
)

curve(20-(40*(exp(-.4*x)-1)), 
from=0, 
to=9, 
n=1000, 
add=F, 
type= l,
lwd=2,
xlab=Ocassion of Measurement, 
ylab=y,
)

I had the same issue with a trellis plot:

obs.plot-  xyplot(msen~Age, 
data=obs.msen, 
groups=ID2, 
type=l, 
lwd=2, 
col=1,
xlab=Age, ylab=Maternal Sensitivity,
ylim=c(-.5,4.5),xlim=c(0,5),
panel=panel.superpose,
par.settings=list(background=list(col=white))
)
obs.plot
 

-
---
Project Scientist
University of California, Irvine
-- 
View this message in context: 
http://www.nabble.com/Controlling-Postscript-output%2C-size-and-orientation-tf4899986.html#a14035096
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] The R Book - great resource for R beginners

2007-11-29 Thread Robert Harris
Hi all,

I've recently discovered The R Book by Micheal J. Crawley. I am new to R and 
I am finding it incredibly useful.

With my background in math and programming, I expected that I would be able to 
pick it up quickly, but even after reading several other intro books, I found 
it was still hard to figure out how to get data into R and how dataframes 
relate to vectors and actually doing statistics with R.

But, The R Book is well written and gives plenty of examples and explains many 
of the often used tools within R. It's both a tutorial and a relatively 
advanced reference book for R, very accessible to a beginner like me.

Just curious: What have been the experiences of others who have used The R Book?

Thanks,

Bob Harris


   
-

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] List operations in R

2007-11-29 Thread jim holtman
To remove the 'names':

 x2 - c('1001_a'='123', '1002_b'='345')
 x2
1001_a 1002_b
 123  345
 names(x2) - NULL
 x2
[1] 123 345



To append:

 z - letters[1:4]
 z
[1] a b c d
 z - c(z,x2)
 z
[1] a   b   c   d   123 345





On Nov 29, 2007 7:07 PM, Srinivas Iyyer [EMAIL PROTECTED] wrote:
 hello:

 I am very confused when it comes to list operations in
 R.

 I seek help in the following problem.

 I have two different vectors

 myIDs - a character vector with no names to their
 elements

 x2 - another character vector derived from unlisting a
 list where an element has both a name and value.

 I am not happy the way x2 is with names and values to
 every element.


  myIDs[1:10]
  [1] 54898 7083  7031  7083  4175  4605
 7494  5111  960   990

  class(myIDs)
 [1] character




 Similarly x2 objects is

  x2[1:4]
  1000_at   1001_at 1002_f_at 1003_s_at
   559570751557 643

  class(x2)
 [1] character


 I am not happy the way x2 is right now. I do not want
 names of the elements. I want to write to another
 object x3 that has only values of the elements and not
 their names.

 How can I do that?

 I can give a [[]] to get the value of element.
  x2[[1]]
 [1] 5595

 When I try to give a range of numbers:
  x2[[1:4]]
 Error in x2[[1:4]] : attempt to select more than one
 element


 Frustrated, I wanted to create another object z, and
 append all values of x2 to z.

  z = c()
  for(i in 1:length(x2)){
 + append(z,x2[[i]],after=length(z))}
  length(z)
 [1] 0


 now z is empty. this is really frustrating. Can
 someone help me please how to deal in this situation.

 Thanks
 Sri


  
 
 Be a better pen pal.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] main plot title

2007-11-29 Thread Rolf Turner

On 30/11/2007, at 3:53 PM, marciarr wrote:


 Hi Jim,
 Thanks for your answer.
 Unfortunately, because the x of my plot function is not actually  
 waht I need
 on my graph's title, your advice does not work. Thanks anyway,
 Marcia

Jim answered the question you asked.  If his advice didn't work, then  
you
asked the wrong question.  It pays to do a little thinking about a  
problem
before asking the list for help.

What are you expecting anyway?  That R should be able to read your mind?

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vector sprintf argument [SEC=UNCLASSIFIED]

2007-11-29 Thread Crombie, Joe
Hi Tom,

Try this:

 G - Number: %s
 sprintf(G, toString(A))
[1] Number: 3, 4, 5

Cheers  Joe

 
Joe Crombie
 
Biosecurity and Information Sciences
Bureau of Rural Science
Canberra  Australia
 
p: +61 2 6272 5906
e: [EMAIL PROTECTED]
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Tom Sgouros
Sent: Friday, 30 November 2007 12:43 PM
To: r-help@r-project.org
Subject: [R] vector sprintf argument


Hello all:

If I have a vector and a format, I want to do this:

  A - c(3,4,5)
  F - Number: %d, %d, %d
  sprintf(F,A)

This doesn't work because A isn't three arguments, it's just one.  Is
there a way to peel the vector members out of A so that sprintf can get
at them?

I would like to do this because I have a large set of variable-length
data that I'd like to print out in fancy formatted form.  The vectors
range in length from 2 to 7.  Each row is different, so I had been
hoping to do this with an array of formats, too.

I feel like I'm either overlooking something obvious, or have determined
to do this in an un-R fashion.  Any advice is welcome.  (On this topic,
that is.)

Many thanks,

 -tom


--
 
 tomfool at as220 dot org
 http://sgouros.com
 http://whatcheer.net

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

--IMPORTANT - This message has been issued by The Department of 
Agriculture, Fisheries and Forestry (DAFF). The information transmitted is for 
the use of the intended recipient only and may contain confidential and/or 
legally privileged material. It is your responsibility to check any attachments 
for viruses and defects before opening or sending them on. 

Any reproduction, publication, communication, re-transmission, disclosure, 
dissemination or other use of the information contained in this e-mail by 
persons or entities other than the intended recipient is prohibited. The taking 
of any action in reliance upon this information by persons or entities other 
than the intended recipient is prohibited. If you have received this e-mail in 
error please notify the sender and delete all copies of this transmission 
together with any attachments. If you have received this e-mail as part of a 
valid mailing list and no longer want to receive a message such as this one 
advise the sender by return e-mail accordingly. Only e-mail correspondence 
which includes this footer, has been authorised by DAFF 
--

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MS Excel Data

2007-11-29 Thread Gabor Grothendieck
Or even:

clip - function() read.delim(clipboard, header =
 is.na(suppressWarnings(as.numeric(scan(clipboard, , 1)

On Nov 29, 2007 7:51 PM,  [EMAIL PROTECTED] wrote:
 Here is a very crude function I use quite often.  It tries to recognize
 whether you have headers or not by checking the very first character.  If
 it is numeric, it assumes that there are no headers. The suppressWarnings
 gets rid of a warning one gets when trying to coerce a character to
 numeric.   The main advantage of the function is that you do not have to
 type too much :-)

 clip - function(){
if(is.na(suppressWarnings(as.numeric(scan(clipboard, what=,
 nmax=1)
   read.delim(clipboard)
else
   read.delim(clipboard, header=FALSE)

 Cheers,

 Andy

 __
 Andy Jaworski
 518-1-01
 Process Laboratory
 3M Corporate Research Laboratory
 -
 E-mail: [EMAIL PROTECTED]
 Tel:  (651) 733-6092
 Fax:  (651) 736-3122



 Bert Gunter
 [EMAIL PROTECTED]
 ne.comTo
 Sent by:  'Gabor Grothendieck'
 [EMAIL PROTECTED] [EMAIL PROTECTED]
 project.orgcc
   r-help@r-project.org
   Subject
 11/29/2007 06:39  Re: [R] MS Excel Data
 PM










 Better yet! Thanks Gabor.

 -- Bert

 -Original Message-
 From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 29, 2007 12:10 PM
 To: Bert Gunter
 Cc: r-help@r-project.org
 Subject: Re: [R] MS Excel Data

 On Nov 29, 2007 3:01 PM, Bert Gunter [EMAIL PROTECTED] wrote:
  This has been discussed on this list many times before. Google on Import
  Excel R. Note also that there are potential problems (loss of digits)
 due
  to Excel idiosyncracies depending on what you do.
  http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html
 provides
  some details.
 
  Finally, I have found that for rectangular data sets with no missing
 fields
  in Excel (tables), cutting and read.tabling **the data only ** is a
  simple(but probably not without risk) way to do it:
 
  (after cutting the data only in Excel to the clipboard) in R:
 
  newdat - read.table(clipboard, head=FALSE, row.names=NULL)
 
  The columns can then be named via names(newdat) - ...
 
  I omit column headers because in most of the Excel data I get the column
  names have spaces and other non-alphanumeric characters which R cannot
  easily digest. One could separately scan() just the vector of column
 headers
  and use regular expressions to extract the names. But for small tables, I
  find it easier just to create the names manually.

 You can include headers with spaces in the copy with:

DF - read.delim(clipboard)


 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] configure the margin of the plot

2007-11-29 Thread Wang, Zhaoming (NIH/NCI) [C]
It looks much better now!  Thanks Jim!!

-Original Message-
From: jim holtman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 29, 2007 7:29 PM
To: Wang, Zhaoming (NIH/NCI) [C]
Cc: r-help@r-project.org
Subject: Re: [R] configure the margin of the plot

try this:

layout(cbind(1,2))
par(mar=c(4,4,2,0))
plot(0)
par(mar=c(4,0,2,0))
plot(0, yaxt='n', ylab='')


On Nov 29, 2007 5:41 PM, Wang, Zhaoming (NIH/NCI) [C]
[EMAIL PROTECTED] wrote:
 I'm trying to put two plots side-by-side in two panels.  Since the 
 y-axis of the two plots is the same, I want to leave out the y-axis of

 the second plot.



 And the two plots look quite separate from each other.  Is there any 
 way to have them stay closer to each other?  I've tried to adjust mar 
 option of par but it has a global effect as I see the left margin of 
 the first plot will be adjusted as well.



 Below is the code fragment:



 r.par(mfrow=[1,2],mar=[5,4,1,1])

 r.plot(x,hets,xlim=[0,105],xlab='Samples(%)',ylab='Heterozygosity(%)',
 co
 l=colors,cex=0.6)

 ...

 plot(completion,hets,xlim=[40,100],xlab=Sample
 Completion(%),ylab=,col=colors,axes=False,cex=0.6)





 Thanks

 Zhaoming


[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




--
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] main plot title

2007-11-29 Thread marciarr

Hello Rolf,
I am sorry for the incovenience. Well, here it goes again!
Let's say, I have a time series for the variable Chl. I wrote a function
pgram that gives me the raw periodogram of the time series. So, this
function uses the values of my time series in an algorithm that gives me new
x and y values. And those are the coordinates that I am actually using on
the final plot function inside pgram (Chl is actually not an argument of
my plot function...). I am interested that the title of the original dataset
I used appears on my plot. Because I will use this function several time
series (let's say Chl and A, with different data sets), I would like to
obtain each time on the title of my plot for pgram(x), Raw periodogram of
x or for pgram(A), Raw periodogram of A.
Hope it is clearer now,
Cheers,
Marcia Rocha


Rolf Turner-3 wrote:
 
 
 On 30/11/2007, at 3:53 PM, marciarr wrote:
 

 Hi Jim,
 Thanks for your answer.
 Unfortunately, because the x of my plot function is not actually  
 waht I need
 on my graph's title, your advice does not work. Thanks anyway,
 Marcia
 
 Jim answered the question you asked.  If his advice didn't work, then  
 you
 asked the wrong question.  It pays to do a little thinking about a  
 problem
 before asking the list for help.
 
 What are you expecting anyway?  That R should be able to read your mind?
 
   cheers,
 
   Rolf Turner
 
 ##
 Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/main-plot-title-tf4901182.html#a14040224
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] using color coded colorbars for bar plots

2007-11-29 Thread James.Dell

Hello R Fundi,

The poetic title of this post is a request for help in regard to a
simple plotting question.  
I have displayed the mean observations of a series variables using
barplot().  On the same figure I have colored the bars to represent the
Standard deviation of each variable using color.scale().  Now I wish to
add a graduated colorbar (legend) that corresponds to the colors
representing the standard devitation.  Simple.  Or so it seemed.  Has
anyone attempted to do this before?  

Thanks for your time.

Jim Dell

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vector sprintf argument

2007-11-29 Thread Moshe Olshansky
The only thing I can think of is:

 a - c(1,2.7,5.19)
 F-c(numeric:  %d ,%g ,%8.3f)
 x-sapply(1:length(a),function(i)
sprintf(F[i],a[i]))
 y-paste(x,sep=,collapse=)

But I am sure that you will get a better advice
elsewhere.

--- Tom Sgouros [EMAIL PROTECTED] wrote:

 
 Hello all:
 
 If I have a vector and a format, I want to do this:
 
   A - c(3,4,5)
   F - Number: %d, %d, %d
   sprintf(F,A)
 
 This doesn't work because A isn't three arguments,
 it's just one.  Is
 there a way to peel the vector members out of A so
 that sprintf can get
 at them?
 
 I would like to do this because I have a large set
 of variable-length
 data that I'd like to print out in fancy formatted
 form.  The vectors
 range in length from 2 to 7.  Each row is different,
 so I had been
 hoping to do this with an array of formats, too.
 
 I feel like I'm either overlooking something
 obvious, or have determined
 to do this in an un-R fashion.  Any advice is
 welcome.  (On this topic,
 that is.)
 
 Many thanks,
 
  -tom
 
 
 -- 
  
  tomfool at as220 dot org
  http://sgouros.com  
  http://whatcheer.net
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] main plot title

2007-11-29 Thread jim holtman
The answer is exactly the same:   deparse(substitute(x))

go to the help page on 'deparse'

On Nov 29, 2007 10:53 PM, marciarr [EMAIL PROTECTED] wrote:

 Hello Rolf,
 I am sorry for the incovenience. Well, here it goes again!
 Let's say, I have a time series for the variable Chl. I wrote a function
 pgram that gives me the raw periodogram of the time series. So, this
 function uses the values of my time series in an algorithm that gives me new
 x and y values. And those are the coordinates that I am actually using on
 the final plot function inside pgram (Chl is actually not an argument of
 my plot function...). I am interested that the title of the original dataset
 I used appears on my plot. Because I will use this function several time
 series (let's say Chl and A, with different data sets), I would like to
 obtain each time on the title of my plot for pgram(x), Raw periodogram of
 x or for pgram(A), Raw periodogram of A.
 Hope it is clearer now,
 Cheers,
 Marcia Rocha


 Rolf Turner-3 wrote:
 
 
  On 30/11/2007, at 3:53 PM, marciarr wrote:
 
 
  Hi Jim,
  Thanks for your answer.
  Unfortunately, because the x of my plot function is not actually
  waht I need
  on my graph's title, your advice does not work. Thanks anyway,
  Marcia
 
  Jim answered the question you asked.  If his advice didn't work, then
  you
  asked the wrong question.  It pays to do a little thinking about a
  problem
  before asking the list for help.
 
  What are you expecting anyway?  That R should be able to read your mind?
 
cheers,
 
Rolf Turner
 
  ##
  Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 

 --
 View this message in context: 
 http://www.nabble.com/main-plot-title-tf4901182.html#a14040224
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] what to do if residuals produced by lm() have long tails?

2007-11-29 Thread tom soyer
Hi,

I am using lm() for regression analysis of my data set. My regression
results look pretty good, i.e., the coefficient is significant and the p
value is much less than 0.05. But when I checked the residuals, both using
qqnorm() and hist(), the distribution does not look normal. It  looks like
the residuals have long tails. I assume that lm() uses OLS, and since one of
the assumptions of OLS is that the residuals has to be normally distributed,
I am wondering if this means I should reject my regression results all
together. If so, then what should I use instead? Are there ways to deal with
distributions with long tails using lm() or OLS, or entirely different
models are needed instead?

Thanks,

-- 
Tom

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vector sprintf argument

2007-11-29 Thread Christos Hatzis
According to the help page sprintf will recycle its arguments:

The arguments (including fmt) are recycled if possible a whole number of
times to the length of the longest, and then the formatting is done in
parallel.  

Therefore the following works:

 sprintf(Number: %d, A)
[1] Number: 3 Number: 4 Number: 5

Another option is to create a character string from A and then print it:

 sprintf(Number: %s, paste(A, collapse= ))
[1] Number: 3 4 5

-Christos

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Moshe Olshansky
 Sent: Thursday, November 29, 2007 11:45 PM
 To: Tom Sgouros; r-help@r-project.org
 Subject: Re: [R] vector sprintf argument
 
 The only thing I can think of is:
 
  a - c(1,2.7,5.19)
  F-c(numeric:  %d ,%g ,%8.3f)
  x-sapply(1:length(a),function(i)
 sprintf(F[i],a[i]))
  y-paste(x,sep=,collapse=)
 
 But I am sure that you will get a better advice elsewhere.
 
 --- Tom Sgouros [EMAIL PROTECTED] wrote:
 
  
  Hello all:
  
  If I have a vector and a format, I want to do this:
  
A - c(3,4,5)
F - Number: %d, %d, %d
sprintf(F,A)
  
  This doesn't work because A isn't three arguments, it's 
 just one.  Is 
  there a way to peel the vector members out of A so that sprintf can 
  get at them?
  
  I would like to do this because I have a large set of 
 variable-length 
  data that I'd like to print out in fancy formatted form.  
 The vectors 
  range in length from 2 to 7.  Each row is different, so I had been 
  hoping to do this with an array of formats, too.
  
  I feel like I'm either overlooking something obvious, or have 
  determined to do this in an un-R fashion.  Any advice is 
 welcome.  (On 
  this topic, that is.)
  
  Many thanks,
  
   -tom
  
  
  --
   
   tomfool at as220 dot org
   http://sgouros.com
   http://whatcheer.net
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] main plot title

2007-11-29 Thread marciarr

Hi Jim,
Thanks for your answer.
Unfortunately, because the x of my plot function is not actually waht I need
on my graph's title, your advice does not work. Thanks anyway,
Marcia

jholtman wrote:
 
 hopefully this will help you:
 
 mydata - 1:10
 my.plot - function(x) plot(x, main=paste('dataset =',
 deparse(substitute(x
 my.plot(mydata)
 
 
 On Nov 29, 2007 9:05 PM, marciarr [EMAIL PROTECTED] wrote:

 Dear R users,
 I am having a problem with the main title of a plot. I have written a
 function returning a plot and I would like that the main title of this
 plot
 shows actually the name of the dataset I have used. So, for instance: if
 my
 dataset is called Chl, I would like that my plot to be entitled : Raw
 periodogram of Chl. I know the function paste. I suppose I would be
 looking for something like: plot(main=paste(Raw periodogram of, ...).
 How can the program understand that the name of the data set is supposed
 to
 go there?
 Thank you very much for your answers!!!
 Marcia
 --
 View this message in context:
 http://www.nabble.com/main-plot-title-tf4901182.html#a14039291
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
 
 
 -- 
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390
 
 What is the problem you are trying to solve?
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/main-plot-title-tf4901182.html#a14039701
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] The R Book - great resource for R beginners

2007-11-29 Thread Tom La Bone

IMHO The R Book is far better than indicated in that review and should be
near the top of the list for beginners looking for a manual for R.

Tom


Katharine Mullen wrote:
 
 It was reviewed in the most recent R News
 (http://www.r-project.org/doc/Rnews/Rnews_2007-2.pdf).
 
 On Thu, 29 Nov 2007, Robert Harris wrote:
 
 Hi all,

 I've recently discovered The R Book by Micheal J. Crawley. I am new to
 R and I am finding it incredibly useful.

 With my background in math and programming, I expected that I would be
 able to pick it up quickly, but even after reading several other intro
 books, I found it was still hard to figure out how to get data into R and
 how dataframes relate to vectors and actually doing statistics with R.

 But, The R Book is well written and gives plenty of examples and explains
 many of the often used tools within R. It's both a tutorial and a
 relatively advanced reference book for R, very accessible to a beginner
 like me.

 Just curious: What have been the experiences of others who have used The
 R Book?

 Thanks,

 Bob Harris



 -

  [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Recommended-textbooks-for-R--tf4895638.html#a14039487
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] main plot title

2007-11-29 Thread jim holtman
hopefully this will help you:

mydata - 1:10
my.plot - function(x) plot(x, main=paste('dataset =', deparse(substitute(x
my.plot(mydata)


On Nov 29, 2007 9:05 PM, marciarr [EMAIL PROTECTED] wrote:

 Dear R users,
 I am having a problem with the main title of a plot. I have written a
 function returning a plot and I would like that the main title of this plot
 shows actually the name of the dataset I have used. So, for instance: if my
 dataset is called Chl, I would like that my plot to be entitled : Raw
 periodogram of Chl. I know the function paste. I suppose I would be
 looking for something like: plot(main=paste(Raw periodogram of, ...).
 How can the program understand that the name of the data set is supposed to
 go there?
 Thank you very much for your answers!!!
 Marcia
 --
 View this message in context: 
 http://www.nabble.com/main-plot-title-tf4901182.html#a14039291
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] main plot title

2007-11-29 Thread Rolf Turner

On 30/11/2007, at 4:53 PM, marciarr wrote:


 Hello Rolf,
 I am sorry for the incovenience. Well, here it goes again!
 Let's say, I have a time series for the variable Chl. I wrote a  
 function
 pgram that gives me the raw periodogram of the time series. So, this
 function uses the values of my time series in an algorithm that  
 gives me new
 x and y values. And those are the coordinates that I am actually  
 using on
 the final plot function inside pgram (Chl is actually not an  
 argument of
 my plot function...). I am interested that the title of the  
 original dataset
 I used appears on my plot. Because I will use this function several  
 time
 series (let's say Chl and A, with different data sets), I would  
 like to
 obtain each time on the title of my plot for pgram(x), Raw  
 periodogram of
 x or for pgram(A), Raw periodogram of A.
 Hope it is clearer now,

Not a lot, I'm afraid.  But I think I may be getting the idea 

Here's an outline of my understanding of the situation:

o you have a time series ``Chl''
o you apply your home-grown function pgram() to it,

pg.Chl - pgram(Chl)

o the result ``pg.Chl'' is a list with components ``x'' and ``y''
(x being frequency and y being ``power'')

o you now want to plot pg.Chl with another home-grown function,
say my.pgram.plot(), and you want the name ``Chl'' to appear in
the title of the plot.

Well --- for goodness sake! --- my.pgram.plot() has to be able to get  
the
information about that name from *somewhere*!  R, wonderful as it is, is
not psychic.

There are two obvious ways of doing this:  They have (obviously!) to be
effected back in the function pgram() which *does* have access to the
name ``Chl''.  If this information is not somehow enclosed in the object
pg.Chl, then there is no way for my.pgram.plot() to obtain this  
information.

Method 1:  Make the name of the ``power'' equal to ``Chl'' rather  
than ``y''.
You can do this making use of the deparse(substitute(whatever))  
technique
that Jim Holtman told you about.  There are various elaborations to this
idea --- e.g. you could make the name ``power.Chl'', and then extract  
the
``Chl'' bit by using gsub() or str.split() or substr() or ..

Method 2:  Give the object returned by pgram() a component or  
(probably better)
an attribute, called say ``dataname'' equal to the name of the time  
series
to which pgram() was applied.  Again, this name can be obtained via the
deparse(substitute(...)) technique.  You then write my.plot.pgram()  
so that
it extracts ``dataname'' from the object fed to it, and then uses  
dataname
to form the title.

The important thing to remember is that R has endless ways to store,  
manipulate,
and process information that is available to it, but it CANNOT magically
produce information that is not available to it.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  1   2   >