我是R的新手,想知道如何在散点图上标记数据点.我尝试了以下代码,但我收到错误.
x = c(102856,17906,89697,74384,91081,52457,73749,29910,75604,28267,122136,
54210,48925,58937,76281,67789,69138,18026,90806,44893)
y = c(2818, 234, 2728, 2393, 2893, 1015, 1403, 791, 2243, 596, 2468, 1495,
1232, 1746, 2410, 1791, 1706, 259, 1982, 836)
plot(x, y, main="Scatterplot ", xlab="xaxis ", ylab="yaxis ", pch=19)
names = c("A","C","E","D","G","F","I","H","K","M","L","N","Q","P","S","R",
"T","W","V","Y")
library(calibrate)
textxy(x, y, labs=names, cx = 0.5, dcol = "black", m = c(0, 0))
Error in text.default(X[posXposY], Y[posXposY], labs[posXposY], adj = c(-0.3, :
plot.new has not been called yet
Run Code Online (Sandbox Code Playgroud)
我不明白这个错误.请帮我
我尝试使用abline函数在散点图上创建一个线性回归线.
x= c (1.0325477, 0.6746901, 1.0845737, 1.1123872, 1.1060822, 0.8595918, 0.8512941, 1.0148842, 1.0722369, 0.9019220 , 0.8809147, 1.0358256, 0.9903858, 1.0715174 , 1.1034405, 1.0143966,0.9802365, 0.7177169 , 0.9190783, 0.8408701 )
y= c (0.8550177, 0.8352162 ,1.0236998, 1.1071665, 0.6768144, 0.8449983 ,0.7616483, 0.8259199, 1.1539598, 1.4125006, 1.0511816, 0.9366184, 1.4101268, 1.2937913, 1.4147219 ,1.2943105 ,0.7859749, 0.6689330, 0.6940164, 0.8093392)
plot(x,y)
abline(lm(y ~ x))
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet
Run Code Online (Sandbox Code Playgroud)
请给我任何建议
我想使用以下线性方程在绘图上绘制一条直线.
y = 2.522x-1.331
Run Code Online (Sandbox Code Playgroud)
我使用以下代码来获取散点图.
data=read.csv("C://book.csv")
plot(data$x,data$y)
Run Code Online (Sandbox Code Playgroud) 我想从空格分隔的文本文件中删除1,2,4,5,6,10,11,12列.我想从现有文件中删除这些列而不是打印输出.我怎么能用sed这样做?
MMMM 1522 KL1 PPP A 201 -7.299 41.933 48.192 1.00 31.52 G
MMMM 22 G SSS A 3 39.541 25.078 -2.722 1.00 30.47 B
Run Code Online (Sandbox Code Playgroud)
期望的输出
KL1 -7.299 41.933 48.192
G 39.541 25.078 -2.722
Run Code Online (Sandbox Code Playgroud)