[R] Separate colour for comments in scripts

2007-09-24 Thread Sumit.Gupta
Hi,

Is it possible to assign a separate colour for comments written with #,
eg:-

#this is a comment

. I am looking to colour them differently from the program text in
R-Editor (not console). Is it possible to do so?

Eg. In Visual basic, the colour for remarks gets green automatically

Regards
Sumit


[[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] really dumb question | loop counters in

2007-09-24 Thread Petr PIKAL
Hi


 Paul Hiemstra wrote:
  Hi,
 
  This works:
 
  for(i in seq(1,100,5)) {
  print(i)
  }
 
  Very similar to the way python does this kind of loop.
 
 
 Indeed it is - thanks for the tip. I'm still puzzled why I can't find a 
 single piece of the standard [R] language documentation that shows this. 

 In contrast, every single other language I use (more than I care to 
 admit), and documentation for same, feature this prominently when they 
 talk about looping.

Maybe that is because looping is not a core feature of R language. Many 
things for which you has to use loops in other languages can be solved in 
R by its functions operating instantly on whole objects (vectors, matices, 
data.frames, lists).

Besides from for help page

seq
An expression evaluating to a vector 
^ 
And you cen directly inspect to what your construction evaluates by using 
them

1:5:100
(0,1,0.1)

So you shall/can put any sequence/vector into a for cycle 

for(var in seq) expr

seq = 1:50
seq = seq(1,100,5)
seq = sample(whatever apropriate vector)
seq = vector of file names
seq = vector of object names

etc.

Regards
Petr

 
 Ah well.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] assign one 'id' one colour for xyplot

2007-09-24 Thread ctlai


 is there a way to assign one 'id' (subject) to one colour for xyplot to
keep the co-ordination for different xyplots?  also how to increase the
number of colour for a xyplot that has more than 7 'id' (subjuects)

 I found one previous message but did not understand what he did.

 I attached a sample dataset.
http://www.nabble.com/file/p12855016/graph17sep07.csv graph17sep07.csv 

 the codes that I used were:

 p1 = xyplot(protein~day|breast, data= test)
 p2 = xyplot(lactose~day|breast, data= test)

 I want to keep the same colour line for each id in both graph

 thanks 
-- 
View this message in context: 
http://www.nabble.com/assign-one-%27id%27-one-colour-for-xyplot-tf4507453.html#a12855016
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] nls fits by groups

2007-09-24 Thread Aleksi Lehtonen
Dear Katharine,

that for loop solved all my problems, I just added subset=group==i to 
the nls statement.

thank you, Aleksi

Katharine Mullen wrote:
 It is not clear from your post what changes per-group.  If only the
 starting values change (but the data and the model structure are the
 same), then you can just store the starting values you want to use for
 each group in a list, and then index into this list in your call to nls.
 
 e.g., modifying an example in the help page for nls:
 
 x - 1:10
 y - 2*x + 3# perfect fit
 yeps - y + rnorm(length(y), sd = 0.01) # added noise
 
 startlist - list(
  list(a = 0.12345, b = 0.54321), ##group 1 start val
  list(a = 0.12, b = 0.54) ## group 2 start val.
)
 reslist - list() ## filling this with results from different start val
 for(i in 1:length(startlist)) {
  reslist[[i]]  -  nls(yeps ~ a + b*x, start = startlist[[i]],
  trace = TRUE)
 }
 
 On Sun, 23 Sep 2007, Aleksi Lehtonen wrote:
 
 Dear Colleagues,

 I am trying to estimate several non-linear models simultaneously. I don't
 want to use non-linear mixed model, but non-linear model with same form, but
 it should be estimated separately according to variable group (I have lots
 of groups that have lots of observations). I would like to have unique
 parameters for each group.

 e.g. something like this

 mod - nls(y ~ a*x^b, start=c(a=1, b=1), group=group)

 but knowing that group option does not work. If someone has an idea (or has
 done it already) how to implement this either using just nls statement or by
 building a simple function in R, I would be very grateful for hints

 regards, Aleksi Lehtonen

  [[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] What is RDA file and how to open it in R program?

2007-09-24 Thread Bjørn-Helge Mevik
Jittima Piriyapongsa wrote:

 I have a set of gene expression data in .RDA file. I have downloaded
 Bioconductor and R program for analyzing these data. Anyway, I am not sure how
 to open this RDA file in R program (what is the command?) in order to look at
 these data.

load(filename.RDA)

(.RDA (or .rda) is short for .RData (or .rdata :-).  It is the usual
file format for saving R objects to file (with save() or
save.image()).)

 And which package should I use for analyzing it e.g. plot the
 expression image?

That depends entirely on what is inside the file.  The best idea is
probably to ask the one(s) who created the file.

-- 
Bjørn-Helge Mevik

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] are hurdle logit-poisson model and posson model nested?

2007-09-24 Thread Achim Zeileis
On Sat, 15 Sep 2007, Wensui Liu wrote:

 Dear Listers,
 I have a general statistical question. Are hurdle logit-poisson model
 and posson model nested?

No, I don't think so. The logit hurdle is equivalent to a geometric hurdle 
(i.e., logit and right-censored geometric distribution imply the same 
likelihood and thus the same estimates), so a hurdle logit-geometric model 
is nested withing a geometric model.
If you want a model nested in poisson, you can use a hurdle 
poisson-poisson model, i.e., a right-censored poisson for the zero hurdle 
and a left-truncated poisson for the counts. A test for presence of the 
hurdle is then a test that all parameters are equal. The hurdle() function 
in pscl can fit these models and hurdletest() can test for the presence 
of the hurdle (given that the same distribution has been used for the zero 
hurdle and the counts).

Best,
Z

 Thank you so much?

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Data manipulations with numbers which are in 'comma' format

2007-09-24 Thread Shubha Vishwanath Karanth
Hi R,

 

May be a trivial question, but struggling to find a solution...

 

v=data.frame(a=c(1,234,2,345,5,567))

 v

a

11,234

22,345

35,567

 

I need a column 'b', which is just the addition of column 'a' with 5.
How do I do it? And, entries in column 'a' are with commas, always.
Also, class(v$a)=factor.

 

BR, Shubha


