我想将这些值中的每一个插入到数据框中,以下值只是一个示例。我需要能够为每个数据输入引用每个单元格,因为我想将它与循环一起用来保存输出。我尝试使用这个例子,但它似乎并不一致。 http://r.789695.n4.nabble.com/change-value-in-one-cell-td3589456.html
Distances <- data.frame( "Main.Point" = numeric(0), "Sub.Point" = numeric(0), "Distance" = numeric(0))
### Save to Distances Data.Frame ###
E<-nrow(Distances)+1
E
Distances[E,"Sub.Point"]<-nRuns
Distances[E,"Main.Point"]<-NRuns
Distances[E,"Distance"]<-D
当我运行它时,只有Sub Point工作,其他人得到这些错误
> Distances[E,"Sub.Point"]<-nRuns
> Distances[E,"Main.Point"]<-NRuns
Warning message:
In `[<-.factor`(`*tmp*`, iseq, value = 3123) :
invalid factor level, NA generated
> Distances[E,"Distance"]<-D
Error in match(value, lx) : 'match' requires vector arguments