Re: [R] Produce multiple line graphs

2016-09-25 Thread David Winsemius
> On Sep 25, 2016, at 6:43 PM, John Sorkin wrote: > > I have a data frame that contains data for multiple (seven) subjects. Each > subject is represented by a new value of PID. > I would like to plot the data for all seven subjects. For each subject I want > to plot a line showing CT as a func

Re: [R] Produce multiple line graphs

2016-09-25 Thread Jim Lemon
Hi John, I know this is kind of dumb, but: plot(0,xlim=range(xx$Nit,na.rm=TRUE), ylim=range(xx$CT,na.rm=TRUE),type="n", xlab="Nit",ylab="CT") for(i in unique(xx$PID)) points(xx$Nit[xx$PID==i],xx$CT[xx$PID==i], pch=i,col=i,type="b") Jim On Mon, Sep 26, 2016 at 11:43 AM, John Sorkin wrote: >

Re: [R] Add annotation text outside of an xyplot (lattice package)

2016-09-25 Thread Jun Shen
Hi Richard, Thanks for demonstrating the usage of layer in latticeExtra. In my current case I do have multiple panels on one page but only need some universal annotation text for the whole page. So "sub" argument does the job pretty well. You have certainly shown a very interesting example to add

[R] Produce multiple line graphs

2016-09-25 Thread John Sorkin
I have a data frame that contains data for multiple (seven) subjects. Each subject is represented by a new value of PID. I would like to plot the data for all seven subjects. For each subject I want to plot a line showing CT as a function of Nit, with the dots for each subject joined. I have tri

Re: [R] how to remove all messages when loading a library ?

2016-09-25 Thread Fabien Tarrade
Hi Bert, ?? Dont you already have the answer: you must set warn.conflicts = FALSE in all your library calls. Thanks. This works. Now understand the logic but first I was thinking that removing WARNING messages should remove conflit warning as well. Anyway it works. Thanks Cheers Fabien Ch

Re: [R] Add annotation text outside of an xyplot (lattice package)

2016-09-25 Thread Richard M. Heiberger
Bert, I interpreted the OP's request as a single panel xyplot. The latticeExtra::layer mechanism does work for multiple plots. library(lattice) library(latticeExtra) tmp <- data.frame(x=1:10, y=1:10, g=rep(c("A","B"), each=5)) xyplot(y ~ x | g, data=tmp) xyplot(y ~ x | g, data=tmp, main="outsi

Re: [R] how to remove all messages when loading a library ?

2016-09-25 Thread Bert Gunter
?? Dont you already have the answer: you must set warn.conflicts = FALSE in all your library calls. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

Re: [R] how to remove all messages when loading a library ?

