[R] Clash between alr3 and AlgDesign. (Was: Re: Second subsequent calls to function fails. Please help debug.)

2008-03-30 Thread Michael Kubovy
Thanks, Duncan, I started a new session under the suspicion that packages were clashing. # # RUN 1 # require(faraway) # Loading required package: faraway data(oatvar) ov.lm - lm(yield ~ variety + block, oatvar) require(alr3) # Loading required package: alr3 out -

[R] Journal for R

2008-03-30 Thread Christophe Genolini
Hi the list I made up a new statistical procedure. I will publish it in a medical journal, but there will be only the way of using it, no calculation or algorithme detail. So is there a journal (I mean scientific journal) with selection commity to submit an article describing the detail of a

Re: [R] Defining reference category for a cph model summary inside of a for loop

2008-03-30 Thread Frank E Harrell Jr
Wells, Brian wrote: Dr. Harrell, Thanks for you help. I tried: print(summary(f,parse(text=paste(i,'=1st Quartile', sep='' Same result. No error, the reference category simply doesn't change. That's good, because the default in summary is to compare the outer quartiles for a

Re: [R] Journal for R

2008-03-30 Thread Gavin Simpson
On Sun, 2008-03-30 at 15:01 +0200, Christophe Genolini wrote: Hi the list I made up a new statistical procedure. I will publish it in a medical journal, but there will be only the way of using it, no calculation or algorithme detail. So is there a journal (I mean scientific journal) with

Re: [R] Clash between alr3 and AlgDesign. (Was: Re: Second subsequent calls to function fails. Please help debug.)

2008-03-30 Thread Duncan Murdoch
On 30/03/2008 8:43 AM, Michael Kubovy wrote: Thanks, Duncan, I started a new session under the suspicion that packages were clashing. ... # # BAD INTERACTION BETWEEN alr3 and AlgDesign # What now? There's not much you can do; this is up to the package authors to fix.

Re: [R] Journal for R

2008-03-30 Thread Peter Dalgaard
Gavin Simpson wrote: On Sun, 2008-03-30 at 15:01 +0200, Christophe Genolini wrote: Hi the list I made up a new statistical procedure. I will publish it in a medical journal, but there will be only the way of using it, no calculation or algorithme detail. So is there a journal (I mean

[R] tests Rin Rout

2008-03-30 Thread Christophe Genolini
Hi the list, Some rumour (!) say that is it possible to prepare some tests for checking our code using .Rin and .Rout. It seems to be a very good practice, but I did not manage to find information on it. So does someone know how it works ? What are we suppose to write in Rin ? More precisely :

[R] convert weekly time series data to monthly

2008-03-30 Thread Richard Saba
I have weekly time series data with year, month, day, and price variables. The input data set for the weekly series takes the following form: Year month day price 19908 20 119.1 19908 27 124.5 19909 3 124.2 19909 10

Re: [R] Clash between alr3 and AlgDesign. (Was: Re: Second subsequent calls to function fails. Please help debug.)

2008-03-30 Thread Gabor Grothendieck
On Sun, Mar 30, 2008 at 9:43 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: In my opinion, all packages should have namespaces, and I'd like to create a default one if the author doesn't. (The default would be: import what is listed in the Depends clause, export everything.) I don't think this

Re: [R] convert weekly time series data to monthly

2008-03-30 Thread Henrique Dallazuanna
If I understand: x.new - cbind('M.Y'=paste(month.abb[x$month], x$Year, sep=-), x[-3]) aggregate(list(Change=x.new$price), list(M.Y=x.new[,M.Y], Year=x.new$Year, Month=x.new$month), FUN=mean) On 30/03/2008, Richard Saba [EMAIL PROTECTED]

Re: [R] convert weekly time series data to monthly

2008-03-30 Thread Gabor Grothendieck
Do you mean merge them into a two column series of price for one column and change for another column? That is what I will assume since the result was not illustrated. Suggest you read the help files and the three vignettes in the zoo package. Also R News 4/1 has info on dates. If you were

Re: [R] Quick question: Does this graph have a name?

2008-03-30 Thread mika03
Thanks a lot for all your replies so far! I now share your feeling that this might not be the best way to show the data. Here's what the data is about: We have search engine queries (12,000 of them), which are grouped into semantic categories. (Some ask for a Person, some are about celebrity

[R] Problem: using cor.test with by( )

2008-03-30 Thread Che-hsu (Joe) Chang
Hello everyone, I'm a new R user switching from SAS and JMP. In the first few days, I have been trying to do a fairly simple task but yet found no success. I've checked the help archive as well as few R textbooks but didn't seem to find the answer. So, please help me if you can.

Re: [R] Journal for R

2008-03-30 Thread Mark Kimpel
As a medical researcher, I keep tabs on the journals Bioinformatics andd BMC Bioinformatics. If your package is for 'omics, those are good journals to look at. Mark On Sun, Mar 30, 2008 at 10:02 AM, Peter Dalgaard [EMAIL PROTECTED] wrote: Gavin Simpson wrote: On Sun, 2008-03-30 at 15:01

Re: [R] Clash between alr3 and AlgDesign. (Was: Re: Second subsequent calls to function fails. Please help debug.)

2008-03-30 Thread Michael Kubovy
Hi Duncan, Yes, I came to realize that ifelse was not the way to go. Here is how I dealt with it: if(sum('AlgDesign' == (.packages())) 0) detach('package:AlgDesign') It requires me (and my students) to learn only the (.packages()) construct (and avoid knowing anything about search(),

Re: [R] Clash between alr3 and AlgDesign. (Was: Re: Second subsequent calls to function fails. Please help debug.)

2008-03-30 Thread Duncan Murdoch
On 30/03/2008 11:31 AM, Gabor Grothendieck wrote: On Sun, Mar 30, 2008 at 9:43 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: In my opinion, all packages should have namespaces, and I'd like to create a default one if the author doesn't. (The default would be: import what is listed in the

Re: [R] Clash between alr3 and AlgDesign. (Was: Re: Second subsequent calls to function fails. Please help debug.)

2008-03-30 Thread Duncan Murdoch
On 30/03/2008 10:06 AM, Michael Kubovy wrote: I've been trying to dynamically detach and attach things in my Sweave, in order to circumvent the problem. Here is my first attempt: pkg - 'package:AlgDesign' p - is.na(match(pkg, search())) ifelse(p == FALSE, detach(pkg), NA) You can't use

Re: [R] Problem: using cor.test with by( )

2008-03-30 Thread Peter Dalgaard
Che-hsu (Joe) Chang wrote: Hello everyone, I'm a new R user switching from SAS and JMP. In the first few days, I have been trying to do a fairly simple task but yet found no success. I've checked the help archive as well as few R textbooks but didn't seem to find the answer. So, please

Re: [R] tests Rin Rout

2008-03-30 Thread Duncan Murdoch
On 30/03/2008 10:44 AM, Christophe Genolini wrote: Hi the list, Some rumour (!) say that is it possible to prepare some tests for checking our code using .Rin and .Rout. It seems to be a very good practice, but I did not manage to find information on it. So does someone know how it works

Re: [R] Generating maps in R

2008-03-30 Thread Roger Bivand
Aleksandr Andreev aleksandr.andreev at duke.edu writes: Greetings! I am trying plot some data on a map in R. Here's the scenario. I have a variable called probworkinghealthy which contains a predicted probability of employment for every individual in my sample (about 100,000

[R] Definition of wrapper?

2008-03-30 Thread Bryan Hanson
I think I more or less understand what a ³wrapper² is, but I¹d like to hear how more experienced R users define it, and especially I'd like to know if there is a formal definition. In my reading, it seems like there are a fairly wide range of meanings, but they are all conceptually similar. I've

Re: [R] tests Rin Rout

2008-03-30 Thread Christophe Genolini
See the paragraph in Writing R Extensions which explains this Well, I saw it again and again (before asking on the r-help) but I do not understand. Same for the Kurt Hornik slides on the web. Create tests/myPack.R with those lines in it plus lines to actually run the code. Does it mean

Re: [R] Definition of wrapper?

2008-03-30 Thread Charilaos Skiadas
On Mar 30, 2008, at 2:51 PM, Bryan Hanson wrote: I think I more or less understand what a “wrapper” is, but I’d like to hear how more experienced R users define it, and especially I'd like to know if there is a formal definition. In my reading, it seems like there are a fairly wide

[R] Describing discriminant function

2008-03-30 Thread SS-R
hello, I have two 2-d normal multivariate distributions mapped out on a scatter plot. I now need a line that equates the two discriminant functions, ie. g1(x) = g2(x). This should be a quadratic. How can I solve this in R? Thanks -- View this message in context:

Re: [R] Definition of wrapper?

2008-03-30 Thread Gabor Grothendieck
The wrapper wraps, i.e. calls, another function that does the real work but provides a different or more convenient (or more convenient for a specific purpose) interface to it or specific syntax. Often the wrapper has the same arguments but different defaults and sometimes that is referred to as

Re: [R] tests Rin Rout

2008-03-30 Thread Duncan Murdoch
For questions like this about package development, you should ask on R-devel, but I'll continue the thread here for one more message. On 30/03/2008 2:54 PM, Christophe Genolini wrote: See the paragraph in Writing R Extensions which explains this Well, I saw it again and again (before asking on

[R] Plot for jump point

2008-03-30 Thread kate
Hi, My code is as the following, ratio-seq(0,1,by=0.01) payoff-NULL for (i in 1:length(ratio) ) { payoff1-100*(ratio[i]=0.7)+max(100*(1+(ratio[i]-1)*2),0)*(ratio[i]0.7) payoff-c(payoff,payoff1) } plot(ratio,payoff, xlab='ST/S0', ylab='Payoff',type='l') I have the discontinuous point at

Re: [R] Problem: using cor.test with by( )

2008-03-30 Thread Liviu Andronic
On Sun, Mar 30, 2008 at 7:11 PM, Che-hsu (Joe) Chang [EMAIL PROTECTED] wrote: Basically, I want to calculate the correlation between variable A and B for every subject in my study. (yep, that simple) What I did is this: by(data, id, function (x) cor.test(A,B, data=x)) This recent thread

[R] I need really help

2008-03-30 Thread mohammed alawa
Dear , Madam/Sir I'm student doing master in statistics, I'd like to know how i can set data in R and apply meta-analysis. i have tries many ways but I'm really stuck. i really appreciate if you can help me in this matter. Mohammed Owlowa -

[R] maximum of identical elements in a vector

2008-03-30 Thread Daniel Malter
Hi, the problem I have is seemingly very simple, but not simple enough for me to figure out. I just want to find the most (or least) frequent element in the vector. a=c(Alice,Alice,Alice,Alice,Bob,Bob) unique(a) length(which(a==Alice)) unique(a) shows me that the elements in my vector are

Re: [R] Plot for jump point

2008-03-30 Thread jim holtman
Try this: ratio-seq(0,1,by=0.01) payoff-NULL for (i in 1:length(ratio) ) { payoff1-100*(ratio[i]=0.7)+max(100*(1+(ratio[i]-1)*2),0)*(ratio[i]0.7) payoff-c(payoff,payoff1) } payoff[70] - NA # force no line plot(ratio,payoff, xlab='ST/S0', ylab='Payoff',type='l') points(c(ratio[69], ratio[71]),

Re: [R] maximum of identical elements in a vector

2008-03-30 Thread Chuck Cleland
On 3/30/2008 5:35 PM, Daniel Malter wrote: Hi, the problem I have is seemingly very simple, but not simple enough for me to figure out. I just want to find the most (or least) frequent element in the vector. a=c(Alice,Alice,Alice,Alice,Bob,Bob) unique(a) length(which(a==Alice))

Re: [R] maximum of identical elements in a vector

2008-03-30 Thread Gavin Simpson
On Sun, 2008-03-30 at 17:35 -0400, Daniel Malter wrote: Hi, the problem I have is seemingly very simple, but not simple enough for me to figure out. I just want to find the most (or least) frequent element in the vector. a=c(Alice,Alice,Alice,Alice,Bob,Bob) unique(a)

Re: [R] problem with white space

2008-03-30 Thread jim holtman
Here is one way of doing it. I would suggest that you read in the data with readLines and then combine into one single string so that you can use substring on it. Since you did not provide provide commented, minimal, self-contained, reproducible code, I will take a guess at that your data looks

Re: [R] problem with white space

2008-03-30 Thread jim holtman
How long is it taking? Can you send me the code that you are using. Another technique is to recode you characters into numbers and store them as integers. You can then sample the values and reconstruct the output. Here is a faster way: # create some test data -- might be read in the readLines

Re: [R] Generating maps in R

2008-03-30 Thread Aleksandr Andreev
Roger Bivand Roger.Bivand at nhh.no writes: Merge using: FS1 - spCbind(FS, agg2) This call fails, because: Error in spCbind(FS, agg2) : different numbers of rows The reason is because I have data in a001ter for 79 Federal Subjects, but russia.shp contains 193 labeled objects (93 Federal

Re: [R] maximum of identical elements in a vector

2008-03-30 Thread Daniel Malter
Thanks to all who responded so quickly. - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: Chuck Cleland [mailto:[EMAIL PROTECTED] Gesendet: Sunday, March 30, 2008 5:45 PM An: Daniel Malter Cc: [EMAIL PROTECTED] Betreff: Re:

[R] Finding a mean value of a variable holding a dummy variable fixed

2008-03-30 Thread Alexander Ovodenko
I have time-series data on approval ratings of British Prime Ministers. The prime ministers dating from MacMillan onward till today are coded as dummy variables and the approval ratings are entered for each month. I want to know the mean value of the approval rating of each Prime Minister in the

Re: [R] Finding a mean value of a variable holding a dummy variablefixed

2008-03-30 Thread Daniel Malter
The mean problem can be solved with president=c(Johnson,Johnson,Johnson,Johnson,Johnson,Johnson,Nix on,Nixon,Nixon,Nixon,Nixon,Nixon) approval=seq(1:12) tapply(approval,president,mean) For the other, I will try to come back. But I am sure somebody will be faster than I. Cheers, Daniel

Re: [R] Finding a mean value of a variable holding a dummy variablefixed

2008-03-30 Thread Daniel Malter
I found a solution. It's probably not the easiest one, but it works. It assumes that your data frame is ordered from earliest to latest record for each president, but it can be easily adjusted if you want to make it dependent on a third column. The final vector index gives you the line indices

Re: [R] Finding a mean value of a variable holding a dummyvariablefixed

2008-03-30 Thread Bill.Venables
Here is another way, starting with similar dummy data: PMData - data.frame(PM = c(Thatcher, Thatcher, Thatcher, Thatcher, Thatcher, Thatcher,Major, Major, Major, Major, Major, Major), approval = c(3, 4, 5, 6, 7,

[R] Find the index for min of a matrix

2008-03-30 Thread kate
Hi, My example is as the following, W-matrix(c(2,4,2,8,1,3),ncol=3) which(W==min(W)) I would like to find the index for min of the matrix W, i.e. (1, 3) instead of 5 as the output. What command could I use? Thanks, Kate [[alternative HTML version deleted]]

[R] APPLY as alternate to FOR loop?

2008-03-30 Thread zack holden
Dear list, Below I've written a clunky for loop that counts NA's in a row, replacing all with NA if there are more than 3 missing values, or keeping the values if 4 or more are present. This is sample code from a very large dataframe I'm trying to clean up. I know there are many simpler

[R] multivariate histogram

2008-03-30 Thread johyhan
Dear Everyone, 1. I have an n-dimension data. 2. I could get the shape of pdf of each one from each of their histograms. 3.?Now I would like to get the joint pdf of the all the dimensions of X. How do we do #3 above? Regards, Joh [[alternative HTML version deleted]]

Re: [R] APPLY as alternate to FOR loop?

2008-03-30 Thread Bill.Venables
As far as I know there is no function called 'APPLY' There is one called 'apply', but why are you determined to use it here? It is essentially concealed looping. Here is an alternative way of solving your problem: ___ x - rbind(x1 = c(1, NA, NA, NA, NA, 1, 2, 2), x2 = c(1, NA, NA,

[R] WinXP exhibits sluggish graphics window movement mouse tracking (repainting?) over windows graphics devices

2008-03-30 Thread Richard Yeh
I just noticed when using 2.6.1, 2.6.2 (2008-02-08), 2.6.2pat (2008-02-21 r44582), and 2.6.2pat (2008-03-24 r44975) on my poor old Celeron D330 (2.6 GHz; 3.5 years old) running Windows XP, that the mouse cursor appears to be redrawn more sluggishly when the pointer is over R windows graphics