[[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] Proposal: Archive UseR conference presentations at www.r-project.org/useR-yyyy

2007-09-24 Thread Friedrich Leisch

[ Sorry to join in late, as Uwe already wrote I was offline in the
Austrian Alps. ]

 On Tue, 18 Sep 2007 10:56:03 -0500,
 Douglas Bates (DB) wrote:

   On 9/18/07, hadley wickham [EMAIL PROTECTED] wrote:
   On 9/18/07, Uwe Ligges [EMAIL PROTECTED] wrote:
Earl F. Glynn wrote:
 hadley wickham [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Many of the presentations and posters from UseR! 2007 are now 
available
 online:
 http://user2007.org/program/

 The UseR 2006 conference info and presentations are part of
 www.r-project.org, namely http://www.r-project.org/useR-2006/

 I noticed the user2007.org  domain expires on 16 December 2007, which 
would
 need to be renewed each year to continue to make these presentations
 available online. During the year of a conference it makes sense to 
have a
 separate domain, but would it make sense to archive old UseR 
conferences at
 www.r-project.org/useR-?  Would it make sense to standardize this 
so one
 could generalize and find the presentations for any year?

 Next years' domain name is 
http://www.statistik.uni-dortmund.de/useR-2008/
 but could be www.r-project.org/useR-2008 .  An automatic redirection 
link
 could be used so that www.r-project.org/useR-2008 is redirected to
 http://www.statistik.uni-dortmund.de/useR-2008/  for now, but once the
 conference is over the archive could be moved to www.r-project.org.  
Any
 comments?


The above redirection has already been in place for some time now,
i.e.,

http://www.r-project.org/useR-2008  

works for me and redirects to Dortmund.


   
   
I'm fine with the proposal to move abstract or presentation to
www.r-project.org after the useR-2008. Having it local is much easier
during the organization periods. I know this is one of the topics some
useR organizers are currently discussing in the Austrian mountains
(where I should be as well given I've had some more time these days).
   
   It would be even more useful to use subdomains like
   user2007.r-project.org so that we could host the content at a site
   other than on the R server (this would make it much easier for me, as
   I won't need to change the site at all to work on the r-project
   server).  I'm happy to advise on how to do this, if you (Fritz?) have
   access to your DNS records.

   The nameservers for the R-project.org domain are located here at the
   University of Wisconsin.  I can request a CNAME of
   user2007.R-project.org be added if you tell me (off-list) the IP
   address and ANAME of the machine to which it should point.


I think I like Hadley's proposal of collecting conference webpages
(after the conference is over) to one of our servers
better. Redirecting to pages at different locations is dangerous when
people move on to new positions.

E.g., I currently have the problem that since both Kurt and myself
are no longer at TU Wien, we cannot guarantee how long
www.ci.tuwien.ac.at will be up and running, and we were talking last
week about moving the old DSC webpages to the server at WU running
www.R-project.org.

So it would make a lot of sense to me to collect old conference pages
to a central location under the www.R-project.org umbrella. During the
active phase of a conference it is certainly better to have them on
a server under control of the local organizing committee.

Just my 2c,
Fritz

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] fontsize in mosaic plot lables

2007-09-24 Thread David Meyer
Herry,

mosaic() by default uses the labeling_border() workhorse, which gives
you the choice of modifying either gp_labels or gp_varnames. So just
replacing gp_text by gp_labels shoud do the trick.

Best
David

--


Hi List,

I am trying unsucessfully to modify the fontsize of lables in mosaic:


require(vcd)
mosaic(Titanic, pop=FALSE,
labeling_args=list(rot_labels=c(bottom=90,top=90),
   set_varnames = c(Sex = Gender),
   gp_text=gpar(fontsize=20))) #can't get it to resize text

tab - ifelse(Titanic  6, NA, Titanic)
# it works for labeling_cells
labeling_cells(text = tab, margin =
0,gp_text=gpar(fontsize=20))(Titanic)

What am I doing wrong?

Thanx
Herry




-- 
Dr. David Meyer
Department of Information Systems and Operations

Vienna University of Economics and Business Administration
Augasse 2-6, A-1090 Wien, Austria, Europe
Tel: +43-1-313 36 4393
Fax: +43-1-313 36 90 4393
HP:  http://wi.wu-wien.ac.at/~meyer/

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


[R] Odp: Data manipulations with numbers which are in 'comma' format

2007-09-24 Thread Petr PIKAL
Hi


 Hi R,
 
 
 
 May be a trivial question, but struggling to find a solution...
 
 
 
 v=data.frame(a=c(1,234,2,345,5,567))
 
  v
 
 a
 
 11,234
 
 22,345
 
 35,567
 
 
 
 I need a column 'b', which is just the addition of column 'a' with 5.
 How do I do it? And, entries in column 'a' are with commas, always.
 Also, class(v$a)=factor.

something like

 v$b - as.numeric(gsub(,,  ., v$a)) + 5
 v
  a  b
1 1,234  6.234
2 2,345  7.345
3 5,567 10.567

Regards

Petr

 
 
 
 BR, Shubha
 
 
[[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] Data manipulations with numbers which are in 'comma' format

2007-09-24 Thread Julien Barnier
Hi,

 I need a column 'b', which is just the addition of column 'a' with 5.
 How do I do it? And, entries in column 'a' are with commas, always.
 Also, class(v$a)=factor.

You must convert your factor with commas into a numeric variable,
first replacing commas with dots.

A very dirty way to do it could be the following, but there may be a
better one :

v$a - as.numeric(gsub(,,.,as.character(v$a)))

HTH,

Julien

-- 
Julien Barnier
Groupe de recherche sur la socialisation
ENS-LSH - Lyon, France

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] weighting question

2007-09-24 Thread eugen pircalabelu
Hi R-users,
 
Can anyone tell me where can i find info about they way how post stratification 
weights are calculated when i have an already stratified survey design, 
especially in Survey Package (but any theoretical material would do me just 
fine) ?  
 
Thank you  and have a nice day! 

   
-

[[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] Network Construction in R

2007-09-24 Thread Gabor Csardi
Johannes,

with the igraph package, this would be something like

library(igraph)
g - graph.data.frame( data.frame(from=data$acra, 
   to=data$acrb, weight=data$expab))

Gabor

On Sun, Sep 23, 2007 at 11:39:40AM -0400, Johannes Urpelainen wrote:
 Hi,
 
 I am trying to construct a social network from a data frame with rows
 
 acra numa acrb numb yearexpab eaboimpab iabo
 10   USA2  CAN   20 1957 4017.000  0.0 3187.000  0.0
 91   USA2  CUB   40 1957  628.000  0.0  526.000  0.0
 144  USA2  HAI   41 1957   25.000  0.0   20.000  0.0
 
 and so on.
 
 I want the network to have directed edges from node acra to node acrb 
 weighted by expab. What is the most convenient way to construct this 
 network object?
 
 Thank you very much!
 
 Best,
 
 -- 
 Johannes Urpelainen
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Performance problems to fill up a dataframe

2007-09-24 Thread Florian Jansen
Dear Listmembers,

I'm trying to fill up a dataframe depending on an arbitrary list of 
references:

Here is my code, which works:

dat - data.frame(c(60001,60001,60050,60050,60050),c(27,129,618,27,1579))
LR - sort(unique(dat[,1]))
LC - sort(unique(dat[,2]))
m - as.data.frame(matrix(data=NA, nrow=length(LR), ncol=length(LC), 
dimnames=list(LR,LC)))

for(i in 1:nrow(dat)){
  m[as.character(dat[i,1]), as.character(dat[i,2])] - 1
  }
m[is.na(m)] - 0

Now I'm trying to prevent the loop, because it take ages for a list of 
2 entries, but I run out of ideas.
Should I inflate my list beforehand and how? Can I adress the dataframe 
fields more effieciently?

Thanks for your help.


-- 
Dr. Florian Jansen
Geobotany  Nature Conservation
Institute of Botany and Landscape Ecology
Ernst-Moritz-Arndt-University
Grimmer Str. 88
17487 Greifswald
Germany
+49 (0)3834 86 4147

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Sweave and ggplot2

2007-09-24 Thread Julien Barnier
Hi,

I am trying to use ggplot2 graphics with Sweave, but I got problems
with transparency support when generating pdf figures, even if I
specify a «pdf.version» argument in Sweave options.


More precisely, forcing the pdf version by creating the file manually
works :

fig=FALSE,results=HIDE=
pdf(version=1.4,file=foo.pdf)
ggplot(d,aes(y=t,x=u)) + geom_point(colour=alpha('black', 0.05))
dev.off()
@ 
\includegraphics{foo.pdf}


Using the pdf.version argument without using ggplot works, too :

\SweaveOpts{echo=FALSE,pdf.version=1.4}
fig=TRUE=
plot(t,u,col=rgb(0,0,0,0.1))
@ 


But the following doesn't work (and this is what I would like to do) :

\SweaveOpts{echo=FALSE,pdf.version=1.4}
fig=TRUE=
ggplot(d,aes(y=t,x=u)) + geom_point(colour=alpha('black', 0.05))
@ 


Does anyone have an idea about this ?

Thanks in advance,

Julien

-- 
Julien Barnier
Groupe de recherche sur la socialisation
ENS-LSH - Lyon, France

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] a bug when subtracting vectors?

2007-09-24 Thread Samuel Kemp
Hi,

I am calling in some data into R via the read.table function. The 'tail' of
this data reads

 tail(data)

Date   Open   HighLow  Close  Volume
3728 Fri 14-Sep-07 114.19 114.46 113.93 114.08 1117992
3729 Mon 17-Sep-07   113.99 114.37 113.91 114.27  899671
3730 Tue 18-Sep-07114.30 114.32 113.47 113.85 1346282
3731 Wed 19-Sep-07   113.71 113.71 113.00 113.16 1499423
3732 Thu 20-Sep-07112.98 113.24 112.28 112.30 1376946
3733 Fri 21-Sep-07  112.41 112.64 112.24 112.47 1052431

The data is saved in a CSV file, which according to Notepad looks like

Fri 14-Sep-07,114.19,114.46,113.93,114.08,1117992
Mon 17-Sep-07,113.99,114.37,113.91,114.27,899671
Tue 18-Sep-07,114.3,114.32,113.47,113.85,1346282
Wed 19-Sep-07,113.71,113.71,113,113.16,1499423
Thu 20-Sep-07,112.98,113.24,112.28,112.3,1376946
Fri 21-Sep-07,112.41,112.64,112.24,112.47,1052431

i.e. all the data is saved to 2 decimal places. To calculate the net change
of the 'Close' variable in the last row I would use

 data[3733,5]-data[3732,5]
[1] 0.17

which is correct. However, when I use the following code to calculate the
net change over all observations i get the following result

 n - length(data[,1])
 temp - data[2:n,5]-data[1:(n-1),5]
 tail(temp)

0.032
0.188
-0.422
-0.688
-0.86
0.172

When subtracting,  all numbers should be to 2 decimal places. Why is R
calculating it to 15 decimal places -- the output is essentially wrong
112.47-112.30=0.17 NOT 0.172. I suspect I am encoding this
incorrectly?

Any help would be gratefully appreciated.

Kind regards,

Sam

[[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] a bug when subtracting vectors?

2007-09-24 Thread Raymond Wan

Samuel Kemp wrote:
 When subtracting,  all numbers should be to 2 decimal places. Why is R
 calculating it to 15 decimal places -- the output is essentially wrong
 112.47-112.30=0.17 NOT 0.172. I suspect I am encoding this
 incorrectly?
   


Well, two comments...one is not computer related.  If you are 
subtracting two numbers which have two digits after the decimal (i.e., 
two significant figures), you shouldn't be accepting a result of more 
than two digits.  So, the only thing wrong that you're doing is just 
that you're not formatting the output properly by cutting the remaining 
numbers.

As for the second comment, computers cannot represent decimal numbers 
exactly and problems like this occurs very often.  In the above example, 
one of your numbers can be represented exactly as 112.47 or 112.30.  
That's just something everyone has to be aware of when using computers 
to do math.  This, in my opinion, is an excellent paper on the 
problem...it is quite technical, but at least worth a skim:

http://docs.sun.com/source/806-3568/ncg_goldberg.html

I found this sentence near the beginning of the article to be perfect:  
Squeezing infinitely many real numbers into a finite number of bits 
requires an approximate representation.

I presume there's an FAQ for R on this...not sure where it is, though.  
But, I hope this helps!

Ray

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Calculate difference between dates in years

2007-09-24 Thread Alberto Monteiro
Daniel Brewer wrote:
 
 I would like to be able to calculate the age of someone at a particular
 date.  Both dates are date objects.  Here is what I have come up with:
 
 floor(as.numeric(sampleInfo$Date.of.DIAGNOSIS-
 sampleInfo$Date.of.birth)/365.25)
 
 Is this the best approach?

No - leap years and such. You know that there are _not_
365.25 days in one year, don't you?

floor(as.numeric(as.Date(2100-02-28) - as.Date(1900-02-28))/365.25)
# 199, should be 200

A less extreme counter-example:

floor(as.numeric(as.Date(2008-02-28) - as.Date(2007-02-28))/365.25)
# 0, should be 1

Alberto Monteiro (purely destructive - sorry)

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


[R] R Courses in Munich

2007-09-24 Thread Friedrich Leisch

Torsten Hothorn and myself will present a series of (independent)
2-day R Courses in Munich in the forthcoming semester. The courses
will be held in German language (and I apologize to the rest for the
noise on the mailing list).

The topics are

November  8- 9: Introduction to R

December 13-14: R Programming

January  24-25: Machine Learning

see

http://www.statistik.lmu.de/R/

for details and registration.

With best regards,
Fritz Leisch

-- 
---
Prof. Dr. Friedrich Leisch 

Institut für Statistik  Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München http://www.stat.uni-muenchen.de/~leisch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Separate colour for comments in scripts

2007-09-24 Thread Steve Powell
Dear Sumit
Tinn-R is a little text editor which can do all that and more:
http://www.sciviews.org/Tinn-R/ 
Best wishes 
Steve Powell

 
proMENTE social research 
research | evaluation | training  consulting 
Kranjčevićeva 35, 71000 Sarajevo 
mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866
skype: stevepowell99 
www.promente.org  |  www.mojakarijera.com  |  www.psih.org  

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: 24 September 2007 08:49
To: r-help@r-project.org
Subject: [R] Separate colour for comments in scripts

Hi,

Is it possible to assign a separate colour for comments written with #,
eg:-

#this is a comment

. I am looking to colour them differently from the program text in R-Editor
(not console). Is it possible to do so?

Eg. In Visual basic, the colour for remarks gets green automatically

Regards
Sumit


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

No virus found in this incoming message.
Checked by AVG Free Edition. 

23.09.2007
13:53



Checked by AVG Free Edition. 

23.09.2007
13:53

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Calculate difference between dates in years

2007-09-24 Thread Prof Brian Ripley
On Mon, 24 Sep 2007, Alberto Monteiro wrote:

 Daniel Brewer wrote:

 I would like to be able to calculate the age of someone at a particular
 date.  Both dates are date objects.  Here is what I have come up with:

 floor(as.numeric(sampleInfo$Date.of.DIAGNOSIS-
 sampleInfo$Date.of.birth)/365.25)

 Is this the best approach?

 No - leap years and such. You know that there are _not_
 365.25 days in one year, don't you?

 floor(as.numeric(as.Date(2100-02-28) - as.Date(1900-02-28))/365.25)
 # 199, should be 200

 A less extreme counter-example:

 floor(as.numeric(as.Date(2008-02-28) - as.Date(2007-02-28))/365.25)
 # 0, should be 1

 Alberto Monteiro (purely destructive - sorry)

You need to convert to broken-down time.  Something like

age_years - function(from, to)
{
 lt - as.POSIXlt(c(from, to))
 age - lt$year[2] - lt$year[1]
 mons - lt$mon + lt$mday/50
 if(mons[2]  mons[1]) age - age -1
 age
}

will be fine if used with valid dates (and you could extend it to work 
with date-times).

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

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


[R] Position Openings at the U.S. Food and Drug Administration

2007-09-24 Thread Soukup, Mat
The Office of Biostatistics in the Office of Translational Sciences,
Center for Drug Evaluation and Research, FDA, invites applications from
statisticians with a background in biomedical, biological, or
pharmacological sciences and strong skills in statistical methodology
and communication.

The formal job announcement is available at www.usajobs.gov - enter
FDA-09-07-109 in the search box. This announcement contains details
about the position, qualifications, and information about applying. If
you have any other questions, I would be happy to assist in anyway.

Thanks,

-Mat

***
Mat Soukup, Ph.D.
Food and Drug Administration
10903 New Hampshire Ave. 
BLDG 22 RM 5329
Silver Spring, MD 20993-0002
Email: [EMAIL PROTECTED]
***


[[alternative HTML version deleted]]

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


[R] urgent for R graphics

2007-09-24 Thread a hk
Hi, everyone,
I am green with R. Now I am working on a graphics projects.
I have a dataset:
---
 abc
1  228  83 6.69 
2  274  83 7.36 
3  320  83 8.86 
4  366  83 7.36 
5  412  83 6.81 
6  228 129 5.58

-
I want to draw a 3d graphic.
I use the code
__
 scatterplot3d(avs$a,avs$b,avs$emprical,type=h,angle=35,scale.y=0.7,pch=16,
+ y.ticklabs(0,500,by=100),y.margin.add=0.1)
_

Now I want to add a rectangle on the x,y axis, does anyone could tell me the 
code? I try a lot, but don't find.
and another question, how do I revoke the point3d function?
Thank you so much.

XiangGang


   
-
Got a little couch potato? 
Check out fun summer activities for kids.
[[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] Correlated frailty model

2007-09-24 Thread Terry Therneau

  I am trying to a estimate a correlated frailty model. My dataset is 
 made up of 4 observations. I would like to know if it is too big or 
 I have done some mistakes in the following code.

  I have used larger data sets successfully.  I need to know a little bit
more about our problem.

 coxme(Surv(yearspan)~ south+mod, data=usa,random= ~ 1|group)

  What is the dimensionality of the covariates, e.g., are they factors with 
hundreds of levels?  How many unique levels are in the group variable?
The error message is surprising, as it appears to be coming from  conversion of
a sparse matrix to dense form.  The vector of frequencies for group might also
be useful.

Terry Therneau

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] fPortfolio Package

2007-09-24 Thread livia

Hello,

I am very interested in Portfolio Optimization functions in this package.
For the cmlPortfolio, I thought it would be a set of the portfolio along
the Capital Market Line, but it turns out that there is only one
portfolio. I was wondering which portfolio should this be?

Besides, is there any function that can employ a utility function to select
a portfolio?

Could anyone give me some advice? Many thanks
-- 
View this message in context: 
http://www.nabble.com/fPortfolio-Package-tf4509189.html#a12859913
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] Separate colour for comments in scripts

2007-09-24 Thread mel
[EMAIL PROTECTED] a écrit :

 Is it possible to assign a separate colour for comments written with #,

http://www.crimsoneditor.com/
I find it very practical.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] What is RDA file and how to open it in R program?

2007-09-24 Thread Vladimir Eremeev

attach(file.RDA) # attaching the file to R, all its variables become
'visible'
# it should be on the 2nd position of the search path.
# see ?search
ls(2) # list everything in 2nd position of the search path

You can also load() this file.
In this case all data from this file will be loaded to the global
environment and mixed with those already existing in it.


Jittima Piriyapongsa wrote:
 
 Hi,
 
 I have a set of gene expression data in .RDA file. I have downloaded
 Bioconductor and R program for analyzing these data. Anyway, I am not sure
 how
 to open this RDA file in R program (what is the command?) in order to look
 at
 these data. And which package should I use for analyzing it e.g. plot the
 expression image?
 
 Thank you.
 Jittima
 
 

-- 
View this message in context: 
http://www.nabble.com/What-is-RDA-file-and-how-to-open-it-in-R-program--tf4506992.html#a12860411
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] calculating/plotting error ellipses

