小编TFC*_*TFC的帖子

R 中数据框列的调用

我目前正在寻找一种解决方案来调用 adata frame中的每一列for loop,如下所示:


         V1     V2     V3       V4  V5   V6    V7   V8    V9   V10
Activity dep10  out10  dep500  -5  -15  -90   +45  +20   +32   out100
Run Code Online (Sandbox Code Playgroud)
for (i in 0:length(df)) {
  newDf$rowOne <<- df$V(value of i)
}
Run Code Online (Sandbox Code Playgroud)

我想使用 的值调用V1、then V2、then等...这样我就可以修改或使用 df 数据框的内容。V3i

有什么建议么?

r dataframe

1
推荐指数
1
解决办法
159
查看次数

如何在绘图上画半圆?

我正在尝试使用 R 中的三角函数在绘图上绘制一些半圆。所以这就是我所拥有的:

matPoints <<- as.data.frame(cbind(X=c(-1, -(sqrt(3)/2), -(sqrt(2)/2), -0.5, 0, 0.5, sqrt(2)/2, sqrt(3)/2, 1), Y=c(0, 0.5, sqrt(2)/2, sqrt(3)/2, 1, sqrt(3)/2, sqrt(2)/2, 0.5, 0)))

plot(x = matPoints$X*W, y = matPoints$Y*W)
Run Code Online (Sandbox Code Playgroud)

目前,它打印绘图上的每个点。我想要在这里做的是在点之间绘制一条平滑的线,这样它就会给我一个中心为 (0, 0) 且比例为 W 的漂亮半圆。

有什么解决办法吗?

plot trigonometry r draw

1
推荐指数
1
解决办法
1253
查看次数

标签 统计

r ×2

dataframe ×1

draw ×1

plot ×1

trigonometry ×1