2016-09-25 Thread jim holtman
Try enclosing the whole thing in "suppressMessages"; suppressMessages({ if (!require("plyr",quietly=TRUE,warn.conflicts=FALSE)) suppressMessages(install.packages("plyr",quietly=TRUE)) if (!require("dplyr",quietly=TRUE)) suppressMessages(install.packages("dplyr",quietly=TRUE)) if (!requ

Re: [R] BCa confidence bands around fitted curves MARS regression

2016-09-25 Thread Bert Gunter
Presumably the "earth" package lacks this functionality ...? So, obvious query: did you try using the boot package? If not, why not? If so, show us the code that failed. Or am I missing the point? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along

Re: [R] Add annotation text outside of an xyplot (lattice package)

2016-09-25 Thread Bert Gunter
... but what if there are multiple panels? "The layer mechanism is a method for augmenting a panel function. It allows expressions to be added to the panel function without knowing what the original panel function was. " As I understand it, the OP requested annotation for the entire lattice displ

[R] how to remove all messages when loading a library ?

2016-09-25 Thread Fabien Tarrade
Hi there, I would like to remove all messages when I load library (I fact I am using "require" and "install.packages"). I tried many options and look at the documentation for the 2 functions. For example I am using the following piece of code: init.R print("step 1") # Install library if not i

[R] BCa confidence bands around fitted curves MARS regression

2016-09-25 Thread varin sacha via R-help
Dear R-experts, I have fitted a MARS regression and am trying now to plot/draw the BCa confidence bands around the 3 fitted curves (QUALITESANSREDONDANC, competitivite and innovation). Here is the reproducible example. Dataset = data.frame(PIBparHab=c(43931,675

Re: [R] Add annotation text outside of an xyplot (lattice package)

2016-09-25 Thread Richard M. Heiberger
library(lattice) library(latticeExtra) tmp <- data.frame(x=1:10, y=1:10) xyplot(y ~ x, data=tmp) xyplot(y ~ x, data=tmp, main="text outside panel clipped") + ## "+" must be on same line as first statement. ## This use of "+" is from latticeExtra. latticeExtra::layer(panel.text(x=2, y=-0.5,

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Jeff Newmiller
This illustrates why you need to post a reproducible example. You have a number of confounding factors in your code. First, "data" is a commonly-used function... avoid using it for variable names. Second, using the attach function this way leads to confusion... best to forget this function u

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Matti Viljamaa
> On 25 Sep 2016, at 19:37, Matti Viljamaa wrote: > > Okay here’s a pretty short code to reproduce it: > > data <- > read.table("http://users.jyu.fi/~slahola/files/glm1_datoja/yoruotsi.txt";, > header=TRUE) data$clka <- I(data$lka - mean(data$lka)) > attach(data) > > fit2 <- lm(ruotsi.pist

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Jeff Newmiller
Object clka not found. Did you test run it in a fresh R environment? -- Sent from my phone. Please excuse my brevity. On September 25, 2016 9:37:56 AM PDT, Matti Viljamaa wrote: >Okay here’s a pretty short code to reproduce it: > >data <- >read.table("http://users.jyu.fi/~slahola/files/glm1_da

Re: [R] Svyglm Error in Survey Package

2016-09-25 Thread Courtney Benjamin
Hello Dr. Fox, Thank you very much for your recommendations and I will take action on following them. I appreciate your willingness to provide guidance on my novice questions. Sincerely, Courtney From: Fox, John Sent: Sunday, September 25, 2016 9:21 AM

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Matti Viljamaa
Okay here’s a pretty short code to reproduce it: data <- read.table("http://users.jyu.fi/~slahola/files/glm1_datoja/yoruotsi.txt";, header=TRUE) attach(data) fit2 <- lm(ruotsi.pist ~ mies + koulu + lka + koulu*clka) bs <- coef(fit2) varitB <- c(data[koulu == 'B',]$mies) varitB[varitB == 0] =

Re: [R] Add annotation text outside of an xyplot (lattice package)

2016-09-25 Thread Jun Shen
Thanks Bert, sub works pretty well. Carlos, thanks for the suggestion. As I am not familiar with latticeExatra, not sure how hard it is to make it work with my plot. I'll try. On Sat, Sep 24, 2016 at 11:04 AM, Bert Gunter wrote: > No. > > ltext/panel.text plots text *within* panels; IIUC, the

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Jeff Newmiller
Go directly to C. Do not pass go, do not collect $200. You think curve does something, but you are missing what it actually does. Since you don't seem to be learning from reading ?curve or from our responses, you need to give us an example you can learn from. -- Sent from my phone. Please excu

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread mviljamaa
On 2016-09-25 18:52, Jeff Newmiller wrote: You seem to be confused about what curve is doing vs. what you are doing. But my x-range in curve()'s parameters from and to should be the entire lka vector, since they are from=min(lka) and to=max(lka). Then why does this not span the entire of lka?

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Jeff Newmiller
You seem to be confused about what curve is doing vs. what you are doing. A) Compute the points you want to plot and put them into 2 vectors. Then figure out how to plot those vectors. Then (perhaps) consider putting that all into one line of code again. B) The predict function is the preferr

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread mviljamaa
On 2016-09-25 18:30, Duncan Murdoch wrote: On 25/09/2016 9:10 AM, Matti Viljamaa wrote: Writing: bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*lka+bs["kouluB:clka"]*clka i.e. without that being inside curve produces a vector of length 375. So now it seems that curve() is really skippi

Re: [R] How to add overall xlabel and ylabel?

2016-09-25 Thread Duncan Murdoch
On 25/09/2016 7:51 AM, Matti Viljamaa wrote: I have created a 2x2 plot using par(mfrow = c(2, 2)). I can add x- and ylabels to individual plots, but what I want is to add overall xlabel and ylabel for the entire 2x2 plot. How to do this? First you need to make space using par(oma=...), then

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Duncan Murdoch
On 25/09/2016 9:10 AM, Matti Viljamaa wrote: Writing: bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*lka+bs["kouluB:clka"]*clka i.e. without that being inside curve produces a vector of length 375. So now it seems that curve() is really skipping some lka-/x-values. How could curve() k

Re: [R] Svyglm Error in Survey Package

2016-09-25 Thread Fox, John
Dear Courtney, You're confusing a function call, na.action(na.omit), with an argument specification, na.action=na.omit (and, in any event, there is no na.action() function). But you don't have to specify na.action=na.omit, because na.omit (which produces a complete-case analysis) is the defaul

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Matti Viljamaa
Writing: bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*lka+bs["kouluB:clka"]*clka i.e. without that being inside curve produces a vector of length 375. So now it seems that curve() is really skipping some lka-/x-values. > On 25 Sep 2016, at 16:01, Matti Viljamaa wrote: > > I’m trying

Re: [R] How to add overall xlabel and ylabel?

2016-09-25 Thread Ben Tupper
Hi, Here's a place to start... https://www.r-bloggers.com/two-tips-adding-title-for-graph-with-multiple-plots-add-significance-asterix-onto-a-boxplot/ You might also want to checkout the text() function and the xpd argument to par. Ben > On Sep 25, 2016, at 7:51 AM, Matti Viljamaa wrote: > >

[R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Matti Viljamaa
I’m trying to plot regression lines using curve() The way I do it is: bs <- coef(fit2) and then for example: curve(bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*x+bs["kouluB:clka"]*clka, from=min(lka), to=max(lka), add=TRUE, col='red') This above code runs into error: Error in curve(

[R] How to add overall xlabel and ylabel?

2016-09-25 Thread Matti Viljamaa
I have created a 2x2 plot using par(mfrow = c(2, 2)). I can add x- and ylabels to individual plots, but what I want is to add overall xlabel and ylabel for the entire 2x2 plot. How to do this? __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and