2007-09-24 Thread Jan M. Wiener
hello,
sorry for posting what may be a simple question:
i do have a matrix of coordinates (positional judgments, see below) and
now want to calculate and plot the corresponding error ellipse.
can anyone help me with the exact steps/syntax?

  xyDat
X Y
1-0.49-2.13
2 0.91 0.48
3 0.20-2.80
4-0.76-3.23
5-0.36 2.50
6 1.38 1.24
7-1.73-2.14
8-0.28-1.97
9-2.65 0.91
10-2.03 0.92
11 0.40-1.54
12-1.40 2.39

thank you very much in advance.
best jan

-- 
Dr. Jan M. Wiener
LPPA - Collège de France - CNRS
11, place Marcelin Berthelot
75005 Paris, France
-
e-mail: [EMAIL PROTECTED]
url: www.jan-wiener.net
phone: +33 (0)1 44 27 14 21

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] urgent for R graphics

2007-09-24 Thread Uwe Ligges


a hk wrote:
 Hi, everyone,
 I am green with R. Now I am working on a graphics projects.
 I have a dataset:
 ---
  abc
 1  228  83 6.69 
 2  274  83 7.36 
 3  320  83 8.86 
 4  366  83 7.36 
 5  412  83 6.81 
 6  228 129 5.58
 
 -
 I want to draw a 3d graphic.
 I use the code
 __
  scatterplot3d(avs$a,avs$b,avs$emprical,type=h,angle=35,scale.y=0.7,pch=16,
 + y.ticklabs(0,500,by=100),y.margin.add=0.1)


