On Jul 21, 2010, at 5:33 AM, Mangalani Peter Makananisa wrote:
Dear "R Gurus",
I saw no reason to copy Rob Hyndman. I did not see that this involves
any of the packages he maintains.
I am having two dummy csv data sets A and B containing 19 and 15
cases/observations respectively. From the two data set 13 cases are
intersection. From one of the two (any) data set, How do I then
retrieve
the unmerged data ? let's take A for example, six cases must appear in
our results. See the R codes below.
?setdiff
Perhaps:
setdiff( (NAME(A), NAME(B) )
You can also do a merge that is an outer join that includes all the
NAME information and then extract the records with SALARY
and .B.SALARY data. Untested in absence of working example:
?merge
mer <- merge(A,B, all=TRUE)
mer[ mer$NAME %in% setdiff(NAME(A), NAME(B) ), ]
--
David.
A = read.csv("C:/Documents and Settings/S1033067/Desktop/A.csv",
header = TRUE, dec =",", sep = ",")
names(A)
[1] "NAME" "SALARY"
dim(A)[1]
[1] 19
B = read.csv("C:/Documents and Settings/S1033067/Desktop/B.csv",
header = TRUE, dec =",", sep = ",")
names(B)
[1] "NAME" "B.SALARY"
dim(B)[1]
[1] 15
common = merge(A,B)
names(common)
[1] "NAME" "SALARY" "B.SALARY"
dim(common)[1]
[1] 13
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
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.