Re: [R] grid(Base): How to avoid Figure region too small and/or viewport too large by specifying 'relative' units?

2012-10-20 Thread Marius Hofert
In the meanwhile, I found a more minimal example which shows the problem (just change 'inch' to TRUE to see the difference): require(grid) inch - FALSE # TRUE d - if(inch) 5 else 1 pspc - d*c(0.3, 0.3) # width, height of panels spc - d*c(0.05, 0.05) # width, height of space axlabspc - d*c(0.1,

[R] mark sections on a time chart

2012-10-20 Thread Christof Kluß
Hi is there a comfortable way to mark periods on time chart (axis.Date)? To do it with arrows(...), seems to be irritating. I want to have something like ---winterspringsummer-- thx Christof __ R-help@r-project.org mailing list

Re: [R] Creating a new by variable in a dataframe

2012-10-20 Thread arun
HI, Without using ifelse() on the same example dataset. d - data.frame(stringsAsFactors = FALSE, transaction = c(T01, T02, T03, T04, T05, T06, T07, T08, T09, T10),date = c(2012-10-19, 2012-10-19, 2012-10-19, 2012-10-19, 2012-10-22, 2012-10-23, 2012-10-23, 2012-10-23, 2012-10-23, 2012-10-23),time

Re: [R] Question about survdiff in for-loop.

2012-10-20 Thread Sando
Thank you for your replay and help !! Best Regards, Young. -- View this message in context: http://r.789695.n4.nabble.com/Question-about-survdiff-in-for-loop-tp4646707p4646827.html Sent from the R help mailing list archive at Nabble.com. __

[R] xyplot type 'a' with mean symbols

2012-10-20 Thread Jasmine
Hi there I almost have the graph I want (except for moving the legend into the graph). Can someone please tell me how to put symbols at the means for this graph? xyplot (anxiety ~ treatment, groups=therapist, data=study2, ylim=c(0,50), auto.key=T, type='a') Thank you so much :) -- View this

[R] Help with programming a tricky algorithm

2012-10-20 Thread Andrew Crane-Droesch
Hi All, I'm a little stumped by the following problem. I've got a dataset with the following structure: idxyixiycountry(other variables) 111c1x1 212c1x2 313c1x3 ... .

Re: [R] Centering labels on X-axis

2012-10-20 Thread Jim Lemon
On 10/20/2012 01:39 AM, YAddo wrote: Dear all: I am trying to center labels on my plot with not much success. I have tried text(), mtext() but it's not working. I think I am using the wrong function for my task. Any help will be appreciated. My working codes. axis(1,

Re: [R] Axis Breaks with ggplot2

2012-10-20 Thread Jim Lemon
On 10/20/2012 01:50 AM, Edward Patzelt wrote: R-help - I'm trying to create axis breaks similar to this : http://www.r-bloggers.com/wp-content/uploads/2010/08/bar-chart-natural-axis-split1.png . Hi Edward, The gap.barplot function in the plotrix package does something like this, but it is

Re: [R] how can I make a legend that applies for all the barplots in one same page?

2012-10-20 Thread Jim Lemon
On 10/20/2012 06:22 AM, Yakamu Yakamu wrote: Dear all, I would like to make 6 barplots in one page but with a legend that applies to all the barplots and would like to put it in the central-bottom of the page. I know only how to make legend for individual barplot, but since all my barplots

Re: [R] how can I make a legend that applies for all the barplots in one same page?

2012-10-20 Thread Prof Brian Ripley
On 20/10/2012 10:33, Jim Lemon wrote: On 10/20/2012 06:22 AM, Yakamu Yakamu wrote: Dear all, I would like to make 6 barplots in one page but with a legend that applies to all the barplots and would like to put it in the central-bottom of the page. I know only how to make legend for individual

Re: [R] Optimization in R similar to MS Excel Solver

2012-10-20 Thread Berend Hasselman
I do not know what algorithms the Excel solver function uses. See inline for how to do what you want in R. Forgive me if I have misinterpreted your request. On 19-10-2012, at 16:25, Richard James wrote: Dear Colleagues, I am attempting to develop an optimization routine for a river suspended

Re: [R] Help with programming a tricky algorithm