The code is incorrect, hence here a similar example:

library(scatterplot3d)
s3d - scatterplot3d(avs$a, avs$b, avs$c, type=h,
  angle=35, scale.y=0.7, pch=16,
  y.margin.add=0.1)

polygon(s3d$xyz.convert(x = c(250, 400, 400, 250),
 y = c(90, 90, 120, 120),
 z = c(7, 7, 7, 7)))


Uwe Ligges



 _
 
 Now I want to add a rectangle on the x,y axis, does anyone could tell me the 
 code? I try a lot, but don't find.
 and another question, how do I revoke the point3d function?
 Thank you so much.
 
 XiangGang
 
 

 -
 Got a little couch potato? 
 Check out fun summer activities for kids.
   [[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] Proposal: Archive UseR conference presentations at www.r-project.org/useR-yyyy

2007-09-24 Thread hadley wickham
 I think I like Hadley's proposal of collecting conference webpages
 (after the conference is over) to one of our servers
 better. Redirecting to pages at different locations is dangerous when
 people move on to new positions.

That wasn't my suggestion, but I can understand your desire to do
that.  Perhaps just taking a static snapshot using something like
wget, and hosting that on the R-project website would be a good
compromise.

 E.g., I currently have the problem that since both Kurt and myself
 are no longer at TU Wien, we cannot guarantee how long
 www.ci.tuwien.ac.at will be up and running, and we were talking last
 week about moving the old DSC webpages to the server at WU running
 www.R-project.org.

Yes, this is why I prefer to host all of my sites on an external host.

 So it would make a lot of sense to me to collect old conference pages
 to a central location under the www.R-project.org umbrella. During the
 active phase of a conference it is certainly better to have them on
 a server under control of the local organizing committee.

The one problem is setting up a redirect so that existing links and
google searches aren't broken.  This would need to be put in place at
least 6 months before the old website closed.

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

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


[R] 3d plot with dates on axis

2007-09-24 Thread Li, Yan (IED)
Hi all,

I'd like to make a 3D plot with dates on one of the axes. For example,

date1 - as.Date(2007-01-25) + seq(10)
y - seq(10)
z - seq(10)

I want to plot date1 on one axis, y on the other, and z as the height,
with the points connected.

Any help would be highly appreciated!

Yan


This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] making R packages and compacting an entire R set up

2007-09-24 Thread Gabor Grothendieck
See:

http://www.nabble.com/Cross-Compiling-t4473403.html

On 9/24/07, Edna Bell [EMAIL PROTECTED] wrote:
 Hi R Gurus!

 I have 2 questions, please:

 a.  I'm putting together a little baby package on SUSE Linux 10.1.  I
 want to create a zip of the package for windows.  How should I create
 that please?

 b.  I don't know if the following is possible but here it is:  I have
 R and a bunch of libraries set up very nicely.  I would like to hand
 off this setup to someone else.  Should I just copy things as they
 stand onto a CD please or is there a better way please?

 thanks in advance!
 Sincerely,
 Edna Bell

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Looking for a different approach?

2007-09-24 Thread London4Jobs
This is a text part of the message.
It is shown for the users of old-style e-mail clients

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
[[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] Plotting tree tips in a specific order! how?

2007-09-24 Thread jagl


hi to all

I'm using ape,ade4,etc packages to draw phylogenetic trees. 

Situation:

- i have a file with genetic sequences
- i can do the clustering with hclust
- i convert the clustering to trees
- the resulting trees are correct

Problem:

- the sequences in my data files have a specific order
- first sequence is from time=0, last sequence is from time=end of time
- plotting a tree doesn't respect this order (ex: if it is a vertical tree,
branch from time=0 is not at y=0 position and branch from time=1 it's not in
y=1 and so on)

Does anyone know how i can do this (even with clusters like time=1 to
time=10 drawn first, then time=11 to time. )?



-- 
View this message in context: 
http://www.nabble.com/Plotting-tree-tips-in-a-specific-order%21-how--tf4509760.html#a12861788
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] Package Survey

2007-09-24 Thread Thomas Lumley

On Sun, 23 Sep 2007, Rita Cristina Pinto Sousa wrote:
I?m using the package survey to obtain the statistics, fundamentally the 
variance estimates. Can you explain why do I obtain the same result with the 
replicate weights (as.svrepdesign function), for a stratified sample, and 
without the replicate weights? I don?t understand it?


Without as.svrepdesign() you get the Horvitz-Thompson standard error 
estimator for the total and linearization estimators for other statistics. 
For the total and the mean these agree exactly with the JKn estimator. 
For nonlinear statistics they do not agree exactly, although they are 
usually close.


-thomas





Many thanks for your attention,
Rita Sousa.

***
# Apuramentos IUTIC-E

rm(list=ls())

ano - 2006

require(survey)
options(survey.lonely.psu=remove)

setwd(C:/INE/Estat?stica-DME/IUTIC-E/)

#Read the DB
base_npc - 
read.table(paste(getwd(),/Dados/,ano,/NPC,.txt,sep=),sep=\t,dec=,,header 
= T)


base_npc[is.na(base_npc)]-0

#Universe information
univ_npc - 
read.table(paste(getwd(),/Dados/,ano,/NPC_Univ,.txt,sep=),sep=\t,dec=.,header 
= T)


names(base_npc) - tolower(names(base_npc))
names(univ_npc) - tolower(names(univ_npc))

base_npc - merge(base_npc,univ_npc,by=estr_cor)

#S? algumas vari?veis
#base_npc - 
base_npc[,c(npc,estr_cor,pond_npc,npc_univ,e_cuse,div1)]


#Survey design
desenho_npc - 
svydesign(id=~npc,strata=~estr_cor,weights=~pond_npc,fpc=~npc_univ,nest=T,data=base_npc)


#Replicate weights
desenho_npc_JK - as.svrepdesign(desenho_npc,type=JKn)

#Without replicate weigths
svyby(~e_cuse,~div1,desenho_npc,svytotal,drop.empty.groups=FALSE,vartype=c(se,var,cvpct))
#With replicate weigths
svyby(~e_cuse,~div1,desenho_npc_JK,svytotal,drop.empty.groups=FALSE,vartype=c(se,var,cvpct))
**


Citando Thomas Lumley [EMAIL PROTECTED]:


This message uses a character set that is not supported by the Internet
Service.  To view the original message content,  open the attached
message. If the text doesn't display correctly, save the attachment to
disk, and then open it using a viewer that can display the original
character set. message.txt






This message was sent using IMP, the Internet Messaging Program.



Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] weighting question

2007-09-24 Thread Thomas Lumley

On Mon, 24 Sep 2007, eugen pircalabelu wrote:

 Hi R-users,

 Can anyone tell me where can i find info about they way how post 
 stratification weights are calculated when i have an already stratified 
 survey design, especially in Survey Package (but any theoretical 
 material would do me just fine) ?

The reference listed in the help page,

 Valliant R (1993) Post-stratification and conditional variance
  estimation. JASA 88: 89-96

describes this.

-thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Network Construction in R

2007-09-24 Thread Robert Gentleman
there are several packages that can be used:
the graph, RBGL and Rgraphviz packages, provide data structures, 
algorithms, and layout/plotting tools for graphs/networks.  There are 
quite a few more specialized packages at Bioconductor (typically more 
related to biological problems). There, you can use biocViews to see 
what is available.

best wishes
   Robert

Johannes Urpelainen wrote:
 Hi,
 
 I am trying to construct a social network from a data frame with rows
 
 acra numa acrb numb yearexpab eaboimpab iabo
 10   USA2  CAN   20 1957 4017.000  0.0 3187.000  0.0
 91   USA2  CUB   40 1957  628.000  0.0  526.000  0.0
 144  USA2  HAI   41 1957   25.000  0.0   20.000  0.0
 
 and so on.
 
 I want the network to have directed edges from node acra to node acrb 
 weighted by expab. What is the most convenient way to construct this 
 network object?
 
 Thank you very much!
 
 Best,
 

