On 28/03/2020 4:17 p.m., David wrote:
If I have a vector created like x <- c(5,1,9,3), how can I add values to
it later?  That seems simple, but I don't find the answer in either of
my Dalgaard or Crawley books, or in the help functions.  Thanks.

This question belongs on R-help: nothing to do with MacOS. But the answer is to use c(), or just assign to a nonexistent location. For example,

x <- c(5,1,9,3)
x <- c(x, 10)
x[10] <- 20

This will result in x printing as

[1]  5  1  9  3 10 NA NA NA NA 20

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to