Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 在同一列中绘制两个不同的数据集_R_Statistics_Rstudio_Graphing - Fatal编程技术网

R 在同一列中绘制两个不同的数据集

R 在同一列中绘制两个不同的数据集,r,statistics,rstudio,graphing,R,Statistics,Rstudio,Graphing,我有需要比较的数据,但两个不同组的值在同一列中(而不是按组的顺序) 例如: Price Group 1.0 S 2.5 N 0.00 N 3.00 S 以下是一些想法: GroupS = data[data$Group == "S",] GroupN = data[data$Group == "N",] split(data, data$Group) ggplot(data, aes(<x-variable>,

我有需要比较的数据,但两个不同组的值在同一列中(而不是按组的顺序)

例如:

Price     Group    
1.0        S
2.5        N
0.00       N
3.00       S
以下是一些想法:

GroupS = data[data$Group == "S",]
GroupN = data[data$Group == "N",]

split(data, data$Group)

ggplot(data, aes(<x-variable>, Price, color=Group)) + geom_point()
GroupS=data[data$Group==“S”,]
GroupN=data[data$Group==“N”,]
拆分(数据,数据$组)
ggplot(数据、aes(、价格、颜色=组))+geom_点()

@DavidArenburg我忘了用逗号,因为我习惯于使用data.table,而且我肯定没有加载ggplot库。你能解释一下这有多尴尬吗?