[R] I want to delete "yhat" and transpose "Response" into a vector
Jim Lemon
drjimlemon at gmail.com
Thu Mar 30 00:33:12 CEST 2017
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.
More information about the R-help
mailing list