R 如何根据二元标准(性别)分离数据表?

R 如何根据二元标准(性别)分离数据表?,r,R,我是新到R的,我有这个数据集(),需要画出脚的宽度(y轴)和长度(x轴),但区分性别 已将其解读为: kidsfeet <- read.table("http://www.amstat.org/publications/jse/datasets/kidsfeet.dat.txt") names(kidsfeet) <- c("month","year","length","width","sex","foot","hand") kidsfeetkidsfeet您可以按性别绘制它们:

我是新到R的,我有这个数据集(),需要画出脚的宽度(y轴)和长度(x轴),但区分性别

已将其解读为:

kidsfeet <- read.table("http://www.amstat.org/publications/jse/datasets/kidsfeet.dat.txt")
names(kidsfeet) <- c("month","year","length","width","sex","foot","hand")

kidsfeet
kidsfeet您可以按性别绘制它们:

library(ggplot2)
ggplot(kidsfeet, aes(x = length, y = width)) + geom_line() + facet_grid(sex ~ .)

谢谢您!我来试试,谢谢!我要试一试。
library(ggplot2)
ggplot(kidsfeet, aes(x = length, y = width)) + geom_line() + facet_grid(sex ~ .)