Re: [R] Plot a line using ggplot2
A number of problems. The variable names are not helpful. PointEstx is not a point it is a value. I need an x and a y coordinate for a point. row1 is not defined While there is a function data.frame(), there is no data_frame(). Making this change gives an error that row1 is not defined. I solved the problem with row1<-row2+1. The ggplot statement looks wrong. Does this give you what you need? ggplot(linedata,aes(x=PointEstx, y=PointEsty)) + geom_line() Note I changed the comma to a plus sign and changed the brackets. Regards, Tim -Original Message- From: R-help On Behalf Of Sorkin, John Sent: Thursday, December 8, 2022 8:06 PM To: r-help@r-project.org (r-help@r-project.org) Subject: [R] Plot a line using ggplot2 [External Email] Colleagues, I am trying to plot a simple line using ggplot2. I get the axes, but I don't get the line. Please let me know what my error I am making. Thank you, John # Define x and y values PointEstx <- Estx+1.96*SE PointEsty <- 1 row2 <- cbind(PointEstx,PointEsty) linedata<- data_frame(rbind(row1,row2)) linedata # make sure we have a data frame class(linedata) #plot the data ggplot(linedata,aes(x=PointEstx, y=PointEsty), geom_line()) __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-helpdata=05%7C01%7Ctebert%40ufl.edu%7C5695e850b24347d9fcf908dad9818f28%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638061447740857132%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=KhRB4ZHKsoVlPRsAnufXXzfiJyRBEEv32P7bcAAiGBo%3Dreserved=0 PLEASE do read the posting guide https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.htmldata=05%7C01%7Ctebert%40ufl.edu%7C5695e850b24347d9fcf908dad9818f28%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638061447740857132%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7Csdata=DPlvmxCIwlF1WqKWawzSmJbosiFGjnLwFIMKK7hFAco%3Dreserved=0 and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Plot a line using ggplot2
Please run your code before you send it. Your example is not reproducible. library(ggplot2) linedata<- data.frame( PointEstx = c( 1, 2 ) , PointEsty = c( 1, 1.5 ) ) # make sure we have a data frame str(linedata) #plot the data ggplot( linedata , aes( x = PointEstx , y = PointEsty ) ) + geom_line() On December 8, 2022 5:05:47 PM PST, "Sorkin, John" wrote: >Colleagues, > >I am trying to plot a simple line using ggplot2. I get the axes, but I don't >get the line. Please let me know what my error I am making. >Thank you, >John > ># Define x and y values >PointEstx <- Estx+1.96*SE >PointEsty <- 1 > >row2 <- cbind(PointEstx,PointEsty) >linedata<- data_frame(rbind(row1,row2)) >linedata ># make sure we have a data frame >class(linedata) > >#plot the data >ggplot(linedata,aes(x=PointEstx, y=PointEsty), geom_line()) > > > > > >__ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >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. -- Sent from my phone. Please excuse my brevity. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 access source code
Or simply get and unpack the package sources. Here you will also find the comments that are typically stripped out otherwise. Best, Uwe Ligges On 08.12.2022 17:26, Martin Morgan wrote: showMethods(LGD, includeDef = TRUE) shows the implementation of all methods on the LGD generic, and can be a useful fast track to getting an overview of what is going on. Martin Morgan From: R-help on behalf of Ivan Krylov Date: Thursday, December 8, 2022 at 11:23 AM To: Christofer Bogaso Cc: r-help Subject: Re: [R] How to access source code � Thu, 8 Dec 2022 20:56:12 +0530 Christofer Bogaso �: showMethods(LGD) Function: LGD (package GCPM) this="GCPM" Almost there! Try getMethod(LGD, signature = 'GCPM'). Not sure if this is going to work as written, but if you need to see an S4 method definition, getMethod is the way. -- Best regards, Ivan __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Plot a line using ggplot2
Colleagues, I am trying to plot a simple line using ggplot2. I get the axes, but I don't get the line. Please let me know what my error I am making. Thank you, John # Define x and y values PointEstx <- Estx+1.96*SE PointEsty <- 1 row2 <- cbind(PointEstx,PointEsty) linedata<- data_frame(rbind(row1,row2)) linedata # make sure we have a data frame class(linedata) #plot the data ggplot(linedata,aes(x=PointEstx, y=PointEsty), geom_line()) __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 access source code
showMethods(LGD, includeDef = TRUE) shows the implementation of all methods on the LGD generic, and can be a useful fast track to getting an overview of what is going on. Martin Morgan From: R-help on behalf of Ivan Krylov Date: Thursday, December 8, 2022 at 11:23 AM To: Christofer Bogaso Cc: r-help Subject: Re: [R] How to access source code � Thu, 8 Dec 2022 20:56:12 +0530 Christofer Bogaso �: > > showMethods(LGD) > > Function: LGD (package GCPM) > > this="GCPM" Almost there! Try getMethod(LGD, signature = 'GCPM'). Not sure if this is going to work as written, but if you need to see an S4 method definition, getMethod is the way. -- Best regards, Ivan __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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 access source code
В Thu, 8 Dec 2022 20:56:12 +0530 Christofer Bogaso пишет: > > showMethods(LGD) > > Function: LGD (package GCPM) > > this="GCPM" Almost there! Try getMethod(LGD, signature = 'GCPM'). Not sure if this is going to work as written, but if you need to see an S4 method definition, getMethod is the way. -- Best regards, Ivan __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 access source code
Hi, I am trying to access the source code from package GCPM, where I am interested to look into the source code of one function called LGD. So I did below > LGD standardGeneric for "LGD" defined from package "GCPM" function (this) standardGeneric("LGD") Methods may be defined for arguments: this Use showMethods(LGD) for currently available ones. > showMethods(LGD) Function: LGD (package GCPM) this="GCPM" However I still could not find the source code using above approach. It would be very helpful if you can help to find the complete source code of this function. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.