-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path260323.R
More file actions
28 lines (22 loc) · 807 Bytes
/
Copy path260323.R
File metadata and controls
28 lines (22 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
authors <- data.frame(
surname = I(c("Tukey", "Venables", "Tierney", "Ripley", "McNeil")),
nationality = c("US", "Austrailia", "US", "UK", "Australia"))
books <- data.frame(
name = I(c("Tukey", "Venables", "Tierney", "Ripley", "McNeil")),
year = c(1976, 1995, 1996, 1998, 2000))
authors
books
d=merge(authors, books, by.x="surname", by.y="name")
d
authors <- data.frame(
surname = I(c("Tukey", "Venables", "Tierney", "Ripley", "McNeil")),
nationality = c("US", "Austrailia", "US", "UK", "Australia"))
books2 <- data.frame(
name = I(c("Tukey", "Venables", "Tierney", "Ripley", "McNeil", "Kim")),
year = c(1976, 1995, 1996, 1998, 2000, 2008))
authors
books2
d2 = merge(authors, books2, by.x="surname", by.y="name")
d2
d3 = merge(authors, books2, by.x="surname", by.y="name", all=TRUE)
d3