-- 
Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024
206-667-7700
[EMAIL PROTECTED]

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


[R] truehist?

2007-09-24 Thread Carlos Guâno Grohmann
Hello,
After a long time, I needed the truehist function, but my system
couldn't found it. I tried to install the package MAAS, but I couldn't
found it! Something happened?

Carlos

-- 
+---+
  Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+---+
_
Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive.
--The winning entry in a What were HAL's first words contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Adding a table to a plot area

2007-09-24 Thread Adrian Dusa
Frank E Harrell Jr f.harrell at vanderbilt.edu writes:
 Judith Flores wrote:
  Is there a command to insert a table into the plot
  area other that using text?
  
  Thank you.
 
 To me the only completely satisfying approach is to use LaTeX and psfrag 
 in you want great alignment and other features.  A howto with R is at 
 http://biostat.mc.vanderbilt.edu/PsFrag .  This uses the fragmaster perl 
 script which runs LaTeX from within R to make the final graphics file 
 self-contained.

The howto is interesting and extremely useful (thank you), however there is one
line that couldn't be completed:

tab - latexTabular(x, align='rl')  # new function in Hmisc

Which version of Hmisc has (will have) this new function?
It cannot be found in the latest version (3.4-2) from CRAN...

Best wishes,
Adrian

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] truehist?

2007-09-24 Thread Hannu Kahra
Carlos,

try the MASS package. It is there.

Hannu

On 9/24/07, Carlos Guâno Grohmann [EMAIL PROTECTED] wrote:

 Hello,
 After a long time, I needed the truehist function, but my system
 couldn't found it. I tried to install the package MAAS, but I couldn't
 found it! Something happened?

 Carlos

 --
 +---+
   Carlos Henrique Grohmann - Guano
   Visiting Researcher at Kingston University London - UK
   Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
 Linux User #89721  - carlos dot grohmann at gmail dot com
 +---+
 _
 Good morning, doctors. I have taken the liberty of removing Windows
 95 from my hard drive.
 --The winning entry in a What were HAL's first words contest judged
 by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

 Can't stop the signal.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] calculating/plotting error ellipses

2007-09-24 Thread bbolker



Jan M. Wiener wrote:
 
 hello,
 sorry for posting what may be a simple question:
 i do have a matrix of coordinates (positional judgments, see below) and
 now want to calculate and plot the corresponding error ellipse.
 can anyone help me with the exact steps/syntax?
 

Something along the lines of:

m = colMeans(xyDat)  # calc. column means
v = var(xyDat) # compute var-cov matrix
library(ellipse)  # you may need install.packages(ellipse)
first
plot(ellipse(v,centre=m),type=l)   ## draw the confidence ellipse
points(m[,1],m[,2]) # add the cent(re|er) point

  Of course, I haven't actually tested this ...

  Ben Bolker


-- 
View this message in context: 
http://www.nabble.com/calculating-plotting-error-ellipses-tf4509082.html#a12864033
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] error rate for cluster analysis

2007-09-24 Thread Tom Boonen
Hi all,

I am looking for an R function or a metric that I could self code that
compare the results of a clustering exercise with a given solution
key.

An example. Let's say four elements are clustered, the number of
clustered is unknown a priori. For my guess and the solution, I have
two matrices with two columns the first colum gives the cluster id,
the second the element id:

guess - cbind(c(1,1,2,3),c(1,2,3,4));
solution - cbind(c(1,2,3,3),c(1,2,3,4));
colnames(guess) - colnames(solution) - c(cluster.id,element.id);
guess;
solution;

So here the guess is wrong in several ways. The guess claims elements
3  4 belong to distinct clusters, but in the solution we see that
they belong to the same. Also, the guess claims elements 1  2 belong
to one cluster, but in the solution we see they belong to distinct
clusters.

What I am looking for is a function or a metric that I could code up
myself, that defines a sensible distance between the guess and the
solution. There are various ways to do this, but I am just wondering
if there is some standard way of doing this in one of the cluster
analysis packages or so.

Thanks very much,
Tom

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] making R packages and compacting an entire R set up

2007-09-24 Thread michael watson (IAH-C)
For 1, start off with package.skeleton
 
Then http://www.biostat.wisc.edu/~kbroman/Rintro/Rwinpack.html



From: [EMAIL PROTECTED] on behalf of Edna Bell
Sent: Mon 24/09/2007 3:40 PM
To: [EMAIL PROTECTED]
Subject: [R] making R packages and compacting an entire R set up



Hi R Gurus!

I have 2 questions, please:

a.  I'm putting together a little baby package on SUSE Linux 10.1.  I
want to create a zip of the package for windows.  How should I create
that please?

b.  I don't know if the following is possible but here it is:  I have
R and a bunch of libraries set up very nicely.  I would like to hand
off this setup to someone else.  Should I just copy things as they
stand onto a CD please or is there a better way please?

thanks in advance!
Sincerely,
Edna Bell

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Root finding problem

2007-09-24 Thread bbolker


tuki - function(u, x, a, lambda){
  u - u+0i
  f - Re(x-(a*(u)^lambda-(1-(u))^lambda)/lambda)
  f
}

## What I want to do is to find the root, but without specifying the
## interval within which to search for it. I can do it easily in MATLAB
## with fsolve() or fzero() functions.

## BB: how do these functions pick an interval?

## I compared results of running root-finding in MATLAB and R:

## 1) I found (by hand) a suitable interval of u-values for a=5,
## lambda=0.5 and ran uniroot for x from 1 to 5:

curve(tuki(u=x,x=1,a=5,lambda=0.5),from=-1,to=1)
u1 = uniroot(tuki, c(-1,1), x=1, a=5, lambda=0.5)
abline(h=0,col=2)
abline(v=u1$root,col=2)

## The results are the same as I get in MATLAB.

## 2) nlm() does not find the correct value!!!

## BB: nlm is not solving the same problem !!!
##  it's looking for a MINIMUM, not a ROOT.

nlm(tuki, p=0.1, x=1, a=5, lambda=0.5)

## to use nlm to find a minimum:

tukisq - function(u, x, a, lambda){
  tuki(u,x,a,lambda)^2
}

n1 = nlm(tukisq, p=0.1, x=1, a=5, lambda=0.5)
abline(v=n1$estimate,col=4)

n1$estimate-u1$root
## works fine.

## 3) if I change lambda to 1.5, while keeping a=5, root finding in
## MATLAB returns the following results for x from 1 to 5:

##0.5134
##0.7330
##0.9345
##1.1289 - 0.0058i
##1.3085 - 0.0199i

curve(tuki(u=x,x=1,a=5,lambda=1.5),from=-1,to=2,ylim=c(-2,8))
curve(tuki(u=x,x=5,a=5,lambda=1.5),from=-1,to=2,add=TRUE,lty=2)
u2 = uniroot(tuki, c(-1,1), x=1, a=5, lambda=1.5)
abline(h=0,col=2)
abline(v=u2$root,col=2)
u3 = uniroot(tuki, c(-1,2), x=5, a=5, lambda=1.5)
abline(v=u3$root,col=4)

## BB: this seems to work fine.  Did you forget to extend the
##  x range to bracket the root?

## With correctly chosen interval, uniroot() finds correct values only
## for x = 1:3, not for x=4 or x=5. (Obviously, I return real value from
## tuki, but without that uniroot() does not work, returning Error in
## f(lower, ...) * f(upper, ...)  0 :  invalid comparison with complex
## values)


## BB: I haven't been through the rest of your code,
## but the approach above again seems to work fine.

n3 = nlm(tukisq, p=0.1, x=5, a=5, lambda=1.5)
abline(v=n3$estimate,col=6)

## also works fine.

-- 
View this message in context: 
http://www.nabble.com/Root-finding-problem-tf4508016.html#a12865617
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] Data manipulations with numbers which are in 'comma' format

2007-09-24 Thread Jean lobry
Dear Shubha,

  May be a trivial question, but struggling to find a solution...

  v=data.frame(a=c(1,234,2,345,5,567))

  v

 a
  11,234
  22,345
  35,567

  I need a column 'b', which is just the addition of column 'a' with 5.
  How do I do it? And, entries in column 'a' are with commas, always.
  Also, class(v$a)=factor.

if you are working (as me) in a locale where the comma is the decimal
separator, you should be awared that R is *very* good to cope with this
nightmare:

###
a - c(1,234, 2,345, 5,567)
v - read.table(textConnection(a), col.names = a, dec = ,)
v$b - v$a + 5
v
###
   a  b
1 1.234  6.234
2 2.345  7.345
3 5.567 10.567

Have a look at the dec argument in ?read.table. See also ?format.
Wonderful R, isn't it?

Best,

-- 
Jean R. Lobry([EMAIL PROTECTED])
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 27 56 fax: +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/

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


[R] how to export.RDA file to a text file?

2007-09-24 Thread Jittima Piriyapongsa
Hi,

