BR_email
2017-Mar-29 22:14 UTC
[R] I want to delete "yhat" and transpose "Response" into a vector
Hi R'ers: I need a little help. Thanks in advance. Bruce dd <- read.csv("C:/R_Data/firstRdata.csv", sep=",", header=TRUE) dd <- data.frame(yhat,Response) attach(dd) dd <- dd[order(-yhat),] dd # delete yhat and transpose Response into a vector Attached is dataset. -- Bruce
Duncan Murdoch
2017-Mar-29 22:29 UTC
[R] I want to delete "yhat" and transpose "Response" into a vector
On 29/03/2017 6:14 PM, BR_email wrote:> Hi R'ers: > I need a little help. > Thanks in advance. > Bruce > > dd <- read.csv("C:/R_Data/firstRdata.csv", sep=",", header=TRUE) > dd <- data.frame(yhat,Response) > attach(dd) > > dd <- dd[order(-yhat),] > dd > # delete yhat and transpose Response into a vectorSounds like a homework assignment. We don't do those. Duncan Murdoch
Jim Lemon
2017-Mar-29 22:33 UTC
[R] I want to delete "yhat" and transpose "Response" into a vector
Hi Bruce, Before we get into the whole business of why your CSV file is lying by the side of the road to the R help list, let's deal with a few more important things. 1) You have created a data frame "dd" by reading your CSV file (we hope). 2) You have then overwritten this with two vectors (?) of data. I looks very much like you have tried to do this with two columns of the first "dd". As you haven't specified that these belong to "dd', it is likely that the two vectors were already defined in the environment in which you did this. 3) OR you have already attached "dd" previously and that prevented the error that would have been generated in 2. 4) You have then reordered 'dd' with the _negative_ values of yhat. 5) You then asked us how to delete the "yhat" column: dd<-dd[,-which(names(dd)=="yhat")] and transpose (! - I think you mean "transform") Response into a vector: transform: dd$Response Jim On Thu, Mar 30, 2017 at 9:14 AM, BR_email <br at dmstat1.com> wrote:> Hi R'ers: > I need a little help. > Thanks in advance. > Bruce > > dd <- read.csv("C:/R_Data/firstRdata.csv", sep=",", header=TRUE) > dd <- data.frame(yhat,Response) > attach(dd) > > dd <- dd[order(-yhat),] > dd > # delete yhat and transpose Response into a vector > Attached is dataset. > > -- > Bruce > > ______________________________________________ > 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-Mar-29 22:39 UTC
[R] I want to delete "yhat" and transpose "Response" into a vector
Duncan, it's not a homework assignment. Jim, thank you. Bruce ______________ Bruce Ratner PhD The Significant Statistician? (516) 791-3544 Statistical Predictive Analytics -- www.DMSTAT1.com Machine-Learning Data Mining -- www.GenIQ.net> On Mar 29, 2017, at 6:29 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > > Duncan
Bruce Ratner PhD
2017-Mar-29 22:43 UTC
[R] I want to delete "yhat" and transpose "Response" into a vector
Duncan, it's not a homework assignment. Thanks. Bruce ______________> On Mar 29, 2017, at 6:29 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > >> On 29/03/2017 6:14 PM, BR_email wrote: >> Hi R'ers: >> I need a little help. >> Thanks in advance. >> Bruce >> >> dd <- read.csv("C:/R_Data/firstRdata.csv", sep=",", header=TRUE) >> dd <- data.frame(yhat,Response) >> attach(dd) >> >> dd <- dd[order(-yhat),] >> dd >> # delete yhat and transpose Response into a vector > > Sounds like a homework assignment. We don't do those. > > Duncan Murdoch > >