[R] Extract values from data frame in R

2010-08-09 Thread Alexander Eggel
Using R, I would like to find out which Samples (S1, S2, S3, S4, S5) fulfill
the following criteria:contain minimally one value (x, y or z) bigger than
4. Any ideas? Thanks, Alex.

 data
  Sample   xy  z
1S1   -0.35.32.5
2S20.40.2   -1.2
3S31.2   -0.63.2
4S44.30.75.7
5S52.44.32.3

[[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] Extract values from data frame in R

2010-08-09 Thread Erik Iverson

On 08/09/2010 01:16 AM, Alexander Eggel wrote:

Using R, I would like to find out which Samples (S1, S2, S3, S4, S5) fulfill
the following criteria:contain minimally one value (x, y or z) bigger than
4. Any ideas? Thanks, Alex.


data

   Sample   xy  z
1S1   -0.35.32.5
2S20.40.2   -1.2
3S31.2   -0.63.2
4S44.30.75.7
5S52.44.32.3


Untested:

Sample[apply(Sample[-1], 1, function(x) any(x)  4)), Sample]

__
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] Extract values from data frame in R

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 2:16 AM, Alexander Eggel wrote:

Using R, I would like to find out which Samples (S1, S2, S3, S4, S5)  
fulfill
the following criteria:contain minimally one value (x, y or z)  
bigger than

4. Any ideas? Thanks, Alex.


data

 Sample   xy  z
1S1   -0.35.32.5
2S20.40.2   -1.2
3S31.2   -0.63.2
4S44.30.75.7
5S52.44.32.3



data$Sample[apply(data[, -1], 1, function(xyz) any(xyz  4))]
[1] S1 S4 S5


David Winsemius, MD
West Hartford, CT

__
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] Problem with installing a package in R!

2010-08-09 Thread Peter Dalgaard
gagea wrote:
 Dear friends,
 
 I am having problem with installing some packages in R in Ubuntu like
 ISwR. Bellow is the outcome. Anybody can help me to solve this problem.
 Thanks a lot and sorry if it is very simple question. 
 
 
 install.packages(ISwr)

...ISwR..., I presume.

 Loading Tcl/Tk interface ... done
 trying URL 'http://probability.ca/cran/src/contrib/ISwR_2.0-5.tar.gz'
 Content type 'application/x-gzip' length 157441 bytes (153 Kb)
 opened URL
 ==
 downloaded 153 Kb
 
 ERROR: failed to lock directory
 ‘/home/ubuntu/R/i486-pc-linux-gnu-library/2.9’ for modifying


 Try removing ‘/home/ubuntu/R/i486-pc-linux-gnu-library/2.9/00LOCK’

Did you try

rm -rf /home/ubuntu/R/i486-pc-linux-gnu-library/2.9/00LOCK

?

The lock dir is there to prevent two processes from messing with the
same files at the same time, but can remain if an installation
terminates prematurely.

Do you have the appropriate permissions? It ia not clear to me whether
that is supposed to be a user-level library or a system one. Is your
user name ubuntu? (And is ubuntu really still shipping 2.9.x?)


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] Good Book To Work Through This Summer

2010-08-09 Thread Ondrej Vozar
Hello,
I think that good introduction for application oriented people is book of
Peter Dalgaard, Introductory Statistics with R
http://www.springer.com/statistics/computanional+statistics/book/978-0-387-79053-4
This book is good for mastering basics of R.

Book I like the one of John Fox, An R and S-PLUS Companion to Applied
Regression
http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/index.html

But there are dozens of books on this topic.
Best regards,
Ondrej Vozar.

On 9 August 2010 06:38, TGS cran.questi...@gmail.com wrote:

 Dear R users,

 I'm hoping to get a few suggestions about which books are good to follow
 along and learn R.

 I'm hoping to spend the summer going through a good R book as it is applied
 in linear regression.

 Thanks!
 __
 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.


Re: [R] Odp: Pausing script to allow user input from keyboard.

2010-08-09 Thread Petr PIKAL
Hi

you are right. From ?scan default value for imput value is double, so you 
need to specify that it shall be character. I just showed possible 
solution not a solution which can be used in all imaginable cases.

Regards
Petr

r-help-boun...@r-project.org napsal dne 07.08.2010 05:20:56:

 I'm having problems with your method Petr.  I seem to get an additional 
prompt.
 
 Example...
 f - function() {
   cat(\n, Enter a string:, \n)
   s - scan(n=1)
   cat(\n, You entered, s, \n)
 }
 
 Running f() produces...
 
  Enter a string:
 1: blah
 1:
 Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, 
na.strings,  :
   scan() expected 'a real', got 'blah'
 
 
 Changing the code to
scan(n=1, what=character)
 Fixes the problem but your post implies that this is not necessary.
 
 Could it be GUI specific ? I am running R 2.11.1 with the Mac OSX GUI
 1.34 Leopard build 64-bit (5589)
 
 Michael
 
 __
 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] metafor and meta-analysis at arm-level

2010-08-09 Thread Viechtbauer Wolfgang (STAT)
Dear Angelo,

This is (currently) not possible.

Best,

--
Wolfgang Viechtbauerhttp://www.wvbauer.com/
Department of Methodology and StatisticsTel: +31 (0)43 388-2277
School for Public Health and Primary Care   Office Location:
Maastricht University, P.O. Box 616 Room B2.01 (second floor)
6200 MD Maastricht, The Netherlands Debyeplein 1 (Randwyck)


Original Message
From: Angelo Franchini [mailto:angelo.franch...@bristol.ac.uk]
Sent: Sunday, August 08, 2010 13:09
To: Viechtbauer Wolfgang (STAT)
Cc: r-help@r-project.org
Subject: RE: [R] metafor and meta-analysis at arm-level

 Dear Wolfgang,

 Is there any way for rma to add random effects only to each treatment
 arm, but not to the control one?

 Many thanks,
 Angelo


 On Thu, August 5, 2010 6:21 pm, Viechtbauer Wolfgang (STAT) wrote:
 Dear Angelo,

 rma(yi=o, sei=se, mods=~s+t-1, method=REML)

 is *a* way to run the arm-based pairwise meta-analysis. Whether it is the
 *correct* way is a question I cannot answer.

 lme(o~s+t-1, random=~t-1 | s, weights=(~ se^2))

 is a different model. First of all, it adds a random effect only to
 each treatment arm within each study, while the rma model above gives
 a random effect to each observation. Moreover, the lme model assumes
 that the sampling variances are only known up to a proportionality
 constant, while the rma model assumes that they are known exactly.

 Similarly,

 lm(formula = o ~ s + t - 1, weights = 1/se.o^2)

 assumes that the sampling variances are only known up to a
 proportionality constant, while rma (with method=FE) assumes that they
 are known exactly.

 For the same reason will

 rma(yi=e, sei=se, method=REML)
 lme(e~1, random=~1 | s, weights=(~ se.e^2))

 and

 rma(yi=e, sei=se.e, method=FE)
 lm(e~1, weights = 1/se.e^2)

 not give you the same results.

 Best,

 --
 Wolfgang Viechtbauerhttp://www.wvbauer.com/
 Department of Methodology and StatisticsTel: +31 (0)43 388-2277
 School for Public Health and Primary Care   Office Location:
 Maastricht University, P.O. Box 616 Room B2.01 (second floor)
 6200 MD Maastricht, The Netherlands Debyeplein 1 (Randwyck)


 Original Message
 From: Angelo Franchini [mailto:angelo.franch...@bristol.ac.uk]
 Sent: Wednesday, August 04, 2010 16:26
 To: Viechtbauer Wolfgang (STAT)
 Cc: 'Angelo Franchini'; r-help@r-project.org
 Subject: RE: [R] metafor and meta-analysis at arm-level

 Hello Wolfgang.

 I'd appreciate if you could help me check whether I am doing the
 proper thing to do an arm-level meta-analysis with metafor and what
 differences there might be in trying to do the same with lme and lm.

 I am following the arm based model described in section 3.2 of the
 Salanti's paper that you mentioned in your previous e-mail, namely:

 theta = B*eta + X*mu + W*beta

 where:
 theta = vector of parameter for outcomes in treatment arms (theta_ij
 for study i, treat. arm j) eta= vector of parameter for outcomes in
 control arms (eta_i for study i) mu = vector of effects (treat. vs
 cont.) (mu_ij for study i, treat. arm j) beta   = vector of random
 effects (beta_ij for study i, treat. arm j)


 In my specific case with a pairwise meta-analysis, I had my data
 arranged as in columns for the following variables: s t o se

 with
 s as study/trial identifier
 t as 0/1 for control/treatment arm
 o as observed outcome in control or treatment arm
 se as standard error of that outcome measure

 I then ran metafor as:
 rma(yi=o, sei=se, mods=~s+t-1, method=REML)

 for random effects, and REML replaced by FE for fixed effects.

 Is that the correct way to run the arm-based pairwise meta-analysis?

 Shouldn't I be able to obtain similar results with LME for
 random-effects by using the command: lme(o~s+t-1, random=~t-1 | s,
 weights=(~ se^2))

 and for fixed-effects with:
 lm(formula = o ~ s + t - 1, weights = 1/se.o^2)


 For the trial-based pairwise meta-analysis I used:
 data arranged as:
 s e se

 with:
 s study
 e effect
 se standard error

 and commands:
 rma(yi=e, sei=se, method=REML)

 or

 lme(e~1, random=~1 | s, weights=(~ se.e^2))

 for random-effects, while for fixed-effects:
 rma(yi=e, sei=se.e, method=FE)
 lm(e~1, weights = 1/se.e^2)

 Does that make sense?


 Many thanks for any comment/advice on this matter.
 Best regards,
 Angelo

__
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] recurrent events

2010-08-09 Thread אבי
Hello,

I have a cohort with approx 1,200 patients at the ages of 30-65 that had
their first myocardial infarction during 1992:

· They were in a follow up until 2005.

· About 400 of them died during this period of time (right censored)

· Each one of them had up to 4 mi recurrent events.

I am using the semi-parametric model in order to assess the relationship of
predictors to rate of occurrence allowing for multiple events per subject.
The exposure variable (ESHKOL) is the socio-economic of the neighborhood
while adjusting for additional variables such as age, sex, etc. In addition
each patient has geo- statics -code for his neighborhood (stat_unit).

I ran an Andersen Gill model:

Ag-coxph(Surv(TStart,TStop,Status)~ ESHKOL+VAR1+
VAR2+cluster(id),data=recmi)

My questions are:

· I would like to check the unique effect of the stat_unit
variable. How can I write it in code?

· In your opinion does the AG model is the best model for this type
of data? Or should I use models that consider the order of the events such
as PWP or WLW?

Thank you, Avi.

 


[[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] recurrent events

2010-08-09 Thread avsha38

Hello,
I have a cohort with approx 1,200 patients at the ages of 30-65 that had
their first myocardial infarction during 1992:
•   They were in a follow up until 2005.
•   About 400 of them died during this period of time (right censored)
•   Each one of them had up to 4 mi recurrent events.
I am using the semi-parametric model in order to assess the relationship of
predictors to rate of occurrence allowing for multiple events per subject.
The exposure variable (ESHKOL) is the socio-economic of the neighborhood
while adjusting for additional variables such as age, sex, etc. In addition
each patient has geo- statics -code for his neighborhood (stat_unit).
I ran an Andersen Gill model:
Ag-coxph(Surv(TStart,TStop,Status)~ ESHKOL+VAR1+
VAR2+cluster(id),data=recmi)
My questions are:
•   I would like to check the unique effect of the stat_unit variable. How
can I write it in code?
•   In your opinion does the AG model is the best model for this type of 
data?
Or should I use models that consider the order of the events such as PWP or
WLW?
Thank you, Avi.

-- 
View this message in context: 
http://r.789695.n4.nabble.com/recurrent-events-tp2318296p2318296.html
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] Smart Indexing

2010-08-09 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Hi all,

Suppose that I've two data frames, a and b say, both containing a column
'id'. While data frame 'a' contains multiple rows sharing the same id,
data frame 'b' contains just one entry per id (i.e. a 1 to n
relationship). For the ease of modeling I now want to generate a new
data frame c, which is basically a copy of data frame 'a' augmented by
the values of b. If I have

a - data.frame(id = rep(1:3, each=3), val=rnorm(9))
b - data.frame(id=1:3, set1=LETTERS[1:3], set2=5:7)

the resulting data frame should look like:

c - data.frame(id = rep(1:3, each=3), val = a$val,
set1=rep(LETTERS[1:3], each=3), set2 = rep(5:7, each = 3))
   
While this task is just an application of some 'rep's and 'c's for
structured data frames, it is somehow cumbersome (and error prone) to
construct 'c' explicitly for less structured data. Thus, I was thinking
of making use of R's smart indexing possibilities to generate an index
vector, i.e.:

ind - c(1, 1, 1, 2, 2, 2, 3, 3, 3)
c.prime - cbind(a, b[ind,-1])
rownames(c.prime) - NULL
all.equal(c.prime , c) # TRUE

The way I generate the index vector ind for the moment is 

tmp - seq_along(b$id)
names(tmp) - b$id
ind - tmp[a$id]

However, I think that there should be a smarter way of doing that
without the need of defining a temporary variable. Some combination of
match, which, %in% maybe? Any hints?

While writing these lines, I think

ind - pmatch(a$id, b$id, duplicates=T)

could do the job? Or do I run into troubles regarding the partial
matching involved in pmatch?

BTW, is there a way to prevent R of assigning [row|col]names? In the
example above I had to remove the rownames generated by rbind
explicitly, is there an one-liner?

Thanks for your input + BR

Thorn

__
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] Smart Indexing

2010-08-09 Thread Dimitris Rizopoulos

I think you just need merge(), e.g.

a - data.frame(id = rep(1:3, each=3), val = rnorm(9))
b - data.frame(id = 1:3, set1 = LETTERS[1:3], set2 = 5:7)

merge(a, b, by = id)


I hope it helps.

Best,
Dimitris


On 8/9/2010 11:01 AM, Thaler, Thorn, LAUSANNE, Applied Mathematics wrote:

Hi all,

Suppose that I've two data frames, a and b say, both containing a column
'id'. While data frame 'a' contains multiple rows sharing the same id,
data frame 'b' contains just one entry per id (i.e. a 1 to n
relationship). For the ease of modeling I now want to generate a new
data frame c, which is basically a copy of data frame 'a' augmented by
the values of b. If I have

