我有一个看起来像这样的函数:
removeRows <- function(dataframe, rows.remove){
dataframe <- dataframe[-rows.remove,]
print(paste("The", paste0(rows.remove, "th"), "row was removed from", "xxxxxxx"))
}
我可以使用这样的函数从数据框中删除第 5 行:
removeRows(mtcars, 5)
该函数输出此消息:
"The 5th row was removed from xxxxxxx"
如何将 xxxxxxx 替换为我使用过的数据框的名称,所以在这种情况下mtcars
?