Does anyone know how to export .RDA file (in R program) to a normal text file
(readable by any text editor)? Also, how to export an object in R program into a
text file (not .RDA file)?

Thank you.
Jittima

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] hypothesis testing

2007-09-24 Thread Leeds, Mark (IED)
This was sent to me by someone on the R-list ( I don't know her ) but I
don't have time to look at this right now so I told her I would send
it to the R-list because she said it keeps getting bounced when she
sends it.
  
#===


I am a bit confused with this. If possible do you think you can help me
with this? 
 
function(yvec,trtvec,alpha=0.05,header=) {
#
# A function to compute a two-sample t-test and confidence # interval
(equal-variance, independent samples).  yvec is # a numeric vector
containing both samples' data.  trtvec # is a vector, same length as
yvec, of treatment # identifiers for the data in yvec.  A boxplot
comparing # the treatments' data is constructed.  Output is a one-row #
data frame reporting the results of the test and # confidence interval
##
trtvec=as.factor(trtvec)
boxplot(split(yvec,trtvec))
title(header)
ybar=tapply(yvec,trtvec,mean)
varvec=tapply(yvec,trtvec,var)
nvec=table(trtvec)
error.df=nvec[1]+nvec[2]-2
pooled.var=((nvec[1]-1)*varvec[1]+(nvec[2]-1)*varvec[2])/error.df
diff12estimate=ybar[1]-ybar[2]
stderr=sqrt(pooled.var*((1/nvec[1])+(1/nvec[2])))
tratio=diff12estimate/stderr
twosidedP=2*(1-pt(abs(tratio),error.df))
tcrit=qt(1-alpha/2,error.df)
lower=diff12estimate-tcrit*stderr
upper=diff12estimate+tcrit*stderr
calpha=1-alpha
out=data.frame(diff12estimate,stderr,tratio,twosidedP,lower,upper,alpha)
names(out)=c(Estimator,SE,T,P-value,Lower CI,Upper
CI,Confidence)
out
}
 
I need to alter the above function twosamp so that its output includes
the decision made by the hypothesis test. For any alpha level, the
function should say ' Reject Null' or 'Fail to Reject Null' where it is
necessary. 

Use a new 3-level input factor alternative so that the function
twosamp(above) can compute both two-sided and one-sided p-values and
make the two-sided test the default and output information about which
alternative was tested. Therefore ifelse should work here right.

Use the following code 

Var.test(yvec~as.factor(trtvec))$p.valuealpha. 
If the variances are not equal then use
Sqrt((varvec[1]/nvec[1])+(varvec[2]/nvec[2])) Ifelse should be used to
allow for either standard error formula, depending on whether the
equal-variances assumption is valid or not.

 

How can I change the output from a data frame to a list?


This is not an offer (or solicitation of an offer) to buy/sell the
securities/instruments mentioned or an official confirmation.  Morgan
Stanley may deal as principal in or own or act as market maker for
securities/instruments mentioned or may advise the issuers.  This is not
research and is not from MS Research but it may refer to a research
analyst/research report.  Unless indicated, these views are the author's
and may differ from those of Morgan Stanley research or others in the
Firm.  We do not represent this is accurate or complete and we may not
update this.  Past performance is not indicative of future returns.  For
additional information, research reports and important disclosures,
contact me or see https://secure.ms.com/servlet/cls.  You should not use
e-mail to request, authorize or effect the purchase or sale of any
security or instrument, to send transfer instructions, or to effect any
other transactions.  We cannot guarantee that any such requests received
via e-mail will be processed in a timely manner.  This communication is
solely for the addressee(s) and may contain confidential information.
We do not waive confidentiality by mistransmission.  Contact me if you
do not wish to receive these communications.  In the UK, this
communication is directed in the UK to those persons who are market
counterparties or intermediate customers (as defined in the UK Financial
Services Authority's rules).


This is not an offer (or solicitation of an offer) to buy/sell the 
securities/instruments mentioned or an official confirmation.  Morgan Stanley 
may deal as principal in or own or act as market maker for 
securities/instruments mentioned or may advise the issuers.  This is not 
research and is not from MS Research but it may refer to a research 
analyst/research report.  Unless indicated, these views are the author's and 
may differ from those of Morgan Stanley research or others in the Firm.  We do 
not represent this is accurate or complete and we may not update this.  Past 
performance is not indicative of future returns.  For additional information, 
research reports and important disclosures, contact me or see 
https://secure.ms.com/servlet/cls.  You should not use e-mail to request, 
authorize or effect the purchase or sale of any security or instrument, to send 
transfer instructions, or to effect any other transactions.  

Re: [R] Sweave and ggplot2

2007-09-24 Thread Jean lobry
Dear Julien,

  Hi,

  I am trying to use ggplot2 graphics with Sweave, but I got problems
  with transparency support when generating pdf figures, even if I
  specify a ?pdf.version? argument in Sweave options.

[...snip...]

I wanted to help because I'm interested by the exploitation
of the alpha channel in Sweave documents too...

However,

i) Despite its annoncment in fortune(mind_read), the mind_read()
function is apparently not to be released in R 2.6.0, so that if
you could just follow the posting guide and give a reproducible
example...

ii) Give the output of your sessionInfo(). You can use something
like that in your *.rnw file:

sessionInfo, results=tex, echo=F=
toLatex(sessionInfo())
@

iii) What do you mean exactly by doesn't work? Put the source and
the output somewhere on the web so that we can see both.

Sincerely,
-- 
Jean R. Lobry([EMAIL PROTECTED])
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 27 56 fax: +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 plot with dates on axis

2007-09-24 Thread Duncan Murdoch
On 9/24/2007 10:48 AM, Li, Yan (IED) wrote:
 Hi all,
 
 I'd like to make a 3D plot with dates on one of the axes. For example,
 
 date1 - as.Date(2007-01-25) + seq(10)
 y - seq(10)
 z - seq(10)
 
 I want to plot date1 on one axis, y on the other, and z as the height,
 with the points connected.
 
 Any help would be highly appreciated!

library(rgl)
plot3d(date1,y,z, type='l',axes=F)
xlabs - date1[c(2,5,8)] # or some other way to get pretty dates
axes3d(xat=xlabs, xlab=as.character(xlabs))

Duncan Murdoch

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


Re: [R] Sweave and ggplot2

2007-09-24 Thread Julien Barnier
Hi,

First, thanks for your help and sorry for not following the posting
guide by not giving more detailed informations and an easily
reproducible example...

 i) Despite its annoncment in fortune(mind_read), the mind_read()
 function is apparently not to be released in R 2.6.0, so that if
 you could just follow the posting guide and give a reproducible
 example...

Well, I hope it will be ready for R 2.7.0 !

 ii) Give the output of your sessionInfo(). You can use something
 like that in your *.rnw file:

 sessionInfo, results=tex, echo=F=
 toLatex(sessionInfo())
 @

Here it is :

,
| R version 2.5.1 (2007-06-27) 
| i486-pc-linux-gnu 
| 
| locale:
| [EMAIL PROTECTED];LC_NUMERIC=C;[EMAIL PROTECTED];[EMAIL PROTECTED];
| [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];LC_NAME=C;
| LC_ADDRESS=C;LC_TELEPHONE=C;[EMAIL PROTECTED];LC_IDENTIFICATION=C
| 
| attached base packages:
| [1] grDevices utils datasets  graphics  stats methods  
| [7] base 
| 
| other attached packages:
| car 
| 1.2-1 
`

 iii) What do you mean exactly by doesn't work? Put the source and
 the output somewhere on the web so that we can see both.

Doesn't work means that the generated pdf file for the figure
generated by the chunk is empty. It is not of size 0, but it has no
content and so cannot be included when running pdflatex, which exits
with an error :

,
| !pdfTeX error: pdflatex (file ./alpha_sweave-004.pdf): PDF inclusion: 
required 
| page does not exist 0
|  == Fatal error occurred, no output PDF file produced!
`

When I try this example at work, I got an error message during Sweave
which is close from something like warning : semitransparency not
supported by this device. When I try at home (with the given
sessionInfo), I got no warning but in both the cases the result is the
same : an empty pdf file for the figure and an error during pdflatex
compilation.

I've put online an example Rnw file and the almost empty pdf produced
here :

http://dd.nozav.org/transferts/

Thanks in advance for any help.

-- 
Julien

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] fuzzy logic

2007-09-24 Thread Edna Bell
Hi R Gurus!

Is there a fuzzy logic package please?

Thanks,
Edna Bell

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] PicTeX output: how to suppress escaping of $ signs and braces?

2007-09-24 Thread Dan Hatton

Dear All,

I'm trying to draw a TeX histogram with the following pair of commands,

pictex(file = realhisto.tex)
hist(Peaklist$V3,xlab=Height $z/\\ut{mm}$,ylab=Probability density 
$\\phi{}(z-z_0)/(1/\\ut{mm})$)

However, in the resulting file realhisto.tex, I get, for example

\put {Height \$z/\ut\{mm\}\$}  [lB] 0.00pt,0.00pt at 136.13 9.17

