Natalie O'Toole
2008-Oct-23 17:09 UTC
[R] code works in R desktop but not iin RWeb - I got it working
Hi, I got this working. i had to get rid of an underscore in one of my variable names to work on RWeb. Thanks for your help though!! Natalie __________________ I think you have to be either honest or careful, since the code you submitted to Rweb is different with your former code! Why the condition was changed from "test<-subset(X, GRADE == 7 & Y_Q10A < 9)" to "test<-subset(X, PROV==48 & GRADE == 7 & Y_Q10A < 9)"? By the way, please read the post guide -- I have no way to reproduce your result. Regards, Yihui -- Yihui Xie <xieyihui@gmail.com> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China On Wed, Oct 22, 2008 at 11:15 PM, Natalie O'Toole <notoole@mtroyal.ca> wrote:> > Hi Yihui, > > Thank-you for this information. This is the code I am entering into RWeb > after loading my data file: > > #subset the file to only include certain values: > > test<-subset(X, GRADE == 7 & Y_Q10A < 9) > > #sort the data by province and the variable Y_Q10A > > mydata<-test > > mydataSorted<-mydata[ order(mydata$PROV,mydata$Y_Q10A), ] > > #Weight the data and aggregate it by province and Y_Q10A > > myag<-aggregate(mydataSorted$WTPP, > by=list(mydataSorted$PROV,mydataSorted$Y_Q10A), FUN=sum, na.rm=TRUE) > > #print the aggregated data > > print(myag) > > _ > This does not work. RWeb does not show any results. Here is the responseI> am getting from RWeb: > > Rweb:> postscript(file= "/tmp/Rout.11012.%03d.ps", onefile=FALSE) > Rweb:> X <- read.table("/tmp/Rdata.11012.data", header=T) > Rweb:> attach(X) > Rweb:> names(X) > [1] "PUMFID" "PROV" "REGION" "GRADE" "Y.Q10A" "WTPP" > Rweb:> > Rweb:> > Rweb:> test<-subset(X, PROV==48 & GRADE == 7 & Y_Q10A < 9) > > How can I modify my code above to get it to work in RWeb, please? > > Thanks, > > Nat >------------------------------------------------------------------------------------------------------------------------ This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal, and or privileged information. Please contact the sender immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted or destroyed. ------------------------------------------------------------------------------------------------------------------------ This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal, and or privileged information. Please contact the sender immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted or destroyed. ------------------------------------------------------------------------------------------------------------------------ This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal, and or privileged information. Please contact the sender immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted or destroyed. [[alternative HTML version deleted]]
Gabor Grothendieck
2008-Oct-23 17:49 UTC
[R] code works in R desktop but not iin RWeb - I got it working
If the RWeb server you are referring to is the one at montana then its running a version of R that is 5 years old. At that time the underscore was a synonym for <- in R but that was discontinued some time since then. With a version of R that old there could be quite a few other differences as well. On Thu, Oct 23, 2008 at 1:09 PM, Natalie O'Toole <notoole at mtroyal.ca> wrote:> Hi, > > I got this working. i had to get rid of an underscore in one of my > variable names to work on RWeb. > > Thanks for your help though!! > > Natalie > > __________________ > > > I think you have to be either honest or careful, since the code you > submitted to Rweb is different with your former code! Why the > condition was changed from "test<-subset(X, GRADE == 7 & Y_Q10A < 9)" > to "test<-subset(X, PROV==48 & GRADE == 7 & Y_Q10A < 9)"? > > By the way, please read the post guide -- I have no way to reproduce > your result. > > Regards, > Yihui > -- > Yihui Xie <xieyihui at gmail.com> > Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 > Mobile: +86-15810805877 > Homepage: http://www.yihui.name > School of Statistics, Room 1037, Mingde Main Building, > Renmin University of China, Beijing, 100872, China > > > > On Wed, Oct 22, 2008 at 11:15 PM, Natalie O'Toole <notoole at mtroyal.ca> > wrote: >> >> Hi Yihui, >> >> Thank-you for this information. This is the code I am entering into RWeb >> after loading my data file: >> >> #subset the file to only include certain values: >> >> test<-subset(X, GRADE == 7 & Y_Q10A < 9) >> >> #sort the data by province and the variable Y_Q10A >> >> mydata<-test >> >> mydataSorted<-mydata[ order(mydata$PROV,mydata$Y_Q10A), ] >> >> #Weight the data and aggregate it by province and Y_Q10A >> >> myag<-aggregate(mydataSorted$WTPP, >> by=list(mydataSorted$PROV,mydataSorted$Y_Q10A), FUN=sum, na.rm=TRUE) >> >> #print the aggregated data >> >> print(myag) >> >> _ >> This does not work. RWeb does not show any results. Here is the response > I >> am getting from RWeb: >> >> Rweb:> postscript(file= "/tmp/Rout.11012.%03d.ps", onefile=FALSE) >> Rweb:> X <- read.table("/tmp/Rdata.11012.data", header=T) >> Rweb:> attach(X) >> Rweb:> names(X) >> [1] "PUMFID" "PROV" "REGION" "GRADE" "Y.Q10A" "WTPP" >> Rweb:> >> Rweb:> >> Rweb:> test<-subset(X, PROV==48 & GRADE == 7 & Y_Q10A < 9) >> >> How can I modify my code above to get it to work in RWeb, please? >> >> Thanks, >> >> Nat >> > > > > ------------------------------------------------------------------------------------------------------------------------ > > This communication is intended for the use of the recipient to which it is > addressed, and may > contain confidential, personal, and or privileged information. Please > contact the sender > immediately if you are not the intended recipient of this communication, > and do not copy, > distribute, or take action relying on it. Any communication received in > error, or subsequent > reply, should be deleted or destroyed. > > > ------------------------------------------------------------------------------------------------------------------------ > > This communication is intended for the use of the recipient to which it is > addressed, and may > contain confidential, personal, and or privileged information. Please > contact the sender > immediately if you are not the intended recipient of this communication, > and do not copy, > distribute, or take action relying on it. Any communication received in > error, or subsequent > reply, should be deleted or destroyed. > ------------------------------------------------------------------------------------------------------------------------ > This communication is intended for the use of the recipient to which it is addressed, and may > contain confidential, personal, and or privileged information. Please contact the sender > immediately if you are not the intended recipient of this communication, and do not copy, > distribute, or take action relying on it. Any communication received in error, or subsequent > reply, should be deleted or destroyed. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >