gpt4 book ai didi

linux - 如何根据 R 中的条件使用不同的标记( 'x' 和 'o')进行绘图

转载 作者:太空狗 更新时间:2023-10-29 11:24:56 26 4
gpt4 key购买 nike

我有一个看起来像这样的数据:

for_y_axis <-c(0.49534,0.80796,0.93970,0.99998)
for_x_axis <-c(1,2,3,4)
count <-c(0,33,0,4)

我想做的是使用 for_x_axisfor_y_axis 绘制图表但如果 count 值等于 0(零)并且如果 count 值大于零,则使用“x”。

有没有一种简单的方法可以在 R 中实现这一点?

最佳答案

plot(for_x_axis, for_y_axis, pch = ifelse(count > 0, "x", "o"))

关于linux - 如何根据 R 中的条件使用不同的标记( 'x' 和 'o')进行绘图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3183596/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com