r - 忽略逗号作为 csv 文件中的千位分隔符
问题描述
我有一些具有多行的数据集,如下面的 data.fraedf
所示。
最终,我真的需要字符串末尾的整数,在双引号之外的逗号之后。但是逗号作为千位分隔符似乎确实使事情复杂化。
保存每个计数的行标签会很有用(即 5,000 美元 - 9,999 美元),但我可以不这样做。
下面的代码返回同一列中的行标签和计数。
谢谢
library(tidyverse)
text<-'"Text / some other text / some other text / $5,000-$9,999", 10,000.00'
df<-data.frame(text=text)
df %>%
separate(., text, into=c('a', 'b', 'c', 'd'), sep='/')
解决方案
像这样一秒钟怎么separate
样?
df %>%
separate(., text, into=c('a', 'b', 'c', 'd'), sep='/') %>%
separate(d, into = c("d", "e"), sep = "\", ")
推荐阅读
- node.js - Azure 节点 expressjs 应用程序随机崩溃而没有错误
- php - 将尾部斜杠添加到 URL 时出现内部服务器错误
- c# - REST API 的版本控制格式
- django - 如何使用 Django 发送带有粗体字符串的电子邮件
- c# - OracleManaged.DataAcess 导致 ORA-12154:TNS:无法解析指定的连接标识符
- binding - VsCode - 绑定键盘键以水平滚动
- javascript - Nodejs + API 休息结构
- mysql - 使用 INET_ATON 时的 MySQL 性能问题
- asp.net-core - NuGet 包 XML 文档在 .NET Core 2.2 应用程序中不可见
- android - 无法使用蓝牙 LE 设备录制音频