相关疑难解决方法(0)

子集化的规则

拥有df1df2如下:

df1 <- read.table(text =" x y z
                          1 1 1
                          1 2 1
                          1 1 2
                          2 1 1
                          2 2 2",header=TRUE)

df2 <- read.table(text =" a b c
                          1 1 1
                          1 2 8
                          1 1 2
                          2 6 2",header=TRUE)
Run Code Online (Sandbox Code Playgroud)

我可以问一些数据如下的数据:

 df2[ df2$b == 6 | df2$c == 8 ,] #any rows where b=6 plus c=8 in df2
 #and additive conditions
 df2[ df2$b == 6 & df2$c == 8 ,] # zero rows
Run Code Online (Sandbox Code Playgroud)

data.frame之间: …

r

5
推荐指数
1
解决办法
1518
查看次数

标签 统计

r ×1