2012-10-20 Thread Rui Barradas
Hello, You should post a data example with ?dput. If your dataset is named MyData, use dput( head(MyData, 30) ) # paste the output of this in a post Anyway, I believe the following function might do what you want. It's untested, though. (Your example dataset is usefull but could be better)

[R] can't find the error in if function... maybe i'm blind?

2012-10-20 Thread Janosch
Hi everybody, the following alway gives me the error Fehler in if (File$X.Frame.Number[a] + 1 == File$X.Frame.Number[a + 1]) (File$FishNr[a] - File$FishNr[a - : Fehlender Wert, wo TRUE/FALSE nötig ist. Maybe its stupid, but i'm not getting why... Maybe someone can help me. Thanks a lot! for

[R] Error: not 'a real'?

2012-10-20 Thread Brian
Hi List, when supplying a vector of atomic vector classes to read.table, I get: # column classes colClasses=c(character, character,numeric, numeric, numeric, numeric, numeric, numeric, numeric, numeric, numeric, numeric) # Error: Error in scan(file,

[R] supply methods to read.table

2012-10-20 Thread Brian
Hi List, I would like to optimize some data reading as well as clean up some code. The manual tells me to supply methods to colClasses but the manual and the methods documentation aren't helping... Can someone provide me an example please? Best, Brian R version 2.15.1 (2012-06-22) Platform:

Re: [R] Error: not 'a real'?

2012-10-20 Thread Jim Holtman
how about supplying the context of the error. Show the lines in the file where the error occurred. Sent from my iPad On Oct 20, 2012, at 7:21, Brian zenli...@gmail.com wrote: Hi List, when supplying a vector of atomic vector classes to read.table, I get: # column classes

Re: [R] can't find the error in if function... maybe i'm blind?

2012-10-20 Thread Jim Holtman
Learn how to debug your programs. Start with options(error = recover) this will give you control at the point of the error so you can examine values. Most likely one of the variables in the 'if' expression is an NA. Sent from my iPad On Oct 20, 2012, at 6:27, Janosch janosch1...@web.de

Re: [R] can't find the error in if function... maybe i'm blind?

2012-10-20 Thread Milan Bouchet-Valat
Le samedi 20 octobre 2012 à 03:27 -0700, Janosch a écrit : Hi everybody, the following alway gives me the error Fehler in if (File$X.Frame.Number[a] + 1 == File$X.Frame.Number[a + 1]) (File$FishNr[a] - File$FishNr[a - : Fehlender Wert, wo TRUE/FALSE nötig ist. Maybe its stupid, but i'm

Re: [R] mark sections on a time chart

2012-10-20 Thread Rui Barradas
Hello, The function below requires package plotrix and is far from fully tested, but it might do what you want. library(zoo) arrowsRange - function(from, to, at = 1, labels = NULL, length = 1/8, horizontal = TRUE, border = FALSE, ...){ require(plotrix) f1 - function(){

Re: [R] Error: not 'a real'?

2012-10-20 Thread Brian
Hi Jim, On 10/20/12 13:36, Jim Holtman wrote: how about supplying the context of the error. Show the lines in the file where the error occurred. Sent from my iPad On Oct 20, 2012, at 7:21, Brian zenli...@gmail.com wrote: Hi List, when supplying a vector of atomic vector classes to

Re: [R] Error: not 'a real'?

2012-10-20 Thread Milan Bouchet-Valat
Le samedi 20 octobre 2012 à 14:25 +0200, Brian a écrit : Hi Jim, On 10/20/12 13:36, Jim Holtman wrote: how about supplying the context of the error. Show the lines in the file where the error occurred. Sent from my iPad On Oct 20, 2012, at 7:21, Brian zenli...@gmail.com

Re: [R] Error: not 'a real'?

2012-10-20 Thread Brian
Hi Milan, that's right, forgot about that one! Sorry to bother. Brian On 10/20/12 14:37, Milan Bouchet-Valat wrote: Le samedi 20 octobre 2012 à 14:25 +0200, Brian a écrit : Hi Jim, On 10/20/12 13:36, Jim Holtman wrote: how about supplying the context of the error. Show the lines in the file

Re: [R] mark sections on a time chart

2012-10-20 Thread Rui Barradas
Hello, Sorry, didn't paste the function call. plot(z) abline(v = c(start[1], end)) arrowsRange(start, end, at = 0, labels = seasons) Rui Barradas Em 20-10-2012 13:19, Rui Barradas escreveu: Hello, The function below requires package plotrix and is far from fully tested, but it might do

Re: [R] fit a threshold function with nls

2012-10-20 Thread Véronique Boucher Lalonde
Thank you all for your help. I think I now understand the issue. I tried to write a likelihood function for my binomial model. Please excuse my ignorance if I am not doing this right; I do not have any statistical background. #Example data x - seq(0, 1000) y - ifelse(x 300, 0, ifelse(x700, 0,

Re: [R] MLE of negative binomial distribution parameters

2012-10-20 Thread Ben Bolker
Zoraida zmorales at ingellicom.com writes: I need to estimate the parameters for negative binomial distribution (pdf) using maximun likelihood, I also need to estimate the parameter for the Poisson by ML, which can be done by hand, but later I need to conduct a likelihood ratio test between

Re: [R] supply methods to read.table

2012-10-20 Thread Ben Bolker
Brian zenlines at gmail.com writes: Hi List, I would like to optimize some data reading as well as clean up some code. The manual tells me to supply methods to colClasses but the manual and the methods documentation aren't helping... Can someone provide me an example please? Your

Re: [R] fit a threshold function with nls

2012-10-20 Thread Bert Gunter
Inline. -- Bert On Sat, Oct 20, 2012 at 6:44 AM, Véronique Boucher Lalonde veronique.boucher.lalo...@gmail.com wrote: Thank you all for your help. I think I now understand the issue. I tried to write a likelihood function for my binomial model. Please excuse my ignorance if I am not doing

Re: [R] R2OpenBUGS quesion

2012-10-20 Thread charlie
Received the same error with OpenBUGS322 trying to run the schools example under Wine 1.5.15, R 2.15.1, R2OpenBUGS_3.2-1.4, on a mac pro with Snow Leopard . I then tried with OpenBUGS321 and it ran fine. -- View this message in context:

[R] Can I please be taken off the mailing list

2012-10-20 Thread Jonathan Brown
[[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,

Re: [R] Can I please be taken off the mailing list

2012-10-20 Thread David Winsemius
On Oct 20, 2012, at 7:50 AM, Jonathan Brown wrote: [[alternative HTML version deleted]] __ R-help@r-project.org mailing list The link below is where you most likely subscribed and where you also need to go to unsubscribe. None of us

Re: [R] dotchart ordering problem

2012-10-20 Thread Zenonn87
I've got another problem. What if I have another dotchart with same categories, but one of the data are missing (control A)?? So I want to leave out from the dotchart. In this case in the control category should have only one dotline, because the other one is empty. Or mark somehow that it's

[R] Trouble returning 2D array into R from Fortran

2012-10-20 Thread paulfjbrowne
Hello, I have been trying to use a collection of Fortran subroutines to return a 2D array of calculated values to my R code, calling a Fortran wrapper subroutine from R. I've done this successfully before with C C++ code. The Fortran wrapper subroutine which is to be called by R takes a set of

Re: [R] Creating a new by variable in a dataframe

2012-10-20 Thread William Dunlap
d$flag-unlist(rbind(lapply(split(d,d$date),function(x) x[3]==max(x[3] I think that line is unnecessarily complicated. lapply() returns a list and rbind applied to one argument, L, mainly adds dimensions c(length(L),1) to it (it also changes its names to rownames). unlist doesn't care about

[R] system.time question

2012-10-20 Thread Mark Leeds
Hi : I looked at the help for system.time but I still have the following question. Can someone explain the output following output of system.time : user system elapsed 12399.681 5632.352 56935.647 Here's my take based on the fact that I was doing ps -aux | grep R off and on and

Re: [R] Trouble returning 2D array into R from Fortran

2012-10-20 Thread Berend Hasselman
See inline. On 20-10-2012, at 17:18, paulfjbrowne paulfj.bro...@gmail.com wrote: Hello, I have been trying to use a collection of Fortran subroutines to return a 2D array of calculated values to my R code, calling a Fortran wrapper subroutine from R. I've done this successfully before

Re: [R] system.time question

2012-10-20 Thread Jeff Newmiller
You asked several questions. Elapsed: yes User + System = CPU: yes Finally: You have to look at the load and/or cpu core count. Unless you setup your code to take advantage of multiple cores, R runs on a single core. Also: Do you really need to ask that question?

Re: [R] system.time question

2012-10-20 Thread Prof Brian Ripley
On 20/10/2012 17:16, Mark Leeds wrote: Hi : I looked at the help for system.time but I still have the following question. Can someone explain the output following output of system.time : user system elapsed 12399.681 5632.352 56935.647 Yes, the help page can, via

Re: [R] mark sections on a time chart

2012-10-20 Thread Christof Kluß
Hello Rui Barradas thank you very much. That is exactly what I was looking for. Christof Am 20-10-2012 14:19, schrieb Rui Barradas: library(zoo) arrowsRange - function(from, to, at = 1, labels = NULL, length = 1/8, horizontal = TRUE, border = FALSE, ...){ require(plotrix) f1

Re: [R] Creating a new by variable in a dataframe

2012-10-20 Thread William Dunlap
d$flag2 - unlist(lapply(unname(split(d[[3]], d$date), function(x)x==max(x I'm sorry, I stuck in the unname() in the mail but did not run it - its closing parenthesis should be after split's closing parenthisis, not at the end. d$flag2 - unlist(lapply(unname(split(d[[3]], d$date)),

Re: [R] saving to docx

2012-10-20 Thread Duncan Temple Lang
Just to let people know On the Omegahat site (and source on github), there are packages for working with Office Open documents (and LibreOffice too), includinging RWordXML, RExcelXML and the generic package OOXML on which they rely. These are prototypes in the sense that they do not

[R] Error in integrate(integrand, 0, Inf) : non-finite function value

2012-10-20 Thread stats12
Dear R users, When I run the code below, I get the error Error in integrate(integrand, 0, Inf) : non-finite function value. The code works if the function returns only sum(integ). However, I want to add cmh to it. When I add cmh I get that error. I can't figure out why this is happening because

Re: [R] se's and CI's for fitted lines in multivariate regression analysis

2012-10-20 Thread Sigrid
Hi again, Thank you so much for the script. Unfortunately, I feel like I might not have explained things clearly enough from the start. What I’m looking for is the st. errors or CI intervals for the estimate the parameter for slope and intercept for each level of each factor. From the summary

Re: [R] Creating a new by variable in a dataframe

2012-10-20 Thread arun
HI Bill, Thanks for the reply. It was unnecessarily complicated. d$flag-unlist(lapply(split(d,d$date),function(x) x[3]==max(x[3])),use.names=FALSE) #or d$flag-unlist(lapply(split(d,d$date),function(x) x[3]==max(x[3]))) should have done the same job. str(d) #'data.frame':    10 obs. of  4

Re: [R] Creating a new by variable in a dataframe

2012-10-20 Thread arun
HI Bill, I figured it out.  d$flag2-unlist(lapply(unname(split(d[[3]],d$date)),function(x) x==max(x))) # [1] FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE FALSE  TRUE ) created the error. A.K. - Original Message - From: William Dunlap wdun...@tibco.com To: arun

Re: [R] Trouble returning 2D array into R from Fortran

2012-10-20 Thread paulfjbrowne
I will look into using inline, but since the Fortran code is several thousand lines long is comprised of multiple subroutines, compiling it into a shared object dynamically loading it into R is probably the easier solution. I have also noticed a strange numerical problem when calling the

[R] [R-pkgs] ggmcmc 0.2 has been released

2012-10-20 Thread Xavier Fernández i Marín
Dear all, ggmcmc-0.2 has been released. ggmcmc is a tool for assessing and diagnosing convergence of Markov Chain Monte Carlo simulations, as well as for graphically display results from full MCMC analysis. The package also facilitates the graphical interpretation of models by providing flexible

Re: [R] Trouble returning 2D array into R from Fortran

2012-10-20 Thread Berend Hasselman
Look at my comments in between your post. On 20-10-2012, at 19:18, paulfjbrowne paulfj.bro...@gmail.com wrote: I will look into using inline, but since the Fortran code is several thousand lines long is comprised of multiple subroutines, compiling it into a shared object dynamically

Re: [R] se's and CI's for fitted lines in multivariate regression analysis

2012-10-20 Thread David Winsemius
On Oct 16, 2012, at 11:58 AM, Sigrid wrote: Okay, I've now tried to the predict function and get the SE, although it seem to calculate SE for each observation from the line (I assume), while I want the CI-interval and SE for each line fitted line for the treatment. I do not really understand

Re: [R] Error in integrate(integrand, 0, Inf) : non-finite function value

2012-10-20 Thread David Winsemius
On Oct 20, 2012, at 9:23 AM, stats12 wrote: Dear R users, When I run the code below, I get the error Error in integrate(integrand, 0, Inf) : non-finite function value. The code works if the function returns only sum(integ). But you never showed us the working code. However, I want to

[R] Logistic regression/Cut point? predict ??

2012-10-20 Thread Adel Powell
I am new to R and I am trying to do a monte carlo simulation where I generate data and interject error then test various cut points; however, my output was garbage (at x equal zero, I did not get .50) I am basically testing the performance of classifiers. Here is the code: n - 1000; # Sample size

[R] Credit Scoring in R - Weight of Evidence

2012-10-20 Thread Axel Urbiz
Dear List, I couldn't find any package that performs the weight of evidence of predictors (a transformation usually performed in credit scoring applications). Is there any that you know? Thanks, Axel. [[alternative HTML version deleted]] __

Re: [R] Expected number of events, Andersen-Gill model fit via coxph in package survival

2012-10-20 Thread Omar De la Cruz C.
I have a follow-up question (for either Dr. Therneau, or anybody who might know). sum(zz) (see below) estimates the number of events for the cohort. Now, how can I compute a confidence interval for sum(zz)? Or a standard error? My obvious choice, square root of the sum of the squares of the

Re: [R] Logistic regression/Cut point? predict ??

2012-10-20 Thread Simon Knapp
What do you mean by at x equal zero? On Sun, Oct 21, 2012 at 8:37 AM, Adel Powell powella...@gmail.com wrote: I am new to R and I am trying to do a monte carlo simulation where I generate data and interject error then test various cut points; however, my output was garbage (at x equal zero, I

Re: [R] Centering labels on X-axis

2012-10-20 Thread YAddo
Thanks Jim and Rui. My apologies, i did not give enough info on my plot. I am using : plot(x,y) for a line plot. I want to center the labels on the x-axis for each tick. Thanks. -- View this message in context:

[R] rms plot.Predict question: swapping x- and y- axis for categorical predictors

2012-10-20 Thread stephsus
Hello all, I'm trying to plot the effects of variables estimated by a regression model fit individually, and for categorical predictors, the independent variable shows up on the y-axis, with the dependent variable on the x-axis. Is there a way to prevent this reversal? Sample code with dummy

[R] FreeBSD installation problems

2012-10-20 Thread J. Maxwell
R Compiliing or installation failure on FreeBSD 9.0-RELEASE FreeBSD ; I386 box. configuring with the default settings, no 'options' = ./configure ... ... ... checking whether gcc -std=gnu99 supports -c -o FILE.lo... yes checking for gcc -std=gnu99 option to support

Re: [R] Centering labels on X-axis

2012-10-20 Thread David Winsemius
On Oct 20, 2012, at 3:03 PM, YAddo wrote: Thanks Jim and Rui. My apologies, i did not give enough info on my plot. Nor do you even now. Offer a data example. I am using : plot(x,y) for a line plot. I want to center the labels on the x-axis for each tick. Code. We want code. --

Re: [R] Error in integrate(integrand, 0, Inf) : non-finite function value

2012-10-20 Thread stats12
Hi, Thank you for your comment. I worked on the code again and was able to make it work. The only problem I am having right now is that nlm depends on the initial value. When the initial value is 1, I get the following estimates 0.1230414 19.6271029 when it is 2, I get the following 29.46874