Displaying 4 results from an estimated 4 matches for "nodupkey".
2009 May 12
2
SAS PROC SORT nodupkey
Hi,
I have the following data and I would like to delete douple names, it is almost similar to SAS PROC SORT nodupkey! Is there any function in R does this?
x1 <- rnorm(11,5,1)
x2 <- runif(11,0,1)
nam <-paste("A", c(1:4,4,5:9,9), sep=".")
mydata <- data.frame(x1,x2)
crownames(mydata) <- nam
Many thanks in advance,
Amor
[[alternative HTML version deleted]]
2011 Feb 28
3
Problems using unique function and !duplicated
Hi, I am trying to simultaneously remove duplicate variables from two or more
variables in a small R data.frame. I am trying to reproduce the SAS
statements from a Proc Sort with Nodupkey for those familiar with SAS.
Here's my example data :
test <- read.csv("test.csv", sep=",", as.is=TRUE)
> test
date var1 var2 num1 num2
1 28/01/11 a 1 213 71
2 28/01/11 b 1 141 47
3 28/01/11 c 2 867 289
4 29/01/11 a 2 234 78...
2006 Jan 10
1
Find last row (observation) for each combination of variables
...4 7 34567
2 4 7 45678
and I want the last row for each unique combination of A/B/C, where by "last" I mean greatest TS.
A B C TS other columns
1 1 1 56789
1 2 1 23456
1 2 2 23457
2 4 7 45678
I did this simply in SAS:
proc sort data=DF;
by A B C descending TS
run;
proc sort data=DF NODUPKEY;
by A B C;
run;
I tried using "aggregate" to find the maximum TS for each combination of A/B/C, but it's slow.
I also tried "by" but it's also slow.
My current (faster) solution is:
DF$abc<-paste(DF$A,DF$B,DF$C,sep="")
abclist<-unique(DF$ABC)
num...
2012 Aug 29
2
Deduping in R by multiple variables
I have a dataset w/ 184K obs & 16 variables. In SAS I proc sort nodupkey it
in seconds by 11 variables.
I tried to do the same thing in R using both the unique & then the
!duplicated functions but it just hangs there & I get no output. Does
anyone know how to solve this?
This is how I tried to do it in R:
detail3 <-
[!duplicated(c(detail2$TDATE,detail2$FI...