Skip to content
Back to formatted view

Raw Message

Message-ID: <6469ae30-a9a2-4b4b-996c-e4322b3c5d93@gmail.com>
Date: 2017-09-22T14:34:12Z
From: Evan Cooch
Subject: update numeric values of list with new values...

Suppose I have the following:

test <- list(a=1,b=2,c=3)

I also have a vector (or list, or something else...) with new numbers

new <- c(4,5,6)

What I'm trying to figure out is how to take the list, and update the 
numbers from {1,2,3} to {4,5,6}

So, in the end,I want the 'update' test list to look like

(a=4,a=5,a=6)

I tried a bunch of obvious things I know about 'replacing' things 
(without success), but the problem in this instance seems to be the fact 
that the list contains elements that are expressions (a=1, a=2,...), 
while the new vector is simply a set of numbers.

So, I want to change the numbers in the list, but retain the character 
parts of the expressions in the list (I need to have the list of 
expressions as is for other purposes).

Doable?

Thanks in advance...