0

I was looking for some solution about adding new value into list. Eg. I have list of values

n = c(2, 3, 5) 
s = c("aa", "bb", "cc", "dd", "ee") 
b = c(TRUE, FALSE, TRUE, FALSE, FALSE) 
x = list(n, s, b, 3)   # x contains copies of n, s, b

and I need to add value 6 to list x to have in x[[1]] 2, 3, 5, 6 values.

How do I do that?

Ross
  • 1,313
  • 4
  • 16
  • 24
martinkabe
  • 1,079
  • 2
  • 12
  • 27

2 Answers2

0

You can try

x[[1]] <- c(x[[1]],6)
akrun
  • 874,273
  • 37
  • 540
  • 662
0

The command

   x[[1]] <- append(x = x[[1]],values = 6)

works also.

A-BN
  • 1
  • 2