选择CSV文件的特定列包含R中的特定字母
Using R to read a csv file.
Can anyone share with me how to select only columns end with _ct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Using R to read a csv file.
Can anyone share with me how to select only columns end with _ct?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
使用
readr :: read_csv()
您可以指定要选择哪些列(在dplyr :: select()中使用tidySelection nes tidyselection nes select()
。例如,如果我们要选择这些mtcars.csv
数据以字母d开头,我们可以执行以下在2022-07-07创建的 reprex软件包(v2.0.1)
Using
readr::read_csv()
you can specify which columns to select (using tidyselection as we use indplyr::select()
. For example if we want to select those column inmtcars.csv
data starts with letter d, we can do the followingCreated on 2022-07-07 by the reprex package (v2.0.1)
您可以使用 vroom软件包,例如
You can specify which columns you want to read into R from a csv file using the vroom package, e.g.
对于基本R解决方案,我们可以在此处使用
GREP
:For a base R solution, we can use
grep
here:end_with
dplyr
软件包中的功能是您想要的。The
ends_with
function indplyr
package is what you want.