R中是否有一个函数可以修改数据框以查找和替换另一个特定的单词或字符?
如果我的数据框如下所示:
router.get("/user/:attributeName:value").handler(routingContext -> {
JsonObject query = new JsonObject();
query.put(routingContext.request().getParam("attributeName"), routingContext.request().getParam("value"));
我想修改它看起来像这样
attributeName
答案 0 :(得分:-1)
df <- data.frame(matrix(c(rep("this/and/that",5),rep("the other",5)),ncol=2))
df
X1 X2
1 this/and/that the other
2 this/and/that the other
3 this/and/that the other
4 this/and/that the other
5 this/and/that the other
data.frame(apply((df),MARGIN = 2,function(x){gsub("/","\\",x,fixed = TRUE)}),stringsAsFactors=FALSE)
X1 X2
1 this\\and\\that the other
2 this\\and\\that the other
3 this\\and\\that the other
4 this\\and\\that the other
5 this\\and\\that the other