【发布时间】:2017-07-14 11:06:58
【问题描述】:
我有两个数据框,但问题是合并“按”列在不同情况下具有值。
sn1capx1e0001 与 SN1CAPX1E0001。
authors <- data.frame(
surname = I(c("Tukey", "Venables", "Tierney", "Ripley", "McNeil")),
nationality = c("US", "Australia", "US", "UK", "Australia"),
deceased = c("yes", rep("no", 4)))
books <- data.frame(
name = I(c("tukey", "venables", "tierney",
"tipley", "ripley", "McNeil", "R Core")),
title = c("Exploratory Data Analysis",
"Modern Applied Statistics ...",
"LISP-STAT",
"Spatial Statistics", "Stochastic Simulation",
"Interactive Data Analysis",
"An Introduction to R"),
other.author = c(NA, "Ripley", NA, NA, NA, NA,
"Venables & Smith"))
m1 <- merge(authors, books, by.x = "surname", by.y = "name")
给予
姓国籍已故头衔其他作者
McNeil 澳大利亚没有交互式数据分析 NA
所以我想通过不区分大小写来合并它们。我无法使用合并或加入。
我看到我们可以使用正则表达式通过循环来匹配值。
【问题讨论】:
标签: r