r - 为特定列的每一行添加引号
问题描述
具有这种格式的数据框:
data.frame(id = c(4,2), text = c("my text here", "another text here"))
如何在文本列中每个值/行的开头和结尾添加三重引号。预期的打印输出:
id text 4 """my text here""" 2 """another text here"""
解决方案
没有paste
也不cat
/paste
你可以简单地运行:
data.frame(id = c(4,2), text = c('"""my text here"""', '"""another text here"""'))
id text
1 4 """my text here"""
2 2 """another text here"""
推荐阅读
- ios - Swift - IOS,Spring:使用 StompClientLib 和 Spring 发送和接收 STOMP 消息的问题
- linux - Windows 上的 Linux 容器 (LCOW) 功能与在 Windows 上运行 Linux VM
- angular - Angular.json 脚本未加载
- c# - VS 显示不在 csproj 文件中的引用
- python - 在 Python 中创建 Singleton 类并计算实例数
- php - 用php循环html表中的行
- asp.net-core-2.1 - vs2017中asp.net core项目如何禁用SSL?
- docker - 没有得到任何同行的有效响应。尝试“网络启动”时出错
- java - 使用 netbeans 将数据插入数据库表
- datetime - 将 UTC ISO 字符串日期转换为 Unix 时间戳