BR_email
2017-Apr-01 19:13 UTC
[R] How can I delete column yhat AND STILL retain the order of Response?
Rui: Thanks. I will try it. FYI: I did attached the data, but here it is re-attached. Thanks, again. Bruce Bruce Ratner, Ph.D. The Significant Statistician? (516) 791-3544 Statistical Predictive Analtyics -- www.DMSTAT1.com Machine-Learning Data Mining and Modeling -- www.GenIQ.net Rui Barradas wrote:> Hello, > > 1) We don't have access to your file firstRdata.csv so what I'll say > is just an untested guess. You can post some of your data with the > following R command. > > dput(head(Response, 20)) # paste the output of this in a mail > > 2) First you use read.csv that outputs a data.frame and then do > data.frame(Response). Useless. Response already is a df. > > 3) I believe the trouble you're facing comes from your use of > attach(). This function is _never_ needed and is cause of all sorts of > bugs. In particular, what you are ordering is the attached copy of > Response, and all changes you do to it will only have effect on the > copy. The original is left as it were. > > So run the same code (with the obvious bug yhatResponse$yhat > corrected) but eliminating the 'attach' instruction. And see if it > reorders Response. > > Hope this helps, > > Rui Barradas > > > Em 01-04-2017 17:32, BR_email escreveu: >> Response <- read.csv("C:/R_Data/firstRdata.csv", sep=",", >> header=TRUE) >> Response >> Response <- data.frame(Response) >> attach(Response) >> Response >> Response <- Response[order(-yhat),] >> Response <- Response[rev(order(yhatResponse$yhat)),] >> Response > > >
Jeff Newmiller
2017-Apr-01 19:37 UTC
[R] How can I delete column yhat AND STILL retain the order of Response?
Eventually you will think to read the Posting Guide, which discusses which attachments are likely to be allowed on the mailing list. Most users find that pasting a minimal amount of data into the main body of the email is the simplest way to be sure the info will get through to someone who can help. -- Sent from my phone. Please excuse my brevity. On April 1, 2017 12:13:56 PM PDT, BR_email <br at dmstat1.com> wrote:>Rui: >Thanks. I will try it. >FYI: I did attached the data, but here it is re-attached. > >Thanks, again. >Bruce > >Bruce Ratner, Ph.D. >The Significant Statistician? >(516) 791-3544 >Statistical Predictive Analtyics -- www.DMSTAT1.com >Machine-Learning Data Mining and Modeling -- www.GenIQ.net > > >Rui Barradas wrote: >> Hello, >> >> 1) We don't have access to your file firstRdata.csv so what I'll say >> is just an untested guess. You can post some of your data with the >> following R command. >> >> dput(head(Response, 20)) # paste the output of this in a mail >> >> 2) First you use read.csv that outputs a data.frame and then do >> data.frame(Response). Useless. Response already is a df. >> >> 3) I believe the trouble you're facing comes from your use of >> attach(). This function is _never_ needed and is cause of all sorts >of >> bugs. In particular, what you are ordering is the attached copy of >> Response, and all changes you do to it will only have effect on the >> copy. The original is left as it were. >> >> So run the same code (with the obvious bug yhatResponse$yhat >> corrected) but eliminating the 'attach' instruction. And see if it >> reorders Response. >> >> Hope this helps, >> >> Rui Barradas >> >> >> Em 01-04-2017 17:32, BR_email escreveu: >>> Response <- read.csv("C:/R_Data/firstRdata.csv", sep=",", >>> header=TRUE) >>> Response >>> Response <- data.frame(Response) >>> attach(Response) >>> Response >>> Response <- Response[order(-yhat),] >>> Response <- Response[rev(order(yhatResponse$yhat)),] >>> Response >> >> >> > >______________________________________________ >R-help at 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.
Bruce Ratner PhD
2017-Apr-01 20:00 UTC
[R] How can I delete column yhat AND STILL retain the order of Response?
Jeff: Thanks for the info. Sorry for the misstep. Bruce ______________ Bruce Ratner PhD The Significant Statistician? (516) 791-3544 Statistical Predictive Analytics -- www.DMSTAT1.com Machine-Learning Data Mining -- www.GenIQ.net> On Apr 1, 2017, at 3:37 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: > > Eventually you will think to read the Posting Guide, which discusses which attachments are likely to be allowed on the mailing list. Most users find that pasting a minimal amount of data into the main body of the email is the simplest way to be sure the info will get through to someone who can help. > -- > Sent from my phone. Please excuse my brevity. > >> On April 1, 2017 12:13:56 PM PDT, BR_email <br at dmstat1.com> wrote: >> Rui: >> Thanks. I will try it. >> FYI: I did attached the data, but here it is re-attached. >> >> Thanks, again. >> Bruce >> >> Bruce Ratner, Ph.D. >> The Significant Statistician? >> (516) 791-3544 >> Statistical Predictive Analtyics -- www.DMSTAT1.com >> Machine-Learning Data Mining and Modeling -- www.GenIQ.net >> >> >> Rui Barradas wrote: >>> Hello, >>> >>> 1) We don't have access to your file firstRdata.csv so what I'll say >>> is just an untested guess. You can post some of your data with the >>> following R command. >>> >>> dput(head(Response, 20)) # paste the output of this in a mail >>> >>> 2) First you use read.csv that outputs a data.frame and then do >>> data.frame(Response). Useless. Response already is a df. >>> >>> 3) I believe the trouble you're facing comes from your use of >>> attach(). This function is _never_ needed and is cause of all sorts >> of >>> bugs. In particular, what you are ordering is the attached copy of >>> Response, and all changes you do to it will only have effect on the >>> copy. The original is left as it were. >>> >>> So run the same code (with the obvious bug yhatResponse$yhat >>> corrected) but eliminating the 'attach' instruction. And see if it >>> reorders Response. >>> >>> Hope this helps, >>> >>> Rui Barradas >>> >>> >>> Em 01-04-2017 17:32, BR_email escreveu: >>>> Response <- read.csv("C:/R_Data/firstRdata.csv", sep=",", >>>> header=TRUE) >>>> Response >>>> Response <- data.frame(Response) >>>> attach(Response) >>>> Response >>>> Response <- Response[order(-yhat),] >>>> Response <- Response[rev(order(yhatResponse$yhat)),] >>>> Response >>> >>> >>> >> >> ______________________________________________ >> R-help at 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. >