a- data.frame(id = rep(1:3, each=3), val=rnorm(9))
b- data.frame(id=1:3, set1=LETTERS[1:3], set2=5:7)

the resulting data frame should look like:

c- data.frame(id = rep(1:3, each=3), val = a$val,
set1=rep(LETTERS[1:3], each=3), set2 = rep(5:7, each = 3))

While this task is just an application of some 'rep's and 'c's for
structured data frames, it is somehow cumbersome (and error prone) to
construct 'c' explicitly for less structured data. Thus, I was thinking
of making use of R's smart indexing possibilities to generate an index
vector, i.e.:

ind- c(1, 1, 1, 2, 2, 2, 3, 3, 3)
c.prime- cbind(a, b[ind,-1])
rownames(c.prime)- NULL
all.equal(c.prime , c) # TRUE

The way I generate the index vector ind for the moment is

tmp- seq_along(b$id)
names(tmp)- b$id
ind- tmp[a$id]

However, I think that there should be a smarter way of doing that
without the need of defining a temporary variable. Some combination of
match, which, %in% maybe? Any hints?

While writing these lines, I think

ind- pmatch(a$id, b$id, duplicates=T)

could do the job? Or do I run into troubles regarding the partial
matching involved in pmatch?

BTW, is there a way to prevent R of assigning [row|col]names? In the
example above I had to remove the rownames generated by rbind
explicitly, is there an one-liner?

Thanks for your input + BR

Thorn

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



--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

__
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] Smart Indexing

2010-08-09 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Thanks, that does the trick. Again a new command learned. Thanks.

However, any hints regarding the rownames issue?

BR Thorn

 -Original Message-
 From: Dimitris Rizopoulos [mailto:d.rizopou...@erasmusmc.nl]
 Sent: lundi 9 août 2010 11:07
 To: Thaler,Thorn,LAUSANNE,Applied Mathematics
 Cc: r-help@r-project.org
 Subject: Re: [R] Smart Indexing
 
 I think you just need merge(), e.g.
 
 a - data.frame(id = rep(1:3, each=3), val = rnorm(9))
 b - data.frame(id = 1:3, set1 = LETTERS[1:3], set2 = 5:7)
 
 merge(a, b, by = id)
 
 
 I hope it helps.
 
 Best,
 Dimitris
 
 
 On 8/9/2010 11:01 AM, Thaler, Thorn, LAUSANNE, Applied Mathematics
 wrote:
  Hi all,
 
  Suppose that I've two data frames, a and b say, both containing a
 column
  'id'. While data frame 'a' contains multiple rows sharing the same
 id,
  data frame 'b' contains just one entry per id (i.e. a 1 to n
  relationship). For the ease of modeling I now want to generate a new
  data frame c, which is basically a copy of data frame 'a' augmented
 by
  the values of b. If I have
 
  a- data.frame(id = rep(1:3, each=3), val=rnorm(9))
  b- data.frame(id=1:3, set1=LETTERS[1:3], set2=5:7)
 
  the resulting data frame should look like:
 
  c- data.frame(id = rep(1:3, each=3), val = a$val,
  set1=rep(LETTERS[1:3], each=3), set2 = rep(5:7, each = 3))
 
  While this task is just an application of some 'rep's and 'c's for
  structured data frames, it is somehow cumbersome (and error prone) to
  construct 'c' explicitly for less structured data. Thus, I was
 thinking
  of making use of R's smart indexing possibilities to generate an
 index
  vector, i.e.:
 
  ind- c(1, 1, 1, 2, 2, 2, 3, 3, 3)
  c.prime- cbind(a, b[ind,-1])
  rownames(c.prime)- NULL
  all.equal(c.prime , c) # TRUE
 
  The way I generate the index vector ind for the moment is
 
  tmp- seq_along(b$id)
  names(tmp)- b$id
  ind- tmp[a$id]
 
  However, I think that there should be a smarter way of doing that
  without the need of defining a temporary variable. Some combination
 of
  match, which, %in% maybe? Any hints?
 
  While writing these lines, I think
 
  ind- pmatch(a$id, b$id, duplicates=T)
 
  could do the job? Or do I run into troubles regarding the partial
  matching involved in pmatch?
 
  BTW, is there a way to prevent R of assigning [row|col]names? In the
  example above I had to remove the rownames generated by rbind
  explicitly, is there an one-liner?
 
  Thanks for your input + BR
 
  Thorn
 
  __
  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.
 
 
 --
 Dimitris Rizopoulos
 Assistant Professor
 Department of Biostatistics
 Erasmus University Medical Center
 
 Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
 Tel: +31/(0)10/7043478
 Fax: +31/(0)10/7043014

__
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] (no subject)

2010-08-09 Thread Holt, Hannah Rebecca
Hi there,

 

I have been trying to use the pvclust package but have been having
some difficulties. This is the first time I have used R so I am sure the
mistake I am making is a basic one. The data I have is a distance matrix
and I have been using the command; fit - pvclust(cluster, nboot=1000,
method.dist=euclidean) to try and perform hierarchical clustering with
bootstrapped p-values, but I get the error message; Error in
t.default(x) : argument is not a matrix. I guess there is a problem with
the way the data is laid out, do you know how the data should be
displayed in order to get the command to work (the data I am using I
have pasted below), I have tried various methods of organising it!

 

  V1 V2 V3V4

1 0. 0.03162278 0.05830952 0.1315295

2 0.03162278 0. 0.0600 0.1627882

3 0.05830952 0.0600 0. 0.1627882

4 0.13152946 0.16278821 0.16278821 0.000

 

Any help you could give me would be greatly appreciated.

 

Kind Regards,

 

Hannah

 

 


[[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] Results with name of dataset

2010-08-09 Thread Evgenia

I generate and save a dataset

For example

exampledata-runif(10)
library(R.utils);
saveObject(exampledata, file=exampledata_9810.RData);

exampledata_9810- loadObject(exampledata_9810.RData);

I use ex function to make alot of calculations using sink to export results
(in this simply example only summary of dataset)

ex-function(data){
sink(paste(data,'Example.txt'))
print(summary(data))
}

ex(data=exampledata_9810)


Function ex works fine BUT I don't want the file of results to have the name
data Example but
exampledata_9810 Example
How can I do this?

Thanks for your help

Evgenia

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Results-with-name-of-dataset-tp2318328p2318328.html
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] (no subject)

2010-08-09 Thread Ivan Calandra
  Hi Hannah,

First, don't forget to add a subject to your email!
Second, the best way to share data is to copy/paste the output from the 
dput() function into the email.

I have never used pvclust, but the error tells you that your object 
cluster is not a matrix.
What does str(cluster) return?
You may think it's a matrix, but depending on how you've created it, it 
might be a data.frame or something else.
str() is a very useful function.

HTH,
Ivan

Le 8/9/2010 11:22, Holt, Hannah Rebecca a écrit :
 Hi there,



 I have been trying to use the pvclust package but have been having
 some difficulties. This is the first time I have used R so I am sure the
 mistake I am making is a basic one. The data I have is a distance matrix
 and I have been using the command; fit- pvclust(cluster, nboot=1000,
 method.dist=euclidean) to try and perform hierarchical clustering with
 bootstrapped p-values, but I get the error message; Error in
 t.default(x) : argument is not a matrix. I guess there is a problem with
 the way the data is laid out, do you know how the data should be
 displayed in order to get the command to work (the data I am using I
 have pasted below), I have tried various methods of organising it!



V1 V2 V3V4

 1 0. 0.03162278 0.05830952 0.1315295

 2 0.03162278 0. 0.0600 0.1627882

 3 0.05830952 0.0600 0. 0.1627882

 4 0.13152946 0.16278821 0.16278821 0.000



 Any help you could give me would be greatly appreciated.



 Kind Regards,



 Hannah






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


-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php


[[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] Results with name of dataset

2010-08-09 Thread Michael Bedward
On 9 August 2010 19:30, Evgenia ev...@aueb.gr wrote:

 Function ex works fine BUT I don't want the file of results to have the name
 data Example but
 exampledata_9810 Example
 How can I do this?

Do you mean that you want the filename to be based on the name of the
object passed to the function ?  If so, try this...

ex-function(data) {
  sink(paste(deparse(substitute(data)), ' Example.txt'))
  print(summary(data))
}

Michael

__
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] permanova on MICE object

2010-08-09 Thread FSM

Hi everyone!

I have data consisting of several response variables and several explanatory
variables. I wish to do a permanova on this using the vegan library and the
adonis() function. However, my data had several missing values in it. In
order to 'fix' this I used the mice() function from the mice library to make
5 imputations for all the missing values. To do analysis on the 5 datasets
with different imputed values, the mice library includes the with.mids()
function in which you can call the mice object and calculate a model for all
the 5 datasets. The results from these analysis can later on be pooled with
the pool() function from the mice library.

The problem I have is that I am not sure how to include a permanova (with
the adonis() function) as an expression in the with.mids() function. 
In order to use the mice() function and calculate multiple imputations I
needed one dataframe with all of my response and explanatory variables. In
order to use the adonis() function (I think) I need a separate dataframe
with my response variables and a separate dataframe with my explanatory
variables.

Does anyone know how to use the output from a multiple imputation by chained
equations (mice) to do a permanova?

I hope my question is clear, and if anyone has any ideas or suggestions,
your help would be greatly appreciated.

Thanks!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/permanova-on-MICE-object-tp2318342p2318342.html
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] [OT] R on Atlas library

2010-08-09 Thread Allan Engelhardt
I don't know about the specific function (a simple, stand-alone 
reproducible example is always helpful, see the posting guide for 
details), but ATLAS certainly uses all my cores on a test like this:


s - 7500  #  Adjust for your hardware
a - matrix(rnorm(s*s), ncol = s, nrow = s)
b - crossprod(a)  #  Uses all cores here.

My configuration of R with ATLAS on Linux (Fedora) is described at 
http://www.cybaea.net/Blogs/Data/Faster-R-through-better-BLAS.html


Maybe your distribution has single-threaded ATLAS and you forgot to 
rebuild it with enable_native_atlas 1 or the equivalent for your platform?


Allan


On 06/08/10 15:12, Matthias Gondan wrote:

Dear List,

I am aware this is slightly off-topic, but I am sure there are people who 
already had the problem and who perhaps solved it.

I am running long-lasting model fits using constrOptim command. At work
there is a linux computer (Quad Core, debian) on which I already have
compiled R and Atlas, in the hope that things will go faster on that
machine.

Atlas offers the possibility to be compiled for multiple cores, I used
that option, but without success. Performance meter (top) for Linux
shows 25% CPU usage, and there is no loss of performance if I run
4 instances of R doing heavy matrix multiplications. Performance drops
when a 5th instance of R is doing the same job, so I assume my attempt
was not successful.

I am sure I did something wrong. Is there anybody who sucessfully
runs R with Atlas and all processors? A short description of the
necessary steps would be helpful.

Searching around the internet was not very encourageing. Some people
wrote that it is not so simple to have Atlas fully exploit a multicore
computer.

I hope this is not too unspecific.

Best wishes,

Matthias




__
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] About R base

2010-08-09 Thread Allan Engelhardt

Yes, there are differences between R on Windows and R on Linux.

You probably want this document:

http://cran.r-project.org/bin/windows/base/rw-FAQ.html

Hope this helps a little.

Allan

On 06/08/10 16:47, Stephen Liu wrote:

Hi folks,

I have R x64 2.11.1 installed on Win 7 64 bit which is running as VM (guest) on
Oracle VirtualBox.  Is there any difference between it and R on Linux?  I can
install another R on Debian 5.04, also running as VM.  TIA

B.R.
Stephen L




__
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] Fwd: RE: pvclust function

2010-08-09 Thread Ivan Calandra
  You should reply to the list, not just me, and even more because I 
cannot really help you!!

My guess (but I don't know this package, and even less this function) is 
that pvclust() is expecting a matrix as the first argument. However, 
cluster is no data, it is a function. Why, I don't know. Take a closer 
look at ?pvclust, especially the usage, arguments and examples parts.

HTH,
Ivan




 Message original 
Sujet:  RE: pvclust function
Date :  Mon, 9 Aug 2010 10:52:30 +0100
De :Holt, Hannah Rebecca hh...@rvc.ac.uk
Pour :  ivan.calan...@uni-hamburg.de



Sorry Ivan,

Thanks for your tips the output from str(cluster) is;

function (file, header = FALSE, sep = , quote = \', dec = .,
 row.names, col.names, as.is = !stringsAsFactors, na.strings = NA,
 colClasses = NA, nrows = -1, skip = 0, check.names = TRUE,
 fill = !blank.lines.skip, strip.white = FALSE, blank.lines.skip = TRUE,
 comment.char = #, allowEscapes = FALSE, flush = FALSE,
 stringsAsFactors = default.stringsAsFactors(), fileEncoding = ,
 encoding = unknown)

I am not sure how to interpret this!

Kind Regards,

Hannah

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Ivan Calandra
Sent: 09 August 2010 10:40
To: r-help@r-project.org
Subject: Re: [R] (no subject)

   Hi Hannah,

First, don't forget to add a subject to your email!
Second, the best way to share data is to copy/paste the output from the
dput() function into the email.

I have never used pvclust, but the error tells you that your object cluster 
is not a matrix.
What does str(cluster) return?
You may think it's a matrix, but depending on how you've created it, it might 
be a data.frame or something else.
str() is a very useful function.

HTH,
Ivan

Le 8/9/2010 11:22, Holt, Hannah Rebecca a écrit :
  Hi there,



  I have been trying to use the pvclust package but have been having
  some difficulties. This is the first time I have used R so I am sure
  the mistake I am making is a basic one. The data I have is a distance
  matrix and I have been using the command; fit- pvclust(cluster,
  nboot=1000,
  method.dist=euclidean) to try and perform hierarchical clustering
  with bootstrapped p-values, but I get the error message; Error in
  t.default(x) : argument is not a matrix. I guess there is a problem
  with the way the data is laid out, do you know how the data should be
  displayed in order to get the command to work (the data I am using I
  have pasted below), I have tried various methods of organising it!



 V1 V2 V3V4

  1 0. 0.03162278 0.05830952 0.1315295

  2 0.03162278 0. 0.0600 0.1627882

  3 0.05830952 0.0600 0. 0.1627882

  4 0.13152946 0.16278821 0.16278821 0.000



  Any help you could give me would be greatly appreciated.



  Kind Regards,



  Hannah






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


--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere 
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php


[[alternative HTML version deleted]]




[[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] Does anybody know how to control the appearance of the end of the line in lattice?

2010-08-09 Thread Duncan Mackay

Hi

see
http://finzi.psych.upenn.edu/Rhelp10/2010-April/234441.html

The following I think works - its a bit rough - needs improving but saves 
closing the device.

xyplot(y2+y1~x,
   data=Source,
   par.settings = list(grid.pars = list(lineend = butt)),
   #distribute.type=TRUE,
   y1 = Source$y1,
   y2=Source$y2,

panel = function(x,y1,y2,...){

  panel.segments(x,y1, x,y2, gp = gpar(lineend=butt), 
col=c(black), lwd =20)


}
)


Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email home: mac...@northnet.com.au


At 06:23 9/08/2010, you wrote:

Hi

On 9/08/2010 7:49 a.m., George Chen wrote:

Hi All,

I am plotting vertical lines using xyplot in lattice and type=h.
It works well, but the problem is that the tops of the lines are convex 
and the bottoms are concave.

Is there a way to flatten the tops and bottoms?


You want to control the graphical parameter called lineend, but I don't 
think this is generally made available via trellis.par.set(). Also, trying 
to set a default value via the 'grid.pars' argument, or via a viewport 
with the 'draw.in' argument doesn't appear to work in this case (the 
lineend may be hard coded in the internal code somewhere). The following 
code (to be run AFTER your code) does the trick for your example ...


library(grid)
grid.gedit(segments, gp=gpar(lineend=butt), grep=TRUE)

... though I believe this will also make the ends of the tick marks on the 
axes square (not obvious to the naked eye at the default size).


Paul


Here's my code:

Source-matrix(1:30,10,3)
colnames(Source)-c(x,y1,y2)
Source-data.frame(Source)

xyplot(y2+y1~x,
data=Source,
distribute.type=TRUE,
type=c(h,h),
col=c(black,white),
 lwd=20)
graphics.off()

Thanks.

George Chen

__
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 Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

__
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] memory use without running gc()

2010-08-09 Thread Allan Engelhardt

How about asking the operating system, e.g.

### Method 1
## Setup
cmd - paste(ps -o vsz, Sys.getpid())
## In your logging routine
z - system(cmd, intern = TRUE)
cat(Virtual size: , z[2], \n, sep = )

### Method 2
## Setup
file - paste(/proc, Sys.getpid(), stat, sep = /)
what - vector(list, 44); what[[23]] - integer(0)
## In your logging routine
vsz - scan(file, what = what, quiet = TRUE)[[23]]/1024
cat(Virtual size: , vsz, \n, sep = )

### Time the methods
library(rbenchmark)
benchmark(scan = scan(file, what = what, quiet = TRUE)[[23]]/1024,
  system = system(cmd, intern = TRUE),
  columns = c(test, replications, elapsed, relative), 
order = relative)

# test replications elapsed relative
# 1   scan  100   0.015   1.
# 2 system  100   2.408 160.5333


The scan method should be plenty fast.  Change as appropriate if your 
definition of memory is different from virtual size.


Hope this helps a little.

Allan


On 06/08/10 19:11, Johann Hibschman wrote:

jim holtmanjholt...@gmail.com  writes:

   

?memory.size
 

Only works on Windows.  I guess I should have specified; this is on Linux.

Thanks,
Johann

__
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] TM Package - installation

2010-08-09 Thread Sujatha Upadhyaya
Hi All,
I have been trying to  do some text analytics in R using tm package. I have
installed and loaded the package, along with dependencies (slam,
rWeka,rjava). When I try to run a tm_map command, it gives me Error in
.jnew(name) :
  java.lang.NoClassDefFoundError: weka/core/stemmers/SnowballStemmer error.

Can someone please throw some light on this?. Am I missing out on something?
-
Regards
Sujatha

[[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] Logistic Regression in R (SAS -like output)

2010-08-09 Thread Harsh
Hello useRs,

I have a problem at hand which I'd think is fairly common amongst
groups were R is being adopted for Analytics in place of SAS.
Users would like to obtain results for logistic regression in R that
they have become accustomed to in SAS.

Towards this end, I was able to propose the Design package in R which
contains many functions to extract the various metrics that SAS
reports.

If you have suggestions pertaining to other packages, or sample code
that replicates some of the SAS outputs for logistic regression, I
would be glad to hear of them.

Some of the requirements are:
- Stepwise variable selection for logistic regression
- Choose base level for factor variables
- The Hosmer-Lemeshow statistic
- concordant and discordant
- Tau C statistic

Thank you for your suggestions.
Regards,
Harsh Singhal

__
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] Different colour in each bar in lattice package

2010-08-09 Thread Ronaldo Reis Junior
Hi,

I try to plot bars with different colours in a barchart graphic. My idea 
is make that all X-Levels from trat var with different colour (grey 
scale). I search for a solution but dont find any.

Any help?

Thanks

dados - structure(list(Medias = c(0.994169096209855, 0.99416342412449,
0.974683544303797, 0.954430379746835, 0.669047619047619, 0.8475569,
0.994163424124514, 0.99240506329114, 0.929113924050633, 0.70952380952381,
0.9473166, 0.9439193, 0.99746835443038, 0.99746835443038,
0.923809523809524, 0.862973760932945, 0.784046692606905, 0.645569620253165,
0.555035128805621, 0.470886075949367, 0.932944606413993, 0.809338521400778,
0.668354430379747, 0.608040201005025, 0.606060606060606), ICI = 
c(0.976994567793296,
0.98206380431608, 0.953595979983429, 0.928839427641527, 0.622608688475051,
1, 0.982063775957542, 0.976722631854148, 0.899246653813278, 
0.664275771030459,
1, 1, 0.98225705686684, 0.98225705686684, 0.894238146710719,
0.802350976424288, 0.729009506353544, 0.575768730809864, 0.487173600236996,
0.401669070838163, 0.89054916155, 0.762545402476806, 0.607108256850681,
0.545852506856716, 0.546177521647536), ICS = c(0.998541256282513,
0.99811638878729, 0.986325619477418, 0.971104547021077, 0.712411667007983,
1, 0.998116391814118, 0.99754802608, 0.950613606532198, 
0.750959759947381,
1, 1, 0.999643506018429, 0.999643506018429, 0.94561548964544,
0.90715403340414, 0.830504883009395, 0.70967681170475, 0.620904467505572,
0.541241164275512, 0.959662136271508, 0.848739648593426, 0.724387494422558,
0.666908727580774, 0.66291862672965), trat = structure(c(5L,
1L, 3L, 2L, 4L, 5L, 1L, 3L, 2L, 4L, 1L, 5L, 2L, 3L, 4L, 5L, 1L,
2L, 4L, 3L, 5L, 1L, 2L, 3L, 4L), .Label = c(O, P,
Pl, T, TN), class = factor), Yvar = structure(c(2L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 5L, 5L,
5L, 5L, 5L, 4L, 4L, 4L, 4L, 4L), .Label = c(0BG,
0BP, 0T, 1A, 1D), class = factor)), .Names = c(Medias,
ICI, ICS, trat, Yvar), row.names = c(tratTN, tratO,
tratPl, tratP, tratT, tratTN1, tratO1,
tratPl1, tratP1, tratT1, tratO2, tratTN2,
tratP2, tratPl2, tratT2, tratTN3, tratO3,
tratP3, tratT3, tratPl3, tratTN4, tratO4,
tratP4, tratPl4, tratT4), class = data.frame)

library(lattice)

dados$Yvar - as.factor(dados$Yvar)

with(dados,barchart(Medias*100~trat|Yvar,col=gray50))

-- 
10ª lei - Seu orientador espera que a sua produtividade seja baixa inicialmente 
e esteja acima da média após um ano.

   --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228.
  Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br
| http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366


[[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] image plot but data not on grid.

2010-08-09 Thread W Eryk Wolski
qplot does (?) what I was looking for!
At least it plots what I want to plot in the interactive modus.
However, it seems not to work with Sweave.

Thanks



On 7 August 2010 16:15, Michael Bedward michael.bedw...@gmail.com wrote:
 If it's regular, but incomplete, that method will work.  If it's
 irregular, then no image method will work without first interpolating
 a regular grid.

 Thanks Hadley. As I suspected,  but ggplot2 is so very clever that I
 thought it was worth asking :)

 Michael

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




-- 
Witold Eryk Wolski

Heidmark str 5
D-28329 Bremen
tel.: 04215261837

__
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] RExcel: Sctools not available

2010-08-09 Thread Andreas Scherer
 I have a problem with RExcel which I have now installed on top of R 2.11.0. 
The problem had been posted in 2009 on the forum by someone else, but no 
(useful) response had been uploaded. 
The issue is that 
whenever I am trying to start R from excel, or by clicking the[ 
RExcel2007 with 
RCommander] icon., I get the following messages boxes : 
SCTools not available  
then: 
there seems to be no R process connected 
to excel 
though both r and excel starts after I click the Icon!! 

Could you please help me with this issue? 
Thank you very much. 



  
[[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] Invalid plot type '1'

2010-08-09 Thread Ben Bolker
Stephen Liu satimis at yahoo.com writes:

 On
 R-Project
 The R Manuals
 http://www.r-project.org/
 
 There are several manuals.  
 
 Whether I should follow:-
 
 An Introduction to R
 http://www.r-project.org/
 

  The Introduction to R is rather terse, but a reasonable starting
point.  The other manuals listed on that page are special-purpose
manuals for installation  administration, development, etc..  You
can try the manuals listed in the contributed documentation section
too.

  YouTube videos are OK, too ... The point that Erik was making 
was that if you have a question about a particular function, 
the help page for that function (in this case the results of ?plot 
or help(plot)) is the definitive documentation.

  Ben Bolker

__
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] Different colour in each bar in lattice package

2010-08-09 Thread Henrique Dallazuanna
Try this:

with(dados,barchart(Medias * 100 ~ trat | Yvar, col =  grey(seq(0, 1, l =
nlevels(trat)


On Mon, Aug 9, 2010 at 8:18 AM, Ronaldo Reis Junior chrys...@gmail.comwrote:

 Hi,

 I try to plot bars with different colours in a barchart graphic. My idea
 is make that all X-Levels from trat var with different colour (grey
 scale). I search for a solution but dont find any.

 Any help?

 Thanks

 dados - structure(list(Medias = c(0.994169096209855, 0.99416342412449,
 0.974683544303797, 0.954430379746835, 0.669047619047619, 0.8475569,
 0.994163424124514, 0.99240506329114, 0.929113924050633, 0.70952380952381,
 0.9473166, 0.9439193, 0.99746835443038, 0.99746835443038,
 0.923809523809524, 0.862973760932945, 0.784046692606905, 0.645569620253165,
 0.555035128805621, 0.470886075949367, 0.932944606413993, 0.809338521400778,
 0.668354430379747, 0.608040201005025, 0.606060606060606), ICI =
 c(0.976994567793296,
 0.98206380431608, 0.953595979983429, 0.928839427641527, 0.622608688475051,
 1, 0.982063775957542, 0.976722631854148, 0.899246653813278,
 0.664275771030459,
 1, 1, 0.98225705686684, 0.98225705686684, 0.894238146710719,
 0.802350976424288, 0.729009506353544, 0.575768730809864, 0.487173600236996,
 0.401669070838163, 0.89054916155, 0.762545402476806, 0.607108256850681,
 0.545852506856716, 0.546177521647536), ICS = c(0.998541256282513,
 0.99811638878729, 0.986325619477418, 0.971104547021077, 0.712411667007983,
 1, 0.998116391814118, 0.99754802608, 0.950613606532198,
 0.750959759947381,
 1, 1, 0.999643506018429, 0.999643506018429, 0.94561548964544,
 0.90715403340414, 0.830504883009395, 0.70967681170475, 0.620904467505572,
 0.541241164275512, 0.959662136271508, 0.848739648593426, 0.724387494422558,
 0.666908727580774, 0.66291862672965), trat = structure(c(5L,
 1L, 3L, 2L, 4L, 5L, 1L, 3L, 2L, 4L, 1L, 5L, 2L, 3L, 4L, 5L, 1L,
 2L, 4L, 3L, 5L, 1L, 2L, 3L, 4L), .Label = c(O, P,
 Pl, T, TN), class = factor), Yvar = structure(c(2L,
 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 5L, 5L,
 5L, 5L, 5L, 4L, 4L, 4L, 4L, 4L), .Label = c(0BG,
 0BP, 0T, 1A, 1D), class = factor)), .Names = c(Medias,
 ICI, ICS, trat, Yvar), row.names = c(tratTN, tratO,
 tratPl, tratP, tratT, tratTN1, tratO1,
 tratPl1, tratP1, tratT1, tratO2, tratTN2,
 tratP2, tratPl2, tratT2, tratTN3, tratO3,
 tratP3, tratT3, tratPl3, tratTN4, tratO4,
 tratP4, tratPl4, tratT4), class = data.frame)

 library(lattice)

 dados$Yvar - as.factor(dados$Yvar)

 with(dados,barchart(Medias*100~trat|Yvar,col=gray50))

 --
 10ª lei - Seu orientador espera que a sua produtividade seja baixa
 inicialmente e esteja acima da média após um ano.

   --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228.
   Prof. Ronaldo Reis Júnior
 |  .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional
 | : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
 | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
 |   `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br
 | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366


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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] error (code 12)

2010-08-09 Thread khazaei
Hi,
I am runing R on my  mac and  I  get this error:

R(206,0xa01ad720) malloc: *** mmap(size=402048) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
R(206,0xa01ad720) malloc: *** mmap(size=402048) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Is there any an easy way to overcome this error?

Any help or information would be great, thanks
I am using  Mac OS X 10.5.8.

Khazaei

__
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] ESS question. How to get rid of ess-smart-underscore?

2010-08-09 Thread W Eryk Wolski
Hi,

ESS replaces _ by -. How can I switch off this feature?

 I need to be able to type the underscore

Thanks
Eryk

-- 
Witold Eryk Wolski

Heidmark str 5
D-28329 Bremen
tel.: 04215261837

__
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] ESS question. How to get rid of ess-smart-underscore?

2010-08-09 Thread Marc Schwartz
On Aug 9, 2010, at 7:26 AM, W Eryk Wolski wrote:

 Hi,
 
 ESS replaces _ by -. How can I switch off this feature?
 
 I need to be able to type the underscore
 
 Thanks
 Eryk


Eryk,

If you type the underscore key twice, you get an underscore character rather 
than the assignment operator.

You can disable the behavior by putting:

  (ess-toggle-underscore nil)

in your .emacs file.

Also, as you may be aware, there is a dedicated ESS help list at:

  https://stat.ethz.ch/mailman/listinfo/ess-help

HTH,

Marc Schwartz

__
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] ESS question. How to get rid of ess-smart-underscore?

2010-08-09 Thread Kevin E. Thorpe

W Eryk Wolski wrote:

Hi,

ESS replaces _ by -. How can I switch off this feature?

 I need to be able to type the underscore

Thanks
Eryk



Pressing the underscore a second time gives you the underscore.

--
Kevin E. Thorpe
Biostatistician/Trialist, Knowledge Translation Program
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: kevin.tho...@utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016

__
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] Difference Between R: wilcox.test and STATA: signrank

2010-08-09 Thread Capasia
This is my first post to the mailing list and I guess it's a pretty stupid
question but I can't figure it out. I hope this is the right forum for these
kind of questions.

Before I started using R I was using STATA to run a Wilcoxon signed-rank
test on two variables. See data below:

https://spreadsheets.google.com/pub?key=0ApodAA2GAEP_dDZkdzZHSFBqX1JHOWJBX1dMQUZCVkEhl=enoutput=html%20%20https://spreadsheets.google.com/pub?key=0ApodAA2GAEP_dDZkdzZHSFBqX1JHOWJBX1dMQUZCVkEhl=enoutput=html

STATA Output:
. signrank x=y

Wilcoxon signed-rank test

   sign |  obs   sum ranksexpected
-+-
   positive |   413101  2330.5
   negative |   181560  2330.5
   zero |   4912251225
-+-
all |  10858865886

unadjusted variance   106438.50
adjustment for ties -282.38
adjustment for zeros  -10106.25
--
adjusted variance  96049.88

Ho: transfer_2_a = transfer_2_b
z =   2.486
   Prob  |z| =   *0.0129*

When running a Wilcoxon signed-rank test


 wilcox.test(datablatt$x, datablatt$y)

Wilcoxon rank sum test with continuity correction

data:  datablatt$x and datablatt$y
W = 7059.5, p-value = *0.09197*
alternative hypothesis: true location shift is not equal to 0

As you can see the p Values are different (one with H0 rejection and the
other one not). I tested whether it could be that the STATA one isn't paired
but this doesn't seem to be the problem.

I'm dumbfound what could lead to such a difference. I couldn't find any
seetings I have missed but I somehow I guess I'm using the function in the
wrong way...
Any ideas?
Thanks a lot in advance!

[[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] 3d data plot

2010-08-09 Thread szisziszilvi

Hello!

E.g. I have a file like sample.csv:
condition1;condition2;myVar
0.902443929;0.879344831;0.963357725
0.91014254;0.717720763;0.953787867
0.899773581;0.871760835;1.031798755
0.892074969;0.863043345;1.080447426
0.847759139;0.894642857;1.080521187
0.847179086;0.89650009;1.111348011
0.849229318;0.912751303;1.154026236
(... some thousands of measurements, like (p,V,T) - just other types of
physical quantities)
(wherever a data misses, it's sign is -999)

I can read it into a data frame like:
mes - read.csv(sample.csv, sep=;, na.strings=-999)

But what shall I do afterwards? I've tried to understand persp, but that
doesn't really seem to be the solution.

Maybe it would help if you could tell me just which example to check more
carefully on the mentioned page. I've tried to search for one, but failed
unfortunatelly.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/3d-data-plot-tp2306540p2318397.html
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] coef(summary) and plyr

2010-08-09 Thread moleps
Dear all,

I´m having trouble getting a list of regression variables back into a 
dataframe. 

mydf - data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))

mydf$fac-factor(sample((0:2),replace=T,100))

 mydf$y- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)

dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))-dl

here I´d like to use 

ldply(dl,coef(summary)) or something similar but I cant figure it out...



Best,

M

__
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] Logistic Regression in R (SAS -like output)

2010-08-09 Thread Frank Harrell



Frank E Harrell Jr   Professor and ChairmanSchool of Medicine
 Department of Biostatistics   Vanderbilt University

On Mon, 9 Aug 2010, Harsh wrote:


Hello useRs,

I have a problem at hand which I'd think is fairly common amongst
groups were R is being adopted for Analytics in place of SAS.
Users would like to obtain results for logistic regression in R that
they have become accustomed to in SAS.

Towards this end, I was able to propose the Design package in R which
contains many functions to extract the various metrics that SAS
reports.


The replacement for Design, rms, has some new indexes.



If you have suggestions pertaining to other packages, or sample code
that replicates some of the SAS outputs for logistic regression, I
would be glad to hear of them.

Some of the requirements are:
- Stepwise variable selection for logistic regression


 an invalid procedure


- Choose base level for factor variables


 not relevant - get what you need from predicted values and 
differences in predicted values or contrasts - this automatically 
takes care of reference cells


  - The Hosmer-Lemeshow statistic

 obsolete: low power and sensitive to choice of binning


- concordant and discordant


see Hmisc's rcorr.cens


- Tau C statistic


Those are two different statistics.  tau and C are obtained by lrm in 
rms/Design.


Frank



Thank you for your suggestions.
Regards,
Harsh Singhal

__
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] error (code 12)

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 8:23 AM, khaz...@ceremade.dauphine.fr wrote:


Hi,
I am runing R on my  mac and  I  get this error:

R(206,0xa01ad720) malloc: *** mmap(size=402048) failed (error  
code=12)

*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
R(206,0xa01ad720) malloc: *** mmap(size=402048) failed (error  
code=12)

*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Is there any an easy way to overcome this error?


Please read the Posting Guide. You have not offered any information  
that would allow anyone to replicate or investigate your system- 
generated error.


?sessionInfo



Any help or information would be great, thanks
I am using  Mac OS X 10.5.8.


Same as I. Probably should be reposted (after read the R-Mac Faq _and_  
you supply the missing information that render this question basically  
unanswerable) on R-MAC-SIG. If this is happening on startuop then pay  
particular attention to 12.16.


--

David Winsemius, MD
West Hartford, CT

__
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] Good Book To Work Through This Summer

2010-08-09 Thread Matt Shotwell
There are some book-length documents (downloadable for free) at the
contributed documentation section of the R project website here:

http://cran.r-project.org/other-docs.html

In particular, the book “Practical Regression and Anova using R” by
Julian Faraway looks to have the content you want, though I haven't read
it myself. There are other high quality authors in the list also.

-Matt


On Mon, 2010-08-09 at 03:20 -0400, Ondrej Vozar wrote:
 Hello,
 I think that good introduction for application oriented people is book of
 Peter Dalgaard, Introductory Statistics with R
 http://www.springer.com/statistics/computanional+statistics/book/978-0-387-79053-4
 This book is good for mastering basics of R.
 
 Book I like the one of John Fox, An R and S-PLUS Companion to Applied
 Regression
 http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/index.html
 
 But there are dozens of books on this topic.
 Best regards,
 Ondrej Vozar.
 
 On 9 August 2010 06:38, TGS cran.questi...@gmail.com wrote:
 
  Dear R users,
 
  I'm hoping to get a few suggestions about which books are good to follow
  along and learn R.
 
  I'm hoping to spend the summer going through a good R book as it is applied
  in linear regression.
 
  Thanks!
  __
  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.

-- 
Matthew S. Shotwell
Graduate Student 
Division of Biostatistics and Epidemiology
Medical University of South Carolina

__
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] Bootstrap

2010-08-09 Thread Shentu

You should bootstrap the two groups separately. The bootstrap sample you get
do not follow the same order as the original sample, so the first 62
observations are coming from both groups.  What you bootstrapped is
essentially the difference between the pooled mean and itself, which would
no doubt come up as 0.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Bootstrap-tp2317776p2318480.html
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] Difference Between R: wilcox.test and STATA: signrank

2010-08-09 Thread Alain Guillet

 Hi,

Look at the output of the test made in R and you can see it is a 
Wilcoxon rank sum test and not a Wilcoxon signed rank test.


If there are ties, I know I prefer wilcox.exact from the exactRankTests.

Alain

On 09-Aug-10 12:43, Capasia wrote:

This is my first post to the mailing list and I guess it's a pretty stupid
question but I can't figure it out. I hope this is the right forum for these
kind of questions.

Before I started using R I was using STATA to run a Wilcoxon signed-rank
test on two variables. See data below:

https://spreadsheets.google.com/pub?key=0ApodAA2GAEP_dDZkdzZHSFBqX1JHOWJBX1dMQUZCVkEhl=enoutput=html%20%20https://spreadsheets.google.com/pub?key=0ApodAA2GAEP_dDZkdzZHSFBqX1JHOWJBX1dMQUZCVkEhl=enoutput=html

STATA Output:
. signrank x=y

Wilcoxon signed-rank test

sign |  obs   sum ranksexpected
-+-
positive |   413101  2330.5
negative |   181560  2330.5
zero |   4912251225
-+-
 all |  10858865886

unadjusted variance   106438.50
adjustment for ties -282.38
adjustment for zeros  -10106.25
 --
adjusted variance  96049.88

Ho: transfer_2_a = transfer_2_b
 z =   2.486
Prob  |z| =   *0.0129*

When running a Wilcoxon signed-rank test



wilcox.test(datablatt$x, datablatt$y)

Wilcoxon rank sum test with continuity correction

data:  datablatt$x and datablatt$y
W = 7059.5, p-value = *0.09197*
alternative hypothesis: true location shift is not equal to 0

As you can see the p Values are different (one with H0 rejection and the
other one not). I tested whether it could be that the STATA one isn't paired
but this doesn't seem to be the problem.

I'm dumbfound what could lead to such a difference. I couldn't find any
seetings I have missed but I somehow I guess I'm using the function in the
wrong way...
Any ideas?
Thanks a lot in advance!

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



--
Alain Guillet
Statistician and Computer Scientist

SMCS - IMMAQ - Université catholique de Louvain
Bureau c.316
Voie du Roman Pays, 20
B-1348 Louvain-la-Neuve
Belgium

tel: +32 10 47 30 50

__
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] coef(summary) and plyr

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 7:51 AM, moleps wrote:


Dear all,

I´m having trouble getting a list of regression variables back into  
a dataframe.


mydf - data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))

mydf$fac-factor(sample((0:2),replace=T,100))

mydf$y- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)

dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))-dl

here I´d like to use

ldply(dl,coef(summary)) or something similar but I cant figure it  
out...


dfdl - ldply(dl, function(x) coef(summary(x)) )

Doesn't create a grouping variable, so:

dfdl$group=rep(0:2, each=4)


David Winsemius, MD
West Hartford, CT

__
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 Base Code

2010-08-09 Thread Ben Bolker
nancy_shackelford nancy.shackelford at gmail.com writes:

 Hello all,
 
 I need to imitate the 'q' function (qnorm, qweibull, etc) for Clark's 2Dt
 distribution model.  I'm not skilled enough in R to code it myself, so I
 thought I could find the base code for one of the existing 'q' functions and
 just modify it.  However, I'm having trouble navigating through the R Source
 Code on the CRAN website.  I've searched some forum and help sites, but I
 can't find anything specific on locating function codes.  
 
 I also read somewhere that Clark's 2Dt is available in the R distribution
 functions, but I haven't found anything that confirms that.  

   You can find the C source code for qt in

http://svn.r-project.org/R/trunk/src/nmath/qt.c

  and the R code is in

http://svn.r-project.org/R/trunk/src/library/stats/R/distn.R

but I don't think this is really what you want.  As pointed out
in Clark et al 1999 (Ecology), the Clark 2Dt function is just a bivariate
version of the univariate t-distribution.  I think that if you stare at
the equations in Clark et al 1999 and (e.g.) in ?dt you can probably
adapt the existing pt/qt functions to get where you need, adjusting
normalizing constants as appropriate ...

  PS: when asking questions about field-specific topics on the
general R list, it's a good idea to give a little more background --
even references, in case someone is interested. Few people outside
of community ecology have heard of Clark's 2Dt ...

  good luck,
Ben Bolker

__
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] Difference Between R: wilcox.test and STATA: signrank

2010-08-09 Thread peter dalgaard

On Aug 9, 2010, at 3:03 PM, Alain Guillet wrote:

 Hi,
 
 Look at the output of the test made in R and you can see it is a Wilcoxon 
 rank sum test and not a Wilcoxon signed rank test.

It might be helpful to add that paired=TRUE is needed in the call to get the 
signed-rank test.

 If there are ties, I know I prefer wilcox.exact from the exactRankTests.
 

(Not that much of an issue in larger sample sizes, I'd say. Even with binary 
data, the normal approximation works reasonably well under the usual 
assumptions of expected counts  5, since the tie-adjustment for the variance 
is exact for the distribution of the ranks. The continuity correction doesn't 
quite work though. Anyways, wilcox.exact is of course a nice thing to have.)


 Alain
 
 On 09-Aug-10 12:43, Capasia wrote:
 This is my first post to the mailing list and I guess it's a pretty stupid
 question but I can't figure it out. I hope this is the right forum for these
 kind of questions.
 
 Before I started using R I was using STATA to run a Wilcoxon signed-rank
 test on two variables. See data below:
 
 https://spreadsheets.google.com/pub?key=0ApodAA2GAEP_dDZkdzZHSFBqX1JHOWJBX1dMQUZCVkEhl=enoutput=html%20%20https://spreadsheets.google.com/pub?key=0ApodAA2GAEP_dDZkdzZHSFBqX1JHOWJBX1dMQUZCVkEhl=enoutput=html
 
 STATA Output:
 . signrank x=y
 
 Wilcoxon signed-rank test
 
sign |  obs   sum ranksexpected
 -+-
positive |   413101  2330.5
negative |   181560  2330.5
zero |   4912251225
 -+-
 all |  10858865886
 
 unadjusted variance   106438.50
 adjustment for ties -282.38
 adjustment for zeros  -10106.25
 --
 adjusted variance  96049.88
 
 Ho: transfer_2_a = transfer_2_b
 z =   2.486
Prob  |z| =   *0.0129*
 
 When running a Wilcoxon signed-rank test
 
 
 wilcox.test(datablatt$x, datablatt$y)
 Wilcoxon rank sum test with continuity correction
 
 data:  datablatt$x and datablatt$y
 W = 7059.5, p-value = *0.09197*
 alternative hypothesis: true location shift is not equal to 0
 
 As you can see the p Values are different (one with H0 rejection and the
 other one not). I tested whether it could be that the STATA one isn't paired
 but this doesn't seem to be the problem.
 
 I'm dumbfound what could lead to such a difference. I couldn't find any
 seetings I have missed but I somehow I guess I'm using the function in the
 wrong way...
 Any ideas?
 Thanks a lot in advance!
 
  [[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.
 
 
 -- 
 Alain Guillet
 Statistician and Computer Scientist
 
 SMCS - IMMAQ - Université catholique de Louvain
 Bureau c.316
 Voie du Roman Pays, 20
 B-1348 Louvain-la-Neuve
 Belgium
 
 tel: +32 10 47 30 50
 
 __
 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.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] bind a data frame columns

2010-08-09 Thread Anna Lippel

Hello guys, I want to rbind the columns of a data frame but I don't know how
to do it, let's say:
A   B   C
1   2   3 
1   2   3

I want to get
1
1
2
2
3
3

It seems very simple but I still didnt get a find of how to do it...Please
help!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/bind-a-data-frame-columns-tp2318526p2318526.html
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] Two questions on R and cairo/Cairo

2010-08-09 Thread r-help
 On a headless Linux server running R 2.9.2 I would like to enable 
support for cairo, but capabilities(cairo) keeps on giving me FALSE. 
Is it possible what I am trying to do or can this only be achieved at R 
build time? I do not have administrative rights on this server.


After compiling cairo-1.8.10 and its dependencies from source in my home 
directory, I finally managed to install the Cairo package (capital C). 
Although capabilities(cairo) still gives me FALSE, I am now able to 
produce graphics. Apart from convenience, is there any difference 
between using built-in support for cairo or using the Cairo package?


Carsten

__
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] ESS question. How to get rid of ess-smart-underscore?

2010-08-09 Thread Abhijit Dasgupta
I bogged about 3 possible solutions recently (statbandit.wordpress.com).
Possibly the 2nd most recent post.

Abhijit

On Aug 9, 2010 8:28 AM, W Eryk Wolski wewol...@gmail.com wrote:

Hi,

ESS replaces _ by -. How can I switch off this feature?

 I need to be able to type the underscore

Thanks
Eryk

--
Witold Eryk Wolski

Heidmark str 5
D-28329 Bremen
tel.: 04215261837

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


Re: [R] bind a data frame columns

2010-08-09 Thread Ivan Calandra
  Hi!

Would unlist() work for you?

HTH,
Ivan

Le 8/9/2010 16:00, Anna Lippel a écrit :
 Hello guys, I want to rbind the columns of a data frame but I don't know how
 to do it, let's say:
 A   B   C
 1   2   3
 1   2   3

 I want to get
 1
 1
 2
 2
 3
 3

 It seems very simple but I still didnt get a find of how to do it...Please
 help!

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php


[[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] coef(summary) and plyr

2010-08-09 Thread David Winsemius
If you look at the output (as I did)  you should see that despite  
whatever expectations you have developed regarding plyr, that it did  
not produce a grouping variable:


 ldply(dl, function(x) coef(summary(x)) )
   facEstimate Std. Error t value Pr(|t|)
10  -0.3563418  0.1438322   -2.477483 1.820555e-02
21   0.9197772  0.15259006.027768 7.097623e-07
32   3.0481679  0.1331307   22.896050 1.197920e-22
40 -18.7726473  0.1281064 -146.539553 2.125848e-50
51  -0.2961841  0.1885210   -1.571093 1.273942e-01
62   1.2846496  0.18333947.006946 1.277086e-07
70   2.9664816  0.1737222   17.076010 2.448612e-16
81 -18.7265068  0.2044723  -91.584567 3.048491e-36
92   0.3993073  0.19797132.016996 5.455569e-02
10   0   0.7657945  0.24774593.091048 4.846678e-03
11   1   3.0365005  0.1731814   17.533641 1.470033e-15
12   2 -19.2140081  0.1882448 -102.069256 2.741417e-34
Warning message:
In data.frame(..., check.names = FALSE) :
  row names were found from a short variable and have been discarded

--
David


On Aug 9, 2010, at 10:11 AM, moleps wrote:

ldply doesnt need a grouping variable as far as I understand the  
command..


Description

For each element of a list, apply function then combine results into  
a data frame


Usage

ldply(.data, .fun = NULL, ..., .progress = none)


regards,

M


On 9. aug. 2010, at 15.33, David Winsemius wrote:



On Aug 9, 2010, at 7:51 AM, moleps wrote:


Dear all,

I´m having trouble getting a list of regression variables back  
into a dataframe.


mydf - data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))

mydf$fac-factor(sample((0:2),replace=T,100))

mydf$y- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)

dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))-dl

here I´d like to use

ldply(dl,coef(summary)) or something similar but I cant figure it  
out...


dfdl - ldply(dl, function(x) coef(summary(x)) )

Doesn't create a grouping variable, so:

dfdl$group=rep(0:2, each=4)


David Winsemius, MD
West Hartford, CT





David Winsemius, MD
West Hartford, CT

__
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] package names in Latex

2010-08-09 Thread Erin Hodgess
Dear R People:

When putting R package names in Latex, do we use \it or \em, please?

Thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] m-estimators

2010-08-09 Thread S Ellison
check the robustbase package and rlm or hubers in MASS

You'll need to know which m-estimator you want, but both those packages
include at least some m-estimators.

Strictly, so does the base package; the mean is an m-estimator. Just
not a very robust one!

S Ellison

 Iasonas Lamprianou lampria...@yahoo.com 06/08/2010 08:10:44 

Dear colleagues

can somebody help me by showing how we can compute m-estimators in R?

thanks

Dr. Iasonas Lamprianou


Assistant Professor (Educational Research and Evaluation)
Department of Education Sciences
European University-Cyprus
P.O. Box 22006
1516 Nicosia
Cyprus 
Tel.: +357-22-713178
Fax: +357-22-590539


Honorary Research Fellow
Department of Education
The University of Manchester
Oxford Road, Manchester M13 9PL, UK
Tel. 0044  161 275 3485
iasonas.lampria...@manchester.ac.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.

***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Logistic Regression in R (SAS -like output)

2010-08-09 Thread Gabor Grothendieck
On Mon, Aug 9, 2010 at 6:43 AM, Harsh singhal...@gmail.com wrote:
 Hello useRs,

 I have a problem at hand which I'd think is fairly common amongst
 groups were R is being adopted for Analytics in place of SAS.
 Users would like to obtain results for logistic regression in R that
 they have become accustomed to in SAS.

 Towards this end, I was able to propose the Design package in R which
 contains many functions to extract the various metrics that SAS
 reports.

 If you have suggestions pertaining to other packages, or sample code
 that replicates some of the SAS outputs for logistic regression, I
 would be glad to hear of them.

 Some of the requirements are:
 - Stepwise variable selection for logistic regression
 - Choose base level for factor variables
 - The Hosmer-Lemeshow statistic
 - concordant and discordant
 - Tau C statistic


For stepwise logistic regression using AIC see:

library(MASS)
?stepAIC

For specifying reference level:

?relevel

__
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] package names in Latex

2010-08-09 Thread Uwe Ligges



On 09.08.2010 16:30, Erin Hodgess wrote:

Dear R People:

When putting R package names in Latex, do we use \it or \em, please?

Thanks,
Erin





Depends.

For example, the style guide of the Journal of Statistical Software asks 
you to use \pkg{} which is defined as

\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}}

which is somehow similar to The R Journal's style.

Best,
Uwe Ligges

__
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] package names in Latex

2010-08-09 Thread Marc Schwartz
On Aug 9, 2010, at 9:30 AM, Erin Hodgess wrote:

 Dear R People:
 
 When putting R package names in Latex, do we use \it or \em, please?
 
 Thanks,
 Erin


Erin,

I may be missing something specific to your application, but for the R Journal, 
JSS and .Rd help files, package names would typically be bolded using a \pkg 
directive (eg. \pkg{YourPackageName}), which would bold the package name within 
the braces.

If you are doing this outside of those environments, you can duplicate the 
effect by using \textbf{YourPackageName}, which would bold the text within the 
braces only.

HTH,

Marc Schwartz

__
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] nested 'by'

2010-08-09 Thread steven mosher
Assuming a data frame or matrix with two columns representing variable that
you want to aggregate over.
you want to calculate column means, by year, for each Id



example-data.frame(id=c(rep(12345,5),rep(54321,6),rep(45678,7)),Year=rep(seq(1900,1902,by=1),6),
x=seq(1,18,by=1),y=seq(18,1,by=-1))
 example
  id Year  x  y
1  12345 1900  1 18
2  12345 1901  2 17
3  12345 1902  3 16
4  12345 1900  4 15
5  12345 1901  5 14
6  54321 1902  6 13
7  54321 1900  7 12
8  54321 1901  8 11
9  54321 1902  9 10
10 54321 1900 10  9
11 54321 1901 11  8
12 45678 1902 12  7
13 45678 1900 13  6
14 45678 1901 14  5
15 45678 1902 15  4
16 45678 1900 16  3
17 45678 1901 17  2
18 45678 1902 18  1

 result-by(example[,3:4], example$id, by(example[,3:4],
example$Year,colMeans, na.rm=T))
Error in FUN(X[[1L]], ...) : could not find function FUN


desired result should look like:
 id  Year  meanx mean y
1  12345 1900   ......
2  12345 1901   ...
3  12345 1902   ...
4  54321 1900
5  54321 1901
6  54321 1902
7 45678 1900
8 45678 1901
9 45678 1902

[[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] image plot but data not on grid.

2010-08-09 Thread Hadley Wickham
With sweave, you need to explicitly print() the output of ggplot2 and
lattice plots.
Hadley

On Mon, Aug 9, 2010 at 6:32 AM, W Eryk Wolski wewol...@gmail.com wrote:
 qplot does (?) what I was looking for!
 At least it plots what I want to plot in the interactive modus.
 However, it seems not to work with Sweave.

 Thanks



 On 7 August 2010 16:15, Michael Bedward michael.bedw...@gmail.com wrote:
 If it's regular, but incomplete, that method will work.  If it's
 irregular, then no image method will work without first interpolating
 a regular grid.

 Thanks Hadley. As I suspected,  but ggplot2 is so very clever that I
 thought it was worth asking :)

 Michael

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




 --
 Witold Eryk Wolski

 Heidmark str 5
 D-28329 Bremen
 tel.: 04215261837





-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
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.


Re: [R] 3d data plot

2010-08-09 Thread Uwe Ligges



On 09.08.2010 13:17, szisziszilvi wrote:


Hello!

E.g. I have a file like sample.csv:
condition1;condition2;myVar
0.902443929;0.879344831;0.963357725
0.91014254;0.717720763;0.953787867
0.899773581;0.871760835;1.031798755
0.892074969;0.863043345;1.080447426
0.847759139;0.894642857;1.080521187
0.847179086;0.89650009;1.111348011
0.849229318;0.912751303;1.154026236


See function plot3d() in package rgl, cloud() in lattice, 
scatterplot3d() in scatterplot3d, etc.


Uwe Ligges




(... some thousands of measurements, like (p,V,T) - just other types of
physical quantities)
(wherever a data misses, it's sign is -999)

I can read it into a data frame like:
mes- read.csv(sample.csv, sep=;, na.strings=-999)

But what shall I do afterwards? I've tried to understand persp, but that
doesn't really seem to be the solution.

Maybe it would help if you could tell me just which example to check more
carefully on the mentioned page. I've tried to search for one, but failed
unfortunatelly.


__
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] coef(summary) and plyr

2010-08-09 Thread Hadley Wickham
On Mon, Aug 9, 2010 at 9:29 AM, David Winsemius dwinsem...@comcast.net wrote:
 If you look at the output (as I did)  you should see that despite whatever
 expectations you have developed regarding plyr, that it did not produce a
 grouping variable:

 ldply(dl, function(x) coef(summary(x)) )
   fac    Estimate Std. Error     t value     Pr(|t|)
 1    0  -0.3563418  0.1438322   -2.477483 1.820555e-02
 2    1   0.9197772  0.1525900    6.027768 7.097623e-07
 3    2   3.0481679  0.1331307   22.896050 1.197920e-22
 4    0 -18.7726473  0.1281064 -146.539553 2.125848e-50
 5    1  -0.2961841  0.1885210   -1.571093 1.273942e-01
 6    2   1.2846496  0.1833394    7.006946 1.277086e-07
 7    0   2.9664816  0.1737222   17.076010 2.448612e-16
 8    1 -18.7265068  0.2044723  -91.584567 3.048491e-36
 9    2   0.3993073  0.1979713    2.016996 5.455569e-02
 10   0   0.7657945  0.2477459    3.091048 4.846678e-03
 11   1   3.0365005  0.1731814   17.533641 1.470033e-15
 12   2 -19.2140081  0.1882448 -102.069256 2.741417e-34

cf.

 ldply(dl, coef)
  fac (Intercept)x1   x2x3
1   0 -0.12051346 1.1391933 3.022287 -19.01828
2   1 -0.08890497 1.0741715 3.219577 -19.14279
3   2 -0.12728421 0.9284263 2.973905 -19.12774

which you can see maintains the original grouping variable fac.

The problem is that summary stores the variable names as rownames,
which does not make for easy rbinding.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
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.


Re: [R] nested 'by'

2010-08-09 Thread Henrique Dallazuanna
Try this:

aggregate(example[c('x', 'y')], example[c('id', 'Year')], 'mean')


On Mon, Aug 9, 2010 at 11:46 AM, steven mosher mosherste...@gmail.comwrote:

 Assuming a data frame or matrix with two columns representing variable that
 you want to aggregate over.
 you want to calculate column means, by year, for each Id




 example-data.frame(id=c(rep(12345,5),rep(54321,6),rep(45678,7)),Year=rep(seq(1900,1902,by=1),6),
 x=seq(1,18,by=1),y=seq(18,1,by=-1))
  example
  id Year  x  y
 1  12345 1900  1 18
 2  12345 1901  2 17
 3  12345 1902  3 16
 4  12345 1900  4 15
 5  12345 1901  5 14
 6  54321 1902  6 13
 7  54321 1900  7 12
 8  54321 1901  8 11
 9  54321 1902  9 10
 10 54321 1900 10  9
 11 54321 1901 11  8
 12 45678 1902 12  7
 13 45678 1900 13  6
 14 45678 1901 14  5
 15 45678 1902 15  4
 16 45678 1900 16  3
 17 45678 1901 17  2
 18 45678 1902 18  1

  result-by(example[,3:4], example$id, by(example[,3:4],
 example$Year,colMeans, na.rm=T))
 Error in FUN(X[[1L]], ...) : could not find function FUN


 desired result should look like:
  id  Year  meanx mean y
 1  12345 1900   ......
 2  12345 1901   ...
 3  12345 1902   ...
 4  54321 1900
 5  54321 1901
 6  54321 1902
 7 45678 1900
 8 45678 1901
 9 45678 1902

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] Invalid plot type '1'

2010-08-09 Thread Stephen Liu
  The Introduction to R is rather terse, but a reasonable starting

 point.  The other manuals listed on that page are special-purpose
 manuals for installation  administration, development, etc..  You
 can try the manuals listed in the contributed documentation section
 too.

Hi Ben,

Thanks for your advice.

I suppose you meant those documentation on following URL

Contributed Documentation
http://cran.r-project.org/other-docs.html


The difficulty for a beginner learning R is to find the right document.  There 
are many documents on Internet.  It'll take lengthy time going through all of 
them to find a right document to follow.  It is the same in learning other new 
subjects.

Other advice noted and thanks

B.R.
Stephen L



__
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] RExcel: Sctools not available

2010-08-09 Thread Erich Neuwirth
Please post any qeustions regarding RExcel to the rcom-l mailing list.
You can subscribe at rcom.univie.ac.at

On Aug 9, 2010, at 1:42 PM, Andreas Scherer wrote:

  I have a problem with RExcel which I have now installed on top of R 2.11.0. 
 The problem had been posted in 2009 on the forum by someone else, but no 
 (useful) response had been uploaded. 
 The issue is that 
 whenever I am trying to start R from excel, or by clicking the[ 
 RExcel2007 with 
 RCommander] icon., I get the following messages boxes : 
 SCTools not available  
 then: 
 there seems to be no R process connected 
 to excel 
 though both r and excel starts after I click the Icon!! 
 
 Could you please help me with this issue? 
 Thank you very much. 
 
 
 
 
   [[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.

--
Erich Neuwirth
Didactic Center for Computer Science and Institute for Scientific Computing
University of Vienna





[[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] nested 'by'

2010-08-09 Thread steven mosher
That works.

Thanks

On Mon, Aug 9, 2010 at 7:55 AM, Henrique Dallazuanna www...@gmail.comwrote:

 Try this:

 aggregate(example[c('x', 'y')], example[c('id', 'Year')], 'mean')


 On Mon, Aug 9, 2010 at 11:46 AM, steven mosher mosherste...@gmail.comwrote:

 Assuming a data frame or matrix with two columns representing variable
 that
 you want to aggregate over.
 you want to calculate column means, by year, for each Id




 example-data.frame(id=c(rep(12345,5),rep(54321,6),rep(45678,7)),Year=rep(seq(1900,1902,by=1),6),
 x=seq(1,18,by=1),y=seq(18,1,by=-1))
  example
  id Year  x  y
 1  12345 1900  1 18
 2  12345 1901  2 17
 3  12345 1902  3 16
 4  12345 1900  4 15
 5  12345 1901  5 14
 6  54321 1902  6 13
 7  54321 1900  7 12
 8  54321 1901  8 11
 9  54321 1902  9 10
 10 54321 1900 10  9
 11 54321 1901 11  8
 12 45678 1902 12  7
 13 45678 1900 13  6
 14 45678 1901 14  5
 15 45678 1902 15  4
 16 45678 1900 16  3
 17 45678 1901 17  2
 18 45678 1902 18  1

  result-by(example[,3:4], example$id, by(example[,3:4],
 example$Year,colMeans, na.rm=T))
 Error in FUN(X[[1L]], ...) : could not find function FUN


 desired result should look like:
  id  Year  meanx mean y
 1  12345 1900   ......
 2  12345 1901   ...
 3  12345 1902   ...
 4  54321 1900
 5  54321 1901
 6  54321 1902
 7 45678 1900
 8 45678 1901
 9 45678 1902

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




 --
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O


[[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] Invalid plot type '1'

2010-08-09 Thread Erik Iverson



Stephen Liu wrote:

 The Introduction to R is rather terse, but a reasonable starting



point.  The other manuals listed on that page are special-purpose
manuals for installation  administration, development, etc..  You
can try the manuals listed in the contributed documentation section
too.


Hi Ben,

Thanks for your advice.

I suppose you meant those documentation on following URL

Contributed Documentation
http://cran.r-project.org/other-docs.html


The difficulty for a beginner learning R is to find the right document.  There 
are many documents on Internet.  It'll take lengthy time going through all of 
them to find a right document to follow.  It is the same in learning other new 
subjects.


Other advice noted and thanks


I would consider a beginning R book if your budget allows it.  The most 
useful book will depend on your background and interests,


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

__
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] Extract values from data frame in R

2010-08-09 Thread William Dunlap
 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Erik Iverson
 Sent: Sunday, August 08, 2010 11:27 PM
 To: Alexander Eggel
 Cc: r-help@r-project.org
 Subject: Re: [R] Extract values from data frame in R
 
 On 08/09/2010 01:16 AM, Alexander Eggel wrote:
  Using R, I would like to find out which Samples (S1, S2, 
 S3, S4, S5) fulfill
  the following criteria:contain minimally one value (x, y or 
 z) bigger than
  4. Any ideas? Thanks, Alex.
 
  data
 Sample   xy  z
  1S1   -0.35.32.5
  2S20.40.2   -1.2
  3S31.2   -0.63.2
  4S44.30.75.7
  5S52.44.32.3
 
 Untested:
 
 Sample[apply(Sample[-1], 1, function(x) any(x)  4)), Sample]

The any(x)4 should be any(x4), as in:
   f1 - function(data) data[apply(data[-1], 1, function(x) any(x 
4)), Sample]
Note that operating a column at a time on a
data is often faster than operating a row at
a time.  E.g.,
   f2 - function(data) with(data, Sample[x4 | y4 | z4])
   makeData - function (nrow, seed){
  if (!missing(seed)) 
  set.seed(seed)
  data.frame(Sample = sample(paste(S, 1:5, sep = ), replace =
TRUE, 
  size = nrow), x = rgamma(nrow, 4), y = rgamma(nrow, 5), 
  z = rgamma(nrow, 3))
}
   z - makeData(1, seed=73)
   system.time(v1 - f1(z))
 user  system elapsed 
 0.270.000.25 
   system.time(v2 - f2(z))
 user  system elapsed 
 0.000.010.01 
   identical(v1, v2)
  [1] TRUE
   length(v1)
  [1] 8390

(I prefer that non-apply approach because apply often
causes trouble when used with data.frames -- it is only
safe when all columns are numeric.)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.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] TRUE/FALSE

2010-08-09 Thread Wu Gong

I can't understand why you doubled (

if((combos[e,f]==1) 

-
A R learner.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/TRUE-FALSE-tp2318668p2318684.html
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] if several expressions (basic question)

2010-08-09 Thread Dwayne Blind
Dear R users,

I have a basic question. In an if statement, when several expressions have
to be evaluated, they must be put inside curly braces, right ?

For example :

if (x2) {

y=3
z=2

}


Thank you very much,
Dwayne

[[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] TRUE/FALSE

2010-08-09 Thread Uwe Ligges



On 09.08.2010 17:47, Wu Gong wrote:


I can't understand why you doubled (

if((combos[e,f]==1)

-
A R learner.


?

Can you please refer and quote the original messages you are replying to 
and can you please also include the one who asked the question? Not 
everybody is subscribed to this list. Thank you very much for your 
contributions.


Best,
Uwe Ligges

__
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] coef(summary) and plyr

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 10:11 AM, moleps wrote:

ldply doesnt need a grouping variable as far as I understand the  
command..


There is one further improvement to consider. When I tried using dlply  
to tackle a problem on which I had been bashing my head for the last  
three days and it gave just the results I had been looking for, I also  
noticed that the dlply function returns the grouping variable levels  
in an attribute, split_labels, which could be unlisted to use as an  
argument to the rep() call I suggested earlier:


dfdl$group=rep(unlist(attr(dl, split_labels)), each=4)

That might make the results more self-documenting in situations where  
the grouping levels were more involved than 0:2.


(Now, if I can get rms::Predict to behave as nicely with the plyr  
functions as did rms::cph, I will be home free.)

--
David.


Description

For each element of a list, apply function then combine results into  
a data frame


Usage

ldply(.data, .fun = NULL, ..., .progress = none)


regards,

M


On 9. aug. 2010, at 15.33, David Winsemius wrote:



On Aug 9, 2010, at 7:51 AM, moleps wrote:


Dear all,

I´m having trouble getting a list of regression variables back  
into a dataframe.


mydf - data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))

mydf$fac-factor(sample((0:2),replace=T,100))

mydf$y- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)

dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))-dl

here I´d like to use

ldply(dl,coef(summary)) or something similar but I cant figure it  
out...


dfdl - ldply(dl, function(x) coef(summary(x)) )

Doesn't create a grouping variable, so:

dfdl$group=rep(0:2, each=4)


David Winsemius, MD
West Hartford, CT





David Winsemius, MD
West Hartford, CT

__
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] if several expressions (basic question)

2010-08-09 Thread Joshua Wiley
On Mon, Aug 9, 2010 at 8:51 AM, Dwayne Blind dwaynebl...@gmail.com wrote:
 Dear R users,

 I have a basic question. In an if statement, when several expressions have
 to be evaluated, they must be put inside curly braces, right ?

Yes.

if(1  2) {print(hello); print(world)}
if(4  2) {print(hello); print(world)}


 For example :

 if (x2) {

    y=3
    z=2

 }


 Thank you very much,
 Dwayne

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




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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] if several expressions (basic question)

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 12:14 PM, Joshua Wiley wrote:

On Mon, Aug 9, 2010 at 8:51 AM, Dwayne Blind dwaynebl...@gmail.com  
wrote:

Dear R users,

I have a basic question. In an if statement, when several  
expressions have

to be evaluated, they must be put inside curly braces, right ?


Yes.

if(1  2) {print(hello); print(world)}
if(4  2) {print(hello); print(world)}


Well, not actually. If they are all on the same line separated by  
;'s the parser should accept.


if(TRUE) print(hello); print(world); y=3; z=2
y
z

--
David.




For example :

if (x2) {

   y=3
   z=2

}


Thank you very much,
Dwayne

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





--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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.


David Winsemius, MD
West Hartford, CT

__
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] if several expressions (basic question)

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 12:29 PM, Joshua Wiley wrote:

On Mon, Aug 9, 2010 at 9:26 AM, David Winsemius dwinsem...@comcast.net 
 wrote:


On Aug 9, 2010, at 12:14 PM, Joshua Wiley wrote:


On Mon, Aug 9, 2010 at 8:51 AM, Dwayne Blind dwaynebl...@gmail.com
wrote:


Dear R users,

I have a basic question. In an if statement, when several  
expressions

have
to be evaluated, they must be put inside curly braces, right ?


Yes.

if(1  2) {print(hello); print(world)}
if(4  2) {print(hello); print(world)}


Well, not actually. If they are all on the same line separated by  
;'s the

parser should accept.

if(TRUE) print(hello); print(world); y=3; z=2
y
z

I thought that at first also but look at:

if(FALSE) print(hello); print(world)

At least on my version of R, hello is not printed but world is.


Sorry for the noise. I misinterpreted the results.
--
David.





--
David.




For example :

if (x2) {

  y=3
  z=2

}


Thank you very much,
Dwayne

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





--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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.


David Winsemius, MD
West Hartford, CT






--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/


David Winsemius, MD
West Hartford, CT

__
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] if several expressions (basic question)

2010-08-09 Thread Dwayne Blind
Thanks to all of you.

Dwayne

2010/8/9 David Winsemius dwinsem...@comcast.net


 On Aug 9, 2010, at 12:29 PM, Joshua Wiley wrote:

 On Mon, Aug 9, 2010 at 9:26 AM, David Winsemius dwinsem...@comcast.net
 wrote:


 On Aug 9, 2010, at 12:14 PM, Joshua Wiley wrote:

 On Mon, Aug 9, 2010 at 8:51 AM, Dwayne Blind dwaynebl...@gmail.com
 wrote:


 Dear R users,

 I have a basic question. In an if statement, when several expressions
 have
 to be evaluated, they must be put inside curly braces, right ?


 Yes.

 if(1  2) {print(hello); print(world)}
 if(4  2) {print(hello); print(world)}


 Well, not actually. If they are all on the same line separated by ;'s
 the
 parser should accept.

 if(TRUE) print(hello); print(world); y=3; z=2
 y
 z

 I thought that at first also but look at:

 if(FALSE) print(hello); print(world)

 At least on my version of R, hello is not printed but world is.


 Sorry for the noise. I misinterpreted the results.
 --
 David.




 --
 David.



 For example :

 if (x2) {

  y=3
  z=2

 }


 Thank you very much,
 Dwayne

  [[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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




 --
 Joshua Wiley
 Ph.D. Student, Health Psychology
 University of California, Los Angeles
 http://www.joshuawiley.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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


 David Winsemius, MD
 West Hartford, CT





 --
 Joshua Wiley
 Ph.D. Student, Health Psychology
 University of California, Los Angeles
 http://www.joshuawiley.com/


 David Winsemius, MD
 West Hartford, CT



[[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] regression line of 2 independent variables

2010-08-09 Thread array chip
Hi, I would like to a draw a scatterplot of x1 and x2 (plot (x1, x2)), and also 
want to draw a sort of regression line across the data points. But x1 and x2 
are just 2 independent variables, so in this case a regression of x1 over x2, 
or 
vice versa, is not appropriate per se. What would be an appropriate way to do 
this? Thanks for any suggestions.

John

__
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] TRUE/FALSE

2010-08-09 Thread Wu Gong

Hi Uwe,

I'm sorry for the inconvenience I caused. 

I read posts of R Help through nabble forum. When I reply a post through
the forum, it is distinctly clear that my message is a reply to the original
poster's post, just like a conversation. Those posts which quote the
original message which itself might quote the original original message
.., seem to be too much redundant to me. I have been trying to be a
well-behaved member of the R community:)

Best Regards,

Wu Gong


Uwe Ligges-3 wrote:
 
 Can you please refer and quote the original messages you are replying to 
 and can you please also include the one who asked the question? Not 
 everybody is subscribed to this list. Thank you very much for your 
 contributions.
 


-
A R learner.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/TRUE-FALSE-tp2318668p2318778.html
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] if several expressions (basic question)

2010-08-09 Thread jim holtman
The safe bit is to always use the curly brackets on the 'if'
statements to avoid problems.  I always do

if (..) {
 statement
}



On Mon, Aug 9, 2010 at 12:29 PM, Joshua Wiley jwiley.ps...@gmail.com wrote:
 On Mon, Aug 9, 2010 at 9:26 AM, David Winsemius dwinsem...@comcast.net 
 wrote:

 On Aug 9, 2010, at 12:14 PM, Joshua Wiley wrote:

 On Mon, Aug 9, 2010 at 8:51 AM, Dwayne Blind dwaynebl...@gmail.com
 wrote:

 Dear R users,

 I have a basic question. In an if statement, when several expressions
 have
 to be evaluated, they must be put inside curly braces, right ?

 Yes.

 if(1  2) {print(hello); print(world)}
 if(4  2) {print(hello); print(world)}

 Well, not actually. If they are all on the same line separated by ;'s the
 parser should accept.

 if(TRUE) print(hello); print(world); y=3; z=2
 y
 z
 I thought that at first also but look at:

 if(FALSE) print(hello); print(world)

 At least on my version of R, hello is not printed but world is.



 --
 David.


 For example :

 if (x2) {

   y=3
   z=2

 }


 Thank you very much,
 Dwayne

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




 --
 Joshua Wiley
 Ph.D. Student, Health Psychology
 University of California, Los Angeles
 http://www.joshuawiley.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.

 David Winsemius, MD
 West Hartford, CT





 --
 Joshua Wiley
 Ph.D. Student, Health Psychology
 University of California, Los Angeles
 http://www.joshuawiley.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 that 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] coef(summary) and plyr

2010-08-09 Thread Hadley Wickham
 There is one further improvement to consider. When I tried using dlply to
 tackle a problem on which I had been bashing my head for the last three days
 and it gave just the results I had been looking for, I also noticed that the
 dlply function returns the grouping variable levels in an attribute,
 split_labels, which could be unlisted to use as an argument to the rep()
 call I suggested earlier:

 dfdl$group=rep(unlist(attr(dl, split_labels)), each=4)

 That might make the results more self-documenting in situations where the
 grouping levels were more involved than 0:2.

That's exactly what dlply does - so you should never have to do that yourself.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
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] optimization subject to constraints

2010-08-09 Thread Gildas Mazo
Dear R users,

I'm looking for tools to perform optimization subject to constraints,
both linear and non-linear. I don't mind which algorithm may be used, my
primary aim is to get something general and easy-to-use to study simples
examples.

Thanks for helping,

Gildas

__
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] optimization subject to constraints

2010-08-09 Thread Dwayne Blind
Hi !

Why not constrOptim ?

Dwayne

2010/8/9 Gildas Mazo gildas.m...@curie.fr

 Dear R users,

 I'm looking for tools to perform optimization subject to constraints,
 both linear and non-linear. I don't mind which algorithm may be used, my
 primary aim is to get something general and easy-to-use to study simples
 examples.

 Thanks for helping,

 Gildas

 __
 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.htmlhttp://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] List of lists ?

2010-08-09 Thread Carlos Petti
Dear list,

I have to use a list of lists containing vectors.

For instance :

[[1]]
[[1]][[1]]
[1] 1 2 3

[[1]][[2]]
[1] 3 2 1

I want to attribute vectors to the main list

without use of an intermediate list,

but it does not work :

x - list()
x[[1]][[1]] - c(1, 2, 3)
x[[1]][[2]] - c(3, 2, 1)

Thanks in advance,
Carlos

__
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] optimization subject to constraints

2010-08-09 Thread Ravi Varadhan
You may want to look at:

http://cran.r-project.org/web/packages/alabama/index.html

Ravi.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Gildas Mazo
Sent: Monday, August 09, 2010 12:49 PM
To: r-help@r-project.org
Subject: [R] optimization subject to constraints

Dear R users,

I'm looking for tools to perform optimization subject to constraints,
both linear and non-linear. I don't mind which algorithm may be used, my
primary aim is to get something general and easy-to-use to study simples
examples.

Thanks for helping,

Gildas

__
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] optimization subject to constraints

2010-08-09 Thread Matthias Gondan

 try command solnp in package Rsolnp

Am 09.08.2010 18:56, schrieb Dwayne Blind:

Hi !

Why not constrOptim ?

Dwayne

2010/8/9 Gildas Mazogildas.m...@curie.fr


Dear R users,

I'm looking for tools to perform optimization subject to constraints,
both linear and non-linear. I don't mind which algorithm may be used, my
primary aim is to get something general and easy-to-use to study simples
examples.

Thanks for helping,

Gildas



__
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] optimization subject to constraints

2010-08-09 Thread Ravi Varadhan
constrOptim can only handle linear inequality constraints.  It cannot handle
equality (linear or nonlinear) as well as nonlinear inequality constraints.

Ravi.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Dwayne Blind
Sent: Monday, August 09, 2010 12:56 PM
To: Gildas Mazo
Cc: r-help@r-project.org
Subject: Re: [R] optimization subject to constraints

Hi !

Why not constrOptim ?

Dwayne

2010/8/9 Gildas Mazo gildas.m...@curie.fr

 Dear R users,

 I'm looking for tools to perform optimization subject to constraints,
 both linear and non-linear. I don't mind which algorithm may be used, my
 primary aim is to get something general and easy-to-use to study simples
 examples.

 Thanks for helping,

 Gildas

 __
 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.htmlhttp://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-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] TRUE/FALSE

2010-08-09 Thread Turn Fall

Here is my code

# determine the DDOA measurements 
for(e in 1:numSensors)
{
for(f in 1:numSensors)
{
if((combos[e,f]==1)
{
# true distance between each sensor and the target

truedistance[e]-sqrt((targetX-sensorX[e])^2+(targetY-sensorY[e])^2)

# add an error that has a N(0, sigma^2) distribution 
truedistance[e]-(truedistance[e]+rnorm(1, 0, sigma))
}
#truedistance[1] - (truedistance[1]+50)

#determine DDOA measurements (reference sensor is 
sensor #1 here)
index-1
for(e in 1:numSensors)
{
if(e!=r)
{

measurement[index]-(truedistance[f]-truedistance[e]) 
index - (index+1)
}
}   

}
if(combos[e,f]!=1)
{
}
}

combos is just a matrix containing 1's and 0's

This error keeps appearing

Error in if (combos[e, f] == 1) { : missing value where TRUE/FALSE needed


Any ideas?


-- 
View this message in context: 
http://r.789695.n4.nabble.com/TRUE-FALSE-tp2318668p2318668.html
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] coef(summary) and plyr

2010-08-09 Thread moleps
ldply doesnt need a grouping variable as far as I understand the command..

Description

For each element of a list, apply function then combine results into a data 
frame

Usage

ldply(.data, .fun = NULL, ..., .progress = none)


regards,

M


On 9. aug. 2010, at 15.33, David Winsemius wrote:

 
 On Aug 9, 2010, at 7:51 AM, moleps wrote:
 
 Dear all,
 
 I´m having trouble getting a list of regression variables back into a 
 dataframe.
 
 mydf - data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))
 
 mydf$fac-factor(sample((0:2),replace=T,100))
 
 mydf$y- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)
 
 dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))-dl
 
 here I´d like to use
 
 ldply(dl,coef(summary)) or something similar but I cant figure it out...
 
 dfdl - ldply(dl, function(x) coef(summary(x)) )
 
 Doesn't create a grouping variable, so:
 
 dfdl$group=rep(0:2, each=4)
 
 
 David Winsemius, MD
 West Hartford, CT
 

__
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] Changing downloaded source code into a package

2010-08-09 Thread JH

I am wanting to change some lines of code in the R package named nlme
http://cran.r-project.org/web/packages/nlme/index.html
To do this I have downloaded the Package source named nlme_3.1-96.tar.gz,
opened up the file and changed the text documents within the folder named R,
specifically the cor.Struct.txt file.
I now want to know how can I use this modified nlme_3.1-96.tar.gz file in R
2.10. How do I convert this source code into a package?


I have looked on the internet and tried using cmd.exe  then the code 
Rmcd.exe INSTALL -1 ~/nlme_3.1-96.tar.gz 
I end up getting the message The system can't find the specified path,
when I have the file in the directory that Rmcd.exe is in.


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Changing-downloaded-source-code-into-a-package-tp2318559p2318559.html
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] Turning a source into a Package

2010-08-09 Thread JH

I want to edit a function in the nlme package. I download the package source
nlme_3.1-96.tar.gz from the link below then edit it one of the scripts
inside of it. From this stage how can I turn it into a package that I can
use in R?

http://cran.r-project.org/web/packages/nlme/index.html
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Turning-a-source-into-a-Package-tp2318796p2318796.html
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] Difference Between R: wilcox.test and STATA: signrank

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 9:52 AM, peter dalgaard wrote:



On Aug 9, 2010, at 3:03 PM, Alain Guillet wrote:


Hi,

Look at the output of the test made in R and you can see it is a  
Wilcoxon rank sum test and not a Wilcoxon signed rank test.


It might be helpful to add that paired=TRUE is needed in the call to  
get the signed-rank test.


If there are ties, I know I prefer wilcox.exact from the  
exactRankTests.




(Not that much of an issue in larger sample sizes, I'd say. Even  
with binary data, the normal approximation works reasonably well  
under the usual assumptions of expected counts  5, since the tie- 
adjustment for the variance is exact for the distribution of the  
ranks. The continuity correction doesn't quite work though. Anyways,  
wilcox.exact is of course a nice thing to have.)


The OP's data:

 table(xvals=dat$x, yvals=dat$y)
  yvals
xvals   0 0.25 0.5  1 1.1 1.5  2  3 3.5  5 5.5  6  8
  0350   0  1   0   1  2  1   0  0   0  0  0
  0.5   21   1  0   0   0  0  0   0  0   0  0  0
  0.75  00   1  0   0   0  0  0   0  0   0  0  0
  1 70   1  3   0   0  1  0   1  0   0  0  0
  1.1   00   0  0   1   0  0  0   0  0   0  0  0
  1.5   11   0  4   0   2  0  0   0  0   0  0  0
  2 30   0  6   0   2  4  2   1  0   0  0  0
  2.1   00   1  0   0   0  0  0   0  0   0  0  0
  2.5   00   0  0   0   1  0  0   0  2   0  0  0
  3 20   0  0   0   0  5  3   1  1   0  0  0
  3.3   10   0  0   0   0  0  0   0  0   0  0  0
  3.33  00   0  1   0   0  0  0   0  0   0  0  0
  3.5   00   0  1   0   1  0  0   0  1   1  0  0
  5 00   0  0   0   0  0  0   0  2   0  1  1
  1000   0  0   0   0  0  0   0  1   0  0  0


Adding paired=TRUE to the wilcox.test call give the signed rank test  
although tht is not likely to satisfy the OP since she seems to be  
expecting a higher degree of congruence with Stata.


The wilcox.test and wilcox.exact give results that only differ at the  
4th decimal place.


 wilcox.test(dat$x, dat$y, paired=TRUE)

Wilcoxon signed rank test with continuity correction

data:  dat$x and dat$y
V = 1181, p-value = 0.08872
alternative hypothesis: true location shift is not equal to 0

 wilcox.exact(dat$x, dat$y, paired=TRUE)

Asymptotic Wilcoxon signed rank test

data:  dat$x and dat$y
V = 1181, p-value = 0.08805
alternative hypothesis: true mu is not equal to 0

The Stata output indicates some sort of adjustment for zeros. The  
wilcox.test basically throws out the zeros (presumably the zero  
differences), so there may be a difference in the algorithm. Her data  
has 51 zero differences and 61 non-zero differences.


 sum(dat$x==dat$y)
[1] 51
 sum(dat$x!=dat$y)
[1] 61

Wait a minute; the Stata report said she had 49 zeros and only 108  
records.


Different data. Different results. I suppose it could be my editing  
errors. Taking out all the extraneous html junk and restoring missing  
delimiters was kind of a pain.


Capasia;  Don't use Google sheets to transmit data. Instead use dput  
on the datablatt object and just post the results of that output.


--
David.




Alain

On 09-Aug-10 12:43, Capasia wrote:
This is my first post to the mailing list and I guess it's a  
pretty stupid
question but I can't figure it out. I hope this is the right forum  
for these

kind of questions.

Before I started using R I was using STATA to run a Wilcoxon  
signed-rank

test on two variables. See data below:

https://spreadsheets.google.com/pub?key=0ApodAA2GAEP_dDZkdzZHSFBqX1JHOWJBX1dMQUZCVkEhl=enoutput=html 
%20%20https://spreadsheets.google.com/pub?key=0ApodAA2GAEP_dDZkdzZHSFBqX1JHOWJBX1dMQUZCVkEhl=enoutput=html 



STATA Output:
. signrank x=y

Wilcoxon signed-rank test

  sign |  obs   sum ranksexpected
-+-
  positive |   413101  2330.5
  negative |   181560  2330.5
  zero |   4912251225
-+-
   all |  10858865886

unadjusted variance   106438.50
adjustment for ties -282.38
adjustment for zeros  -10106.25
   --
adjusted variance  96049.88

Ho: transfer_2_a = transfer_2_b
   z =   2.486
  Prob  |z| =   *0.0129*

When running a Wilcoxon signed-rank test



wilcox.test(datablatt$x, datablatt$y)

Wilcoxon rank sum test with continuity correction

data:  datablatt$x and datablatt$y
W = 7059.5, p-value = *0.09197*
alternative hypothesis: true location shift is not equal to 0

As you can see the p Values are different (one with H0 rejection  
and the
other one not). I tested whether it could be that the STATA one  
isn't paired

but this doesn't seem to be the problem.

I'm dumbfound what could lead to such a difference. I couldn't  
find any
seetings I have missed but I somehow I guess I'm using the  
function in the

wrong way...
Any ideas?
Thanks a lot in advance!

[[alternative HTML 

[R] Pie Chart in map

2010-08-09 Thread LCOG1

Hey R'rs, 
So im sick of dealing with ESRI products and am looking to stream line a
process i now use GIS to do using R.  I have made a lot of maps using R but
have not yet seen a map that puts pie charts within the map to help
represent data like the attachment. 
http://r.789695.n4.nabble.com/file/n2318816/template1.bmp 

I found Tanimura et al. work Proportional Symbol Mapping in R, but after a
discussion with one of the authors i have learned that the function is out
of date and would require a great deal of reworking.  I also found hexbinpie
on the R graphics gallery that i could incorporate.  

Before i go through the process of rewriting or out right creation of a
process to replicate my GIS results i was hoping to make sure there wasnt
something out there i could use to start or use altogether.  Or perhaps a
set of functions that already exists that i havent thought to use.  

Thanks for the insights everyone.  

JR
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Pie-Chart-in-map-tp2318816p2318816.html
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] TRUE/FALSE

2010-08-09 Thread jim holtman
most likely 'combos[e,f]' is NA; take a look at your data.  Also put

options(error=utils::recover)

in your program so that when the error occurs you can learn to use the
debugging mode to trace down the problem.

On Mon, Aug 9, 2010 at 11:38 AM, Turn  Fall turnandf...@live.co.uk wrote:

 Here is my code

                # determine the DDOA measurements
                for(e in 1:numSensors)
                {
                        for(f in 1:numSensors)
                        {
                                if((combos[e,f]==1)
                                {
                        # true distance between each sensor and the target
                        
 truedistance[e]-sqrt((targetX-sensorX[e])^2+(targetY-sensorY[e])^2)

                        # add an error that has a N(0, sigma^2) distribution
                        truedistance[e]-(truedistance[e]+rnorm(1, 0, sigma))
                                }
                #truedistance[1] - (truedistance[1]+50)

                        #determine DDOA measurements (reference sensor is 
 sensor #1 here)
                index-1
                for(e in 1:numSensors)
                {
                        if(e!=r)
                        {
                                        
 measurement[index]-(truedistance[f]-truedistance[e])
                                                index - (index+1)
                        }
                }

                        }
                                if(combos[e,f]!=1)
                                {
                                }
                }

 combos is just a matrix containing 1's and 0's

 This error keeps appearing

 Error in if (combos[e, f] == 1) { : missing value where TRUE/FALSE needed


 Any ideas?


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/TRUE-FALSE-tp2318668p2318668.html
 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 that 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 of lists ?

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 12:57 PM, Carlos Petti wrote:


Dear list,

I have to use a list of lists containing vectors.

For instance :

[[1]]
[[1]][[1]]
[1] 1 2 3

[[1]][[2]]
[1] 3 2 1

I want to attribute vectors to the main list

without use of an intermediate list,

but it does not work :

More specifically it produces an error that has information in it.
 x[[1]][[1]] - c(1, 2, 3)
Error in `*tmp*`[[1]] : subscript out of bounds



x - list()
x[[1]][[1]] - c(1, 2, 3)
x[[1]][[2]] - c(3, 2, 1)


So thinking perhaps we just needed another level of subscripting  
available I tried:


 x - list(list())
 x[[1]][[1]] - c(1, 2, 3)
 x[[1]][[2]] - c(3, 2, 1)
 x
[[1]]
[[1]][[1]]
[1] 1 2 3

[[1]][[2]]
[1] 3 2 1

Success. Moral: Read the error messages for meaning or at least clues.  
(Further testing showed that almost anything inside the original  
list() call, even NULL,  would have created enough structure for the  
interpreter to work with.






David Winsemius, MD
West Hartford, CT

__
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 of lists ?

2010-08-09 Thread jim holtman
Is this what you want:

 x - list()
 x[[1]] - list(1:3)
 x[[2]] - list(3:1)
 x
[[1]]
[[1]][[1]]
[1] 1 2 3


[[2]]
[[2]][[1]]
[1] 3 2 1



On Mon, Aug 9, 2010 at 12:57 PM, Carlos Petti carlos.pe...@gmail.com wrote:
 Dear list,

 I have to use a list of lists containing vectors.

 For instance :

 [[1]]
 [[1]][[1]]
 [1] 1 2 3

 [[1]][[2]]
 [1] 3 2 1

 I want to attribute vectors to the main list

 without use of an intermediate list,

 but it does not work :

 x - list()
 x[[1]][[1]] - c(1, 2, 3)
 x[[1]][[2]] - c(3, 2, 1)

 Thanks in advance,
 Carlos

 __
 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 that 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] package names in Latex

2010-08-09 Thread Arnaud Le Rouzic



When putting R package names in Latex, do we use \it or \em, please?


As far as I know, the only difference between \it and \em is that \em 
words are unitalicized in an italics portion of the text, which is 
desirable in most cases.


However, I am not sure that italics is the most common solution, perhaps 
because it is really important for a package name to be very easy to 
read and spell even if the name is a meaningless sequence of letters, 
which is not always the case in italics. In some R manuals (such as the 
Short Introduction to R), package names are boldfaced. Personally, I 
tend to type them in TT font, as if they were function names. I guess 
all solutions are OK if they are used consistently throughout the document.


Arnaud.

__
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] optimization subject to constraints

2010-08-09 Thread Spencer Graves
   To find every help page containing the term constrained 
optimization, you can try the following:



library(sos)
co - findFn('constrained optimization')


  Printing this co object opens a table in a web browser with 
all matches sorted first by the package with the most matches and with 
hot links to the documentation page.



writeFindFn2xls(co)


  This writes an excel file, with the browser table as the second 
tab and the first being a summary of the packages.  This summary table 
can be made more complete and useful using the installPackages 
function, as noted in the sos vignette.



  A shameless plug from the lead author of the  sos package.
  Spencer Graves


On 8/9/2010 10:01 AM, Ravi Varadhan wrote:

constrOptim can only handle linear inequality constraints.  It cannot handle
equality (linear or nonlinear) as well as nonlinear inequality constraints.

Ravi.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Dwayne Blind
Sent: Monday, August 09, 2010 12:56 PM
To: Gildas Mazo
Cc: r-help@r-project.org
Subject: Re: [R] optimization subject to constraints

Hi !

Why not constrOptim ?

Dwayne

2010/8/9 Gildas Mazogildas.m...@curie.fr


Dear R users,

I'm looking for tools to perform optimization subject to constraints,
both linear and non-linear. I don't mind which algorithm may be used, my
primary aim is to get something general and easy-to-use to study simples
examples.

Thanks for helping,

Gildas

__
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.htmlhttp://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-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.


--
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567

__
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] Changing downloaded source code into a package

2010-08-09 Thread Gabor Grothendieck
On Mon, Aug 9, 2010 at 10:22 AM, JH dealing_with_do...@hotmail.com wrote:

 I am wanting to change some lines of code in the R package named nlme
 http://cran.r-project.org/web/packages/nlme/index.html
 To do this I have downloaded the Package source named nlme_3.1-96.tar.gz,
 opened up the file and changed the text documents within the folder named R,
 specifically the cor.Struct.txt file.
 I now want to know how can I use this modified nlme_3.1-96.tar.gz file in R
 2.10. How do I convert this source code into a package?


 I have looked on the internet and tried using cmd.exe  then the code
 Rmcd.exe INSTALL -1 ~/nlme_3.1-96.tar.gz
 I end up getting the message The system can't find the specified path,
 when I have the file in the directory that Rmcd.exe is in.

Assuming you have installed Rtools and have the R bin directory and
the Rtools bin directory on your path

cd to.wherever.your.tar.gz.file.is.located
Rcmd INSTALL nlme_3.1-9.96.tar.gz

Alternately, at http://batchfiles.googlecode.com is a file Rcmd.bat
that you can call which will find Rtools and R in the registry and
then run Rcmd.exe so you don't have to add anything to your path.  In
that case you just place Rcmd.bat somewhere on your existing path and
don't have to change your path at all.

__
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] Pie Chart in map

2010-08-09 Thread jim holtman
Check out the gallery of R chart; here is one to look at:

http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=143


On Mon, Aug 9, 2010 at 1:04 PM, LCOG1 jr...@lcog.org wrote:

 Hey R'rs,
    So im sick of dealing with ESRI products and am looking to stream line a
 process i now use GIS to do using R.  I have made a lot of maps using R but
 have not yet seen a map that puts pie charts within the map to help
 represent data like the attachment.
 http://r.789695.n4.nabble.com/file/n2318816/template1.bmp

 I found Tanimura et al. work Proportional Symbol Mapping in R, but after a
 discussion with one of the authors i have learned that the function is out
 of date and would require a great deal of reworking.  I also found hexbinpie
 on the R graphics gallery that i could incorporate.

 Before i go through the process of rewriting or out right creation of a
 process to replicate my GIS results i was hoping to make sure there wasnt
 something out there i could use to start or use altogether.  Or perhaps a
 set of functions that already exists that i havent thought to use.

 Thanks for the insights everyone.

 JR
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Pie-Chart-in-map-tp2318816p2318816.html
 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 that 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] coef(summary) and plyr

2010-08-09 Thread David Winsemius


On Aug 9, 2010, at 12:47 PM, Hadley Wickham wrote:

There is one further improvement to consider. When I tried using  
dlply to
tackle a problem on which I had been bashing my head for the last  
three days
and it gave just the results I had been looking for, I also noticed  
that the

dlply function returns the grouping variable levels in an attribute,
split_labels, which could be unlisted to use as an argument to  
the rep()

call I suggested earlier:

dfdl$group=rep(unlist(attr(dl, split_labels)), each=4)

That might make the results more self-documenting in situations  
where the

grouping levels were more involved than 0:2.


That's exactly what dlply does - so you should never have to do that  
yourself.


I'm unclear what you are saying. Are you saying that the plyr function  
_should_ have examined the objects in that list and determined that  
there were 4 rows and properly labeled the rows to indicate which list  
they came from?





Hadley

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/


David Winsemius, MD
West Hartford, CT

__
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] coef(summary) and plyr

2010-08-09 Thread Hadley Wickham
 That's exactly what dlply does - so you should never have to do that
 yourself.

 I'm unclear what you are saying. Are you saying that the plyr function
 _should_ have examined the objects in that list and determined that there
 were 4 rows and properly labeled the rows to indicate which list they came
 from?

Yes, exactly.  It's the output from coef(summary(x)) that makes it
look like this isn't happening.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
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.


Re: [R] Changing downloaded source code into a package

2010-08-09 Thread Matt Shotwell
See comments below.

On Mon, 2010-08-09 at 10:22 -0400, JH wrote:
 I am wanting to change some lines of code in the R package named nlme
 http://cran.r-project.org/web/packages/nlme/index.html
 To do this I have downloaded the Package source named nlme_3.1-96.tar.gz,
 opened up the file and changed the text documents within the folder named R,
 specifically the cor.Struct.txt file.

I couldn't find this file. Do you mean corStruct.R, or maybe
corStruct.c?

 I now want to know how can I use this modified nlme_3.1-96.tar.gz file in R
 2.10. How do I convert this source code into a package?

The source code, along with the documentation, data files, etc. _is_ the
package. When the package contains source code from a compiled language
(C or Fortran), as nlme does, this code must be compiled for your
platform before the package is installed. The CRAN maintainers kindly
pre-compile this code for Windows and Mac OS X users. If you make
modifications to C or Fortran code in a package, you must re-compile the
code yourself, or use a service such as R-Forge.

The R manual `Writing R Extensions` is the standard reference for
packages. See also the `R Administration and Installation' manual. See
the information here

http://www.murdoch-sutherland.com/Rtools/

for compiling package code in Windows. Lastly, before you follow the
instructions at the URL above, I urge you to consider GNU Linux as a
platform for programming. I've found the tools available in standard GNU
Linux distributions (such as that available at http://www.debian.org)
much simpler to install and work with.

 
 
 I have looked on the internet and tried using cmd.exe  then the code 
 Rmcd.exe INSTALL -1 ~/nlme_3.1-96.tar.gz 
 I end up getting the message The system can't find the specified path,
 when I have the file in the directory that Rmcd.exe is in.
 
 

-- 
Matthew S. Shotwell
Graduate Student 
Division of Biostatistics and Epidemiology
Medical University of South Carolina

__
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] plot the dependent variable against one of the predictors with other predictors as constant

2010-08-09 Thread Greg Snow
Look at the TkPredict and Predict.Plot functions in the TeachingDemos package 
as a couple of options.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Yi
 Sent: Saturday, August 07, 2010 3:13 PM
 To: R (r-help@R-project.org)
 Subject: [R] plot the dependent variable against one of the predictors
 with other predictors as constant
 
 Hi, folks,
 
 Happy work in weekends _
 
 My question is how to plot the dependent variable against one of the
 predictors with other predictors as constant. Not for the original
 data, but
 after prediction. It means y is the predicted value of the dependent
 variables. The constane value of the other predictors may be the
 average or
 some fixed value.
 
 ###
 y=1:10
 x=10:1
 z=2:11
 lin_model=lm(z~x+y)
 x_new=11:2
 ###
 
 
 How to plot predicted value of z from the regression model with x takes
 x_new and y as a constant (let's say y=1)
 
 
 I am thinking about using 'predict' command to generate the prediction
 of z
 with the new data.frame but there should be a better way.
 
 Thanks all.
 
 Yi
 
   [[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] Logistic Regression in R (SAS -like output)

2010-08-09 Thread Frank Harrell


Note that stepwise variale selection based on AIC has all the problems 
of stepwise variable selection based on P-values.  AIC is just a 
restatement of the P-Value.


Frank

Frank E Harrell Jr   Professor and ChairmanSchool of Medicine
 Department of Biostatistics   Vanderbilt University

On Mon, 9 Aug 2010, Gabor Grothendieck wrote:


On Mon, Aug 9, 2010 at 6:43 AM, Harsh singhal...@gmail.com wrote:

Hello useRs,

I have a problem at hand which I'd think is fairly common amongst
groups were R is being adopted for Analytics in place of SAS.
Users would like to obtain results for logistic regression in R that
they have become accustomed to in SAS.

Towards this end, I was able to propose the Design package in R which
contains many functions to extract the various metrics that SAS
reports.

If you have suggestions pertaining to other packages, or sample code
that replicates some of the SAS outputs for logistic regression, I
would be glad to hear of them.

Some of the requirements are:
- Stepwise variable selection for logistic regression
- Choose base level for factor variables
- The Hosmer-Lemeshow statistic
- concordant and discordant
- Tau C statistic



For stepwise logistic regression using AIC see:

library(MASS)
?stepAIC

For specifying reference level:

?relevel

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


  1   2   >