Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是初学者,谢谢你的帮助。R 代码将数据分成两组。权重 ≤ 10 个单位的观测子集,以及脑重 > 10 个单位的观测子集。听起来很简单,但对我来说很难,谢谢你的帮助。
如果weigth值在数据框 ( dat) 的列中,您可以使用以下命令:
weigth
dat
# subset with weight > 10 units dat[dat$weight > 10, ] # subset with weight <= 10 units dat[dat$weight <= 10, ]
或者,您可以生成一个包含两个数据框的列表:
split(dat, dat$weight > 10)