Hi
r-help-bounces at r-project.org napsal dne 18.08.2009 14:32:43:
> Hi,
>
> Actually, i use the function merge like this:
>
> (Data1 <- Data1[1:7,1:3])
> Policy.Number AXA.Entity Country
> 1 1060000077 BNL BNL
> 2 4001023 CH BNL
> 3 1060000006 UK BNL
> 4 4001025 CH BNL
> 5 6.00E+13 USA BNL
> 6 6100001 UK BNL
> 7 4001028 USA BNL
> > Data2 <- read.csv2("c:/GWPMax1.csv",sep=",")
> > (Data2 <- Data2[1:7,1:2])
> Policy.Number GWP_Max
> 1 4001023 500.00
> 2 4001024 10593.54
> 3 4001025 700.00
> 4 4001026 0.00
> 5 4001027 3621.25
> 6 4001028 600.00
> 7 4001029 7588.27
> > (m <- merge(Data1,Data2, by.x = "Policy.Number",by.y =
"Policy.Number"))> Policy.Number AXA.Entity Country GWP_Max
> 1 4001023 CH BNL 500.00
> 2 4001025 CH BNL 700.00
> 3 4001028 USA BNL 600.00
>
> i need the number of records not matching between the two original data
bases.>
> Can you help me please?
Look at functions setdif or %in%
> set.seed(111)
> dat1 <- sample(10000:10100, 20)
> dat2 <- sample(10000:10100, 20)
> setdiff(dat1,dat2)
[1] 10059 10072 10036 10050 10098 10040 10001 10097 10095 10008 10004
10013 10038 10014 10081 10025 10090> intersect(dat1,dat2)
[1] 10093 10053 10005
Regards
Petr
>
> thank you a lot!!
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.