when what I'd like is

\put {Height $z/\ut{mm}$}  [lB] 0.00pt,0.00pt at 136.13 9.17

i.e. the $ signs and braces not to be escaped with backslashes.

I've tried a couple of things that help(Quotes) hints at, like
replacing the double quotes with single quotes or backticks, or
explicitly escaping the $ signs with backslashes, but none of these
things seem to help.

Any ideas, please?

-- 

Thanks very much

Dan Hatton

http://www.bib.hatton.btinternet.co.uk/dan/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] parse in text function of plots, confusing behaviour

2007-09-24 Thread Folkes, Michael
HI all,
I'm failing to understand why the following is happening.
In this plot I rely on two text functions both using parse.  The second one 
works properly by writing a gamma symbol 5 times, the first one only works 
properly four times.  The only difference is that I add a string to the paste 
function of that which does work properly.  Why does it behave like this?
thanks so much!
Michael Folkes
 
 
plot(1,1,type='n',ylim=c(-2,2))
for(gam in seq(-1,.25,length=5)){
 #doesn't repeat gamma symbol properly
  text(.8,gam,parse(text=paste(gamma,gam,sep='')),cex=.75,adj=0)
 
# however this works if an additional string is included in the paste function
  text(1,gam,parse(text=paste(gamma,~hi,gam,sep='')),cex=.75,adj=0)
}

[[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] partial plots for logistic regression using glm

2007-09-24 Thread ucjtkst
Dear R users,

I am modelling the probability of error in a behavioural task using the 
glm() function (with the numbers of successes and failures listed for each 
line in the data frame). How can I plot the partial effects of the 
predictors?

Many thanks in advance,

Stav

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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: cannot allocate vector of size...

2007-09-24 Thread Jittima Piriyapongsa
Hi,

I want to change .RDA file to a text file. So I did as follows.

load(my.rda)
ls() --- then it showed [1] exprs
write.table(exprs,C:\\my.txt,sep=\t)

I was successful with the first .RDA file. Then I used the same commands with
another .RDA file (172 MB)which is 4 times bigger than the first file (41.2 MB).
When I put the last command (write.table), it showed as below.

Error: cannot allocate vector of size 92.8 Mb
In addition: Warning messages:
1: The exprSet class is deprecated, use ExpressionSet instead
2: The exprSet class is deprecated, use ExpressionSet instead
3: The exprSet class is deprecated, use ExpressionSet instead
4: The exprSet class is deprecated, use ExpressionSet instead

What could be a problem in this case? Is it the memory problem? I believe I have
enough RAM and disk space in my computer.

Thank you.
Jittima

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] partial plots for logistic regression using glm

2007-09-24 Thread John Fox
Dear Stav,

Take a look at the effects package on CRAN and the associated paper at
http://www.jstatsoft.org/v08/i15.

I hope this helps,
 John

On 24 Sep 2007 23:02:10 +0100
 [EMAIL PROTECTED] wrote:
 Dear R users,
 
 I am modelling the probability of error in a behavioural task using
 the 
 glm() function (with the numbers of successes and failures listed for
 each 
 line in the data frame). How can I plot the partial effects of the 
 predictors?
 
 Many thanks in advance,
 
 Stav
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] parse in text function of plots, confusing behaviour

2007-09-24 Thread Duncan Murdoch
On 24/09/2007 5:55 PM, Folkes, Michael wrote:
 HI all,
 I'm failing to understand why the following is happening.
 In this plot I rely on two text functions both using parse.  The second one 
 works properly by writing a gamma symbol 5 times, the first one only works 
 properly four times.  The only difference is that I add a string to the paste 
 function of that which does work properly.  Why does it behave like this?
 thanks so much!
 Michael Folkes
  
  
 plot(1,1,type='n',ylim=c(-2,2))
 for(gam in seq(-1,.25,length=5)){
  #doesn't repeat gamma symbol properly
   text(.8,gam,parse(text=paste(gamma,gam,sep='')),cex=.75,adj=0)
  
 # however this works if an additional string is included in the paste function
   text(1,gam,parse(text=paste(gamma,~hi,gam,sep='')),cex=.75,adj=0)
 }


Take a look at what you're trying to plot:

  for (gam in seq(-1, 0.25, length=5)) {
+   print(parse(text=paste(gamma,gam,sep='')))
+ }
expression(gamma-1)
attr(,srcfile)
text
expression(gamma-0.6875)
attr(,srcfile)
text
expression(gamma-0.375)
attr(,srcfile)
text
expression(gamma-0.0625)
attr(,srcfile)
text
expression(gamma0.25)
attr(,srcfile)
text

In the first 4 cases, it's gamma - value, while the last one is 
gammavalue.

