Re: [R] nls, lattice, and conversion over to ggplot
I just got it and it works wonderfully. thank you both for your help Stephen On Fri, Oct 10, 2008 at 4:01 AM, baptiste auguie <[EMAIL PROTECTED]> wrote: > It worked for me, do you have the latest version of ggplot2 released a few > days ago (ggplot2_0.7) ? > > Baptiste > > On 9 Oct 2008, at 20:55, stephen sefick wrote: > >> Error in `[.data.frame`(df, , var) : undefined columns selected >> >> I got this error in a fresh R session after rerunning all of the commands >> >> On Thu, Oct 9, 2008 at 3:45 PM, hadley wickham <[EMAIL PROTECTED]> >> wrote: >> >>> On Thu, Oct 9, 2008 at 2:29 PM, stephen sefick <[EMAIL PROTECTED]> wrote: I am trying to figure out how to use ggplot2. I would like to do the >>> >>> below with ggplot, but I can not figure out how. The data provided is a subset >>> >>> of a much larger data set, but these data are the data necessary to make the plot. I think I would rather have the colors become symbols, and I do >>> >>> know how to do that in lattice, but here is a quick and dirty version. thanks >>> >>> Here's one way: >>> >>> pred <- data.frame(GPP = f, TSS = y) >>> qplot(TSS, GPP, data=r, colour=RiverMile) + >>> geom_line(data=pred, colour ="black") >>> >>> * ggplot2 works with data frames, so the key is to create one from >>> your model predictions. Naming the variables to match the names of >>> the model inputs makes sense, and saves some typing. >>> >>> * You no longer need to specify xlim because ggplot2 knows about >>> everything you are plotting and can calculate the limits >>> appropriately. >>> >>> * You have have to manually set the colour in geom_line to override >>> the default mapping that you created between colour and RiverMile. >>> >>> Hadley >>> >>> -- >>> http://had.co.nz/ >>> >> >> >> >> -- >> Stephen Sefick >> Research Scientist >> Southeastern Natural Sciences Academy >> >> Let's not spend our time and resources thinking about things that are so >> little or so large that all they really do for us is puff us up and make >> us >> feel like gods. We are mammals, and have not exhausted the annoying >> little >> problems of being mammals. >> >> -K. Mullis >> >> [[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. > > -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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, lattice, and conversion over to ggplot
It worked for me, do you have the latest version of ggplot2 released a few days ago (ggplot2_0.7) ? Baptiste On 9 Oct 2008, at 20:55, stephen sefick wrote: Error in `[.data.frame`(df, , var) : undefined columns selected I got this error in a fresh R session after rerunning all of the commands On Thu, Oct 9, 2008 at 3:45 PM, hadley wickham <[EMAIL PROTECTED]> wrote: On Thu, Oct 9, 2008 at 2:29 PM, stephen sefick <[EMAIL PROTECTED]> wrote: I am trying to figure out how to use ggplot2. I would like to do the below with ggplot, but I can not figure out how. The data provided is a subset of a much larger data set, but these data are the data necessary to make the plot. I think I would rather have the colors become symbols, and I do know how to do that in lattice, but here is a quick and dirty version. thanks Here's one way: pred <- data.frame(GPP = f, TSS = y) qplot(TSS, GPP, data=r, colour=RiverMile) + geom_line(data=pred, colour ="black") * ggplot2 works with data frames, so the key is to create one from your model predictions. Naming the variables to match the names of the model inputs makes sense, and saves some typing. * You no longer need to specify xlim because ggplot2 knows about everything you are plotting and can calculate the limits appropriately. * You have have to manually set the colour in geom_line to override the default mapping that you created between colour and RiverMile. Hadley -- http://had.co.nz/ -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis [[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] nls, lattice, and conversion over to ggplot
Error in `[.data.frame`(df, , var) : undefined columns selected I got this error in a fresh R session after rerunning all of the commands On Thu, Oct 9, 2008 at 3:45 PM, hadley wickham <[EMAIL PROTECTED]> wrote: > On Thu, Oct 9, 2008 at 2:29 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > > I am trying to figure out how to use ggplot2. I would like to do the > below > > with ggplot, but I can not figure out how. The data provided is a subset > of > > a much larger data set, but these data are the data necessary to make the > > plot. I think I would rather have the colors become symbols, and I do > know > > how to do that in lattice, but here is a quick and dirty version. > > thanks > > Here's one way: > > pred <- data.frame(GPP = f, TSS = y) > qplot(TSS, GPP, data=r, colour=RiverMile) + > geom_line(data=pred, colour ="black") > > * ggplot2 works with data frames, so the key is to create one from > your model predictions. Naming the variables to match the names of > the model inputs makes sense, and saves some typing. > > * You no longer need to specify xlim because ggplot2 knows about > everything you are plotting and can calculate the limits > appropriately. > > * You have have to manually set the colour in geom_line to override > the default mapping that you created between colour and RiverMile. > > Hadley > > -- > http://had.co.nz/ > -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis [[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] nls, lattice, and conversion over to ggplot
On Thu, Oct 9, 2008 at 2:29 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > I am trying to figure out how to use ggplot2. I would like to do the below > with ggplot, but I can not figure out how. The data provided is a subset of > a much larger data set, but these data are the data necessary to make the > plot. I think I would rather have the colors become symbols, and I do know > how to do that in lattice, but here is a quick and dirty version. > thanks Here's one way: pred <- data.frame(GPP = f, TSS = y) qplot(TSS, GPP, data=r, colour=RiverMile) + geom_line(data=pred, colour ="black") * ggplot2 works with data frames, so the key is to create one from your model predictions. Naming the variables to match the names of the model inputs makes sense, and saves some typing. * You no longer need to specify xlim because ggplot2 knows about everything you are plotting and can calculate the limits appropriately. * You have have to manually set the colour in geom_line to override the default mapping that you created between colour and RiverMile. 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.