Is there a way to access an index within a vector

后端 未结 3 2022
隐瞒了意图╮
隐瞒了意图╮ 2021-01-22 15:35

i need to access an index (individual value) within a vector. I assumed it would be similar to:

v1 <- c(a,b,c,d,e)
v1[3] = h

But that doesn\

3条回答
  •  心在旅途
    2021-01-22 15:53

    > v1 <- c(1,2,3)
    > v1[1] <- 5
    > v1
    [1] 5 2 3
    

    Um, that should work. I'm not sure that it's clear what your problem is. In your example, are a,b,c,d,e and h all defined? Or should you be using them as strings (ie "a", "b", etc)?

提交回复
热议问题