You probably want something like the bquote example on the ?plotmath 
page, e.g.

  for (gam in seq(-1, 0.25, length=5)) {
+   text(1, gam, bquote(paste(gamma, ,.(gam
+ }

Duncan Murdoch

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


Re: [R] Error: cannot allocate vector of size...

2007-09-24 Thread Martin Morgan
Jittima Piriyapongsa [EMAIL PROTECTED] writes:

 Hi,

 I want to change .RDA file to a text file. So I did as follows.

load(my.rda)
ls() --- then it showed [1] exprs
write.table(exprs,C:\\my.txt,sep=\t)

 I was successful with the first .RDA file. Then I used the same
 commands with another .RDA file (172 MB)which is 4 times bigger than
 the first file (41.2 MB).  When I put the last command
 (write.table), it showed as below.

 Error: cannot allocate vector of size 92.8 Mb
 In addition: Warning messages:
 1: The exprSet class is deprecated, use ExpressionSet instead
 2: The exprSet class is deprecated, use ExpressionSet instead
 3: The exprSet class is deprecated, use ExpressionSet instead
 4: The exprSet class is deprecated, use ExpressionSet instead

 What could be a problem in this case? Is it the memory problem? I
 believe I have enough RAM and disk space in my computer.

R has run out of RAM to allocate memory -- it has already allocated
memory, and now cannot allocate an addition 92.8 MB.

Is write.table doing what you want? A different approach would be to
write two tables, one with the 'expression' data

 write.table(exprs(exprs), C:\\myExprs.txt, sep=\t)

the other with the description of phenotypes

 write.table(pData(exprs), C:\\myPheno.txt, sep=\t)

This might be more memory efficient, but might also get your data in a
more immediately useable format.

Martin

 Thank you.
 Jittima

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

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] parse in text function of plots, confusing behaviour

2007-09-24 Thread Folkes, Michael
Thanks Duncan for the speedy response.  I should have realized that the 
negative value was adversely affecting the expression.  I'll do some further 
reading on plotmath.
Michael



From: Duncan Murdoch [mailto:[EMAIL PROTECTED]
Sent: Mon 24/09/2007 3:32 PM
To: Folkes, Michael
Cc: [EMAIL PROTECTED]
Subject: Re: [R] parse in text function of plots, confusing behaviour



On 24/09/2007 5:55 PM, Folkes, Michael wrote:
 HI all,
 I'm failing to understand why the following is happening.
 In this plot I rely on two text functions both using parse.  The second one 
 works properly by writing a gamma symbol 5 times, the first one only works 
 properly four times.  The only difference is that I add a string to the paste 
 function of that which does work properly.  Why does it behave like this?
 thanks so much!
 Michael Folkes
 
 
 plot(1,1,type='n',ylim=c(-2,2))
 for(gam in seq(-1,.25,length=5)){
  #doesn't repeat gamma symbol properly
   text(.8,gam,parse(text=paste(gamma,gam,sep='')),cex=.75,adj=0)
 
 # however this works if an additional string is included in the paste function
   text(1,gam,parse(text=paste(gamma,~hi,gam,sep='')),cex=.75,adj=0)
 }


Take a look at what you're trying to plot:

  for (gam in seq(-1, 0.25, length=5)) {
+   print(parse(text=paste(gamma,gam,sep='')))
+ }
expression(gamma-1)
attr(,srcfile)
text
expression(gamma-0.6875)
attr(,srcfile)
text
expression(gamma-0.375)
attr(,srcfile)
text
expression(gamma-0.0625)
attr(,srcfile)
text
expression(gamma0.25)
attr(,srcfile)
text

In the first 4 cases, it's gamma - value, while the last one is
gammavalue.

You probably want something like the bquote example on the ?plotmath
page, e.g.

  for (gam in seq(-1, 0.25, length=5)) {
+   text(1, gam, bquote(paste(gamma, ,.(gam
+ }

Duncan Murdoch



[[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] GWR modeling with dummy variables

2007-09-24 Thread Steve Friedman
Hi everyone,

I'm working with a modest sized spatial database consisting of 1513 records
and 50 variables.  Fourteen of these are dummy variables delineating
regional planning councils.  I'm trying to understand how to integrate the
dummy variables in the geographically weight regression model. I'm reading
Fotheringham et.al. and see reference to using dummy variables, but I don't
see an example ilustrating the procedure.  I also don't see an example in
the spgwr.pdf files associated with the package.

If anyone has experience with this I'd certainly like to hear from you.

I'm using R-2.5.1 on a PC.

Thanks in advance.

Steve

[[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] certain number of equations in function depending on parameter

2007-09-24 Thread Moshe Olshansky
Hi Andreas,

One possible way would be to create a file containing
all your equations (which are written in a loop), then
source that file and then use uniroot.

Regards,

Moshe.

--- Andreas  Wittmann [EMAIL PROTECTED] wrote:

 Hello everybody, 
 
 i have the following problem to write a function
 which recognizes depending
 on the parameter-inputs how many equations for the
 calculation in the function
 are needed. 
 
 Here is an example of my problem:
 
 myfun - function(a, b, c, d)
 {
 k - length(a)
 #here d = 3 for example, but how can i
 dynamically controll 
 #my function and tell her to build equations eq1
 to eq5 if d = 5?
 
 eq1 - function(a, b, y)
 {
 c[k-1] - a[k-1] + b * y
 } 
 
 eq2 - function(a, b, y)
 {
 c[k-2] - a[k-2] + b * y
 } 
 
 eq3 - function(a, b, y)
 {
 c[k-3] - a[k-3] + b * y
 } 
 
 eq4 - function(a, b, z)
 {
 1 - sum(c(eq1(z), eq2(z), eq3(z), z))
 }   
 
 sol - uniroot(eq4, lower=0, upper=1)
 }
 
 I hope my problems is explained clear enough. I
 would be very happy 
 if you can give me some advice.
 
 
 best regards
 
 Andreas
 --
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Package Building help

2007-09-24 Thread Patrick Richardson
List,

 

I've used package.skeleton to build my package and am trying to check it
using R CMD check . But can't seem to get anything to work.  When I try to
enter the R CMD command into R I get this message.

 

R CMD check estpkg

Error: syntax error, unexpected SYMBOL, expecting '\n' or ';' in R CMD

 

I'm not sure if I'm using the wrong syntax or what but I can't get R CMD to
check my package from within R.  I've tried to use Rcmd in the /bin folder
of the R root directory and the DOS windows flashes on my screen and
disappears immediately.  If someone could help me get over this, I would
greatly appreciate it.

 

Cheers,

 

Patrick


[[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] Score test in logistic regression in R

2007-09-24 Thread Paek, Insu
Hello,

  I am wondering if R has any ways to conduct the score test in logistic
regression?
  Could you let me know please?

  Thanks,
  Insu  


--
This e-mail and any files transmitted with it may contain privileged or 
confidential information.
It is solely for use by the individual for whom it is intended, even if 
addressed incorrectly.
If you received this e-mail in error, please notify the sender; do not 
disclose, copy, distribute,
or take any action in reliance on the contents of this information; and delete 
it from
your system. Any other use of this e-mail is prohibited.

Thank you for your compliance.
--

[[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] Package Building help

2007-09-24 Thread Duncan Murdoch
On 24/09/2007 9:28 PM, Patrick Richardson wrote:
 List,
 
  
 
 I've used package.skeleton to build my package and am trying to check it
 using R CMD check . But can't seem to get anything to work.  When I try to
 enter the R CMD command into R I get this message.
 
  
 
 R CMD check estpkg
 
 Error: syntax error, unexpected SYMBOL, expecting '\n' or ';' in R CMD
 
  
 
 I'm not sure if I'm using the wrong syntax or what but I can't get R CMD to
 check my package from within R.  I've tried to use Rcmd in the /bin folder
 of the R root directory and the DOS windows flashes on my screen and
 disappears immediately.  If someone could help me get over this, I would
 greatly appreciate it.

You need to run this from a console (what you call the DOS window). 
Before it will work, you'll need to install a number of tools:  see 
www.murdoch-sutherland.com/Rtools to get them.

Duncan Murdoch
 
  
 
 Cheers,
 
  
 
 Patrick
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] how to export.RDA file to a text file?

2007-09-24 Thread Charles C. Berry
On Mon, 24 Sep 2007, Stephen Weigand wrote:

 On 9/24/07, Jittima Piriyapongsa [EMAIL PROTECTED] wrote:
 Hi,

 Does anyone know how to export .RDA file (in R program) to a normal text file
 (readable by any text editor)?

Is this what you mean?

load( old.RDA )
save( list=ls(), file='new.rda' , ascii = TRUE )

This is literally readable by a text editor, and you can change the 
objects in that file.

But you need to have a _deep_ understanding of the format to avoid 
breaking things. And I doubt that those who have that understanding would 
ever attempt to edit such a file with a text editor.

Please refer to the _posting guide_ and revise your question if this or 
Stephen's response did not answer your question.

Chuck

Also, how to export an object in R program into a
 text file (not .RDA file)?

 Thank you.
 Jittima

 You may be used to the idea that there are code files and data files
 and that's it. But an .RDA file is a saved version of one or more R
 objects of any kind and therefore may contain a data set (stored as a
 data.frame), a fitted regression model, AND a vector (for example).

 Maybe do:

 load(yourfile.RDA)
 ls()

 to see what you have in yourfile.RDA and then perhaps do

 help(write.table)

 to learn how to write out a matrix or data.frame as a text file if
 that's what you're trying to do.

 Hope this helps,

 Stephen

 -- 
 Rochester, Minn. USA

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


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

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


Re: [R] truehist?

2007-09-24 Thread Peter Dalgaard
Carlos Guâno Grohmann wrote:
 Hello,
 After a long time, I needed the truehist function, but my system
 couldn't found it. I tried to install the package MAAS, but I couldn't
 found it! Something happened?

 Carlos

   
It's in MASS (sic).

help.search(truehist) would have told you.


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

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


Re: [R] Cumulative Frequency table

2007-09-24 Thread jim holtman
?cumsum

 x - table(cut(AGE, b=c(0,39,49,59,69,79,89)))
 x

 (0,39] (39,49] (49,59] (59,69] (69,79] (79,89]
 24  38  41  37  26  34
 cumsum(x)
 (0,39] (39,49] (49,59] (59,69] (69,79] (79,89]
 24  62 103 140 166 200



On 9/25/07, Chung-hong Chan [EMAIL PROTECTED] wrote:
 Dear R gurus,

 I think this question is very trivial, but I search around the HELP
 file and this maillist can come up with no answer. Suppose I have a
 vector called AGE like this

  sort(AGE)
  [1] 30 34 35 37 37 38 38 38 38 39 39 40 40 42 42 43 43 43 43 43 43 44
  [23] 44 44 44 44 44 44 45 45 45 46 46 46 46 46 46 47 47 47 47 47 47 48
 .

 I can count the frequency based on some cut point using table with cut,

  table(cut(AGE, b=c(0,39,49,59,69,79,89)))

  (0,39] (39,49] (49,59] (59,69] (69,79] (79,89]
 11  46  70  45  16   1

 How can I calculate the cumulative Frequency, e.g.

 0-39 11
 40-49 57
 50-59 127
 60-69 172
 70-79 188
 80-89 189

 using R command?



 --
 CH Chan
 Research Assistant - KWH
 http://www.macgrass.com

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



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

What is the problem you are trying to solve?

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


Re: [R] Proposal: Archive UseR conference presentations at www.r-project.org/useR-yyyy

2007-09-24 Thread Friedrich Leisch
 On Mon, 24 Sep 2007 09:25:27 -0500,
 hadley wickham (hw) wrote:

   I think I like Hadley's proposal of collecting conference webpages
   (after the conference is over) to one of our servers
   better. Redirecting to pages at different locations is dangerous when
   people move on to new positions.

   That wasn't my suggestion,

Sorry, my mistake. I was wading through several hundred emails
yesterday after an offline period ... makes your brain go numb rather
quickly.

   but I can understand your desire to do
   that.  Perhaps just taking a static snapshot using something like
   wget, and hosting that on the R-project website would be a good
   compromise.

Hmm, wouldn't it be easier if the hosting institution would make a tgz
file? wget over HTTP is rather bad in resolving links etc

we could include a note on the top page that this is only a snapshot
copy and have a link to the original site (in case something changes
there).

   E.g., I currently have the problem that since both Kurt and myself
   are no longer at TU Wien, we cannot guarantee how long
   www.ci.tuwien.ac.at will be up and running, and we were talking last
   week about moving the old DSC webpages to the server at WU running
   www.R-project.org.

   Yes, this is why I prefer to host all of my sites on an external host.

   So it would make a lot of sense to me to collect old conference pages
   to a central location under the www.R-project.org umbrella. During the
   active phase of a conference it is certainly better to have them on
   a server under control of the local organizing committee.

   The one problem is setting up a redirect so that existing links and
   google searches aren't broken.  This would need to be put in place at
   least 6 months before the old website closed.

Yes, very good point, I didn't think about that. But the R site is
searched very often, so material there appears rather quickly on
Google searches. Ad bookmarks: I don't want to remove the old site,
just have an archive copy at a central location.

.f

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