Re: [R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread Rui Barradas
Hello, again. There was another error in the line in question. TRUE does not need quotes. In fact, with quotes you're comparing to a character string, not to a logical value. And the other tip still holds, use as follows in the complete and corrected line below. Health2PairsOnly <- PairIDs[

Re: [R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread Rui Barradas
Hello, That way of refering to variables can be troublesome. Try PairIDs[, "Pairiddups"] Hope this helps, Rui Barradas Em 27-09-2012 20:46, GradStudentDD escreveu: Hi, I have a data set of observations by either one person or a pair of people. I want to only keep the pair observations, and

Re: [R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread Simon Knapp
#By using cbind in: PairIDs<-cbind(PairID, PairIDDuplicates) #You create a numeric matrix (the logical #vector PairIDDuplicates gets converted #to numeric - note that your second column #contains 1s and 0s, not Trues and Falses). #Matricies are not subsetable using $, #they are basically a vector

[R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread GradStudentDD
Hi, I have a data set of observations by either one person or a pair of people. I want to only keep the pair observations, and was using the code below until it gave me the error " $ operator is invalid for atomic vectors". I am just beginning to learn R, so I apologize if the code is really rough