Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7944109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:27:40+00:00 2026-06-04T00:27:40+00:00

I have a list in R: a <- list(n1 = hi, n2 = hello)

  • 0

I have a list in R:

a <- list(n1 = "hi", n2 = "hello")

I would like to append to this named list but the names must be dynamic. That is, they are created from a string (for example: paste("another","name",sep="_")

I tried doing this, which does not work:

c(a, parse(text="paste(\"another\",\"name\",sep=\"_\")=\"hola\"")

What is the correct way to do this? The end goal is just to append to this list and choose my names dynamically.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:27:41+00:00Added an answer on June 4, 2026 at 12:27 am

    You could just use indexing with double brackets. Either of the following methods should work.

    a <- list(n1 = "hi", n2 = "hello")
    val <- "another name"
    a[[val]] <- "hola"
    a
    #$n1
    #[1] "hi"
    #
    #$n2
    #[1] "hello"
    #
    #$`another name`
    #[1] "hola"
    
     a[[paste("blah", "ok", sep = "_")]] <- "hey"
     a
    #$n1
    #[1] "hi"
    #
    #$n2
    #[1] "hello"
    #
    #$`another name`
    #[1] "hola"
    #
    #$blah_ok
    #[1] "hey"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have this list that i am working on. When i move the
I'm using org mode to make a list that I would like exported to
I have a list like: List<String> test = new List<String> {Luke, Leia}; I would
If I have something like a List[Option[A]] and I want to convert this into
I currently have an ArrayList of strings in Java, but I would like to
Hello I have a multi choice listview. I would like to add more than
I have a list of words in a file. They might contain words like
Hello I have a small List<string> that I want to maintain across postbacks on
Hello I have a ArrayList<String> with some strings. I would like to insert a
Suppose I have the following dictionary and list: my_dictionary = {1:hello, 2:goodbye, 3:World, sand:box}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.