本文介绍了筛选器功能dplyr似乎不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我在R-Studio中加载了一个名为exprCore1的data.fram,df如下所示:
Let's presume I have a data.fram called exprCore1 loaded in R-Studio, the df looks like this:
measure qid value 1 p5 1 0.2 2 p100 1 0.8 3 map 1 0.22 4 p5 2 0.4 5 p100 2 0.5 6 map 2 0.32基本上,所有需要的都是测量方法为"map"的每一列.
Basically all want is every column in which the measurement method is "map".
我尝试了不同的方法,所有这些方法仅返回不带内容的0x4小标题.
I tried different approaches, all of them just return only a 0x4 tibble without content.
到目前为止我尝试过的:
What I tried so far:
library("dplyr", lib.loc="~/R/win-library/3.4") exprCore1MapOverall <- dplyr::filter(exprCore1, measure == "map")这只会返回:
# A tibble: 0 x 4 # ... with 4 variables: measure <chr>, queryID <chr>, value <dbl>, coreTag <chr>我在这里想念什么?谁能帮我?
What am I missing here? Can anyone help me?
谢谢
也尝试过
exprCore1MapOverall <-filter(exprCore1, measure %in%c("map"))Edit2:
我无法发布整个data.frame,也无法发布大量数据.我用
I cant post the whole data.frame, way to much data. I shrunk it using
exprCore1Fixed <- exprCore1[-c(30: 142082),]这是exprCore1Fixed的输出
Here is the dput of exprCore1Fixed
structure(list(measure = c("num_ret ", "num_rel ", "num_rel_ret ", "map ", "R-prec ", "bpref ", "recip_rank ", "ircl_prn.0.00 ", "ircl_prn.0.10 ", "ircl_prn.0.20 ", "ircl_prn.0.30 ", "ircl_prn.0.40 ", "ircl_prn.0.50 ", "ircl_prn.0.60 ", "ircl_prn.0.70 ", "ircl_prn.0.80 ", "ircl_prn.0.90 ", "ircl_prn.1.00 ", "P5 ", "P10 ", "P15 ", "P20 ", "P30 ", "P100 ", "P200 ", "P500 ", "P1000 ", "num_ret ", "num_rel ", "ircl_prn.0.70 ", "ircl_prn.0.80 ", "ircl_prn.0.90 ", "ircl_prn.1.00 ", "P5 ", "P10 ", "P15 ", "P20 ", "P30 ", "P100 ", "P200 ", "P500 ", "P1000 " ), queryID = c("1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2", "2", "all", "all", "all", "all", "all", "all", "all", "all", "all", "all", "all", "all", "all"), value = c(752, 5, 4, 0.1089, 0.2, 0.8, 0.25, 0.25, 0.25, 0.25, 0.1429, 0.1429, 0.1429, 0.1429, 0.0342, 0.0342, 0, 0, 0.2, 0.1, 0.0667, 0.1, 0.1, 0.03, 0.02, 0.008, 0.004, 2, 3, 0.0696, 0.0565, 0.0374, 0.0345, 0.25, 0.1962, 0.1718, 0.151, 0.1192, 0.0525, 0.0335, 0.0164, 0.0097), coreTag = c("Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1", "Core_1")), .Names = c("measure", "queryID", "value", "coreTag"), row.names = c(NA, -42L), class = c("tbl_df", "tbl", "data.frame")) 推荐答案使用
dplyr::filter(exprCore1, trimws(measure) == "map")成功了,非常感谢.
更多推荐
筛选器功能dplyr似乎不起作用
发布评论