小编Aga*_*Aga的帖子

r中的索引,有些问题

我创建了函数dystdystryb:

dyst<- function(t,x)
{
  f<-1
  return(f)
}
dystryb<- function(x)
{
  x<-sort(x)
  s<- numeric(101)
  u<-seq(0,1, by = 0.01)
  for (t in u)
  {
    s[t*100+1]<-dyst(t,x)
  }
  return(s)
}
Run Code Online (Sandbox Code Playgroud)

调用函数后dystryb我得到了这个:

> x<-c(1,2,3,4,5,6,7)
> dystryb(x)
  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 …
Run Code Online (Sandbox Code Playgroud)

indexing for-loop r function

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

标签 统计

for-loop ×1

function ×1

indexing ×1

r ×1