I have a list of 2 vectors named X
, Y
. I want to add a new element called H
to each of these 2 vectors which will show as H = TRUE or FALSE
.
BUT, instead of showing TRUE
or FALSE
my output shows 1
and 0
. How can I show TRUE
and FALSE
in my current output?
H = c(T, F) # The element to be added
L <- list(X = c(K = 22, M = 39), Y = c(K = 54, M = 65)) # List to add to
Map(c, L, H = H) # My current solution
# Current OUTPUT:
# $X
# K M H
# 22 39 1 # instead of `TRUE`
# $Y
# K M H
# 54 65 0 # instead of `FALSE`