如何在R中制作有条件的GGPLOT?
我有大约 40 个变量,所有产品。所有类别都是“是”或“否”。然后将它们链接到低、中或高的评级。
我的目标是制作每个标记为“是”的产品的评分的彩色散点图。
可重现的示例:
tab <- 矩阵(c('kmart',"y", "y", "n","low", 'target', "n", "n", "n","moderate" ,'bigw',"y","y","y","high"), ncol=5, byrow=TRUE)
colnames(tab) <- c('shop','dress','skirt','shoes',' rating')
我需要一个散点图,其 y 轴上有评级,根据产品着色。仅当类别部分中有“是”时,这些点才会显示。
谢谢你!
I have around 40 variables, all products. The categories for all are either yes or no. They then link up to a rating of either low, medium or high.
My aim is to make a colored scatterplot of the ratings of each of the products that are marked yes.
reproducible example:
tab <- matrix(c('kmart',"y", "y", "n","low", 'target', "n", "n", "n","moderate",'bigw',"y", "y", "y","high"), ncol=5, byrow=TRUE)
colnames(tab) <- c('shop','dress','skirt','shoes','rating')
I need a scatterplot with the rating on the y axis, coloured based on the product. the dots will only show up when there is a yes in the category section.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的意思是这样的吗?
Do you mean something like this?