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 8298791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:54:46+00:00 2026-06-08T15:54:46+00:00

I was about to ask another question on SO that this question popped up

  • 0

I was about to ask another question on SO that this question popped up in my mind. How we define an object with a weird name. For instance, suppose we would like to call an object “test^#”. If I wanted to define it, I would use ” “:

"test^#" <- 10

Now the question is how to call this object?
If we again use ” “, then R considers it as a character string and not the name of an object.
While I see practical applications in being able to use symbols in the object names, but at this point it’s more a question out of my curiosity.

Thanks,

  • 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-08T15:54:48+00:00Added an answer on June 8, 2026 at 3:54 pm

    Use backticks:

    "test^#" <- 10
    ls()
    [1] "test^#"
    

    Now use it:

    `test^#`
    [1] 10
    

    You can also use backticks to refer to columns in data frames (or lists) with non-standard names. For example:

    iris$`Sepal length` <- iris$Sepal.Length
    str(iris)
    'data.frame':   150 obs. of  6 variables:
     $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
     $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
     $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
     $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
     $ Species     : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
     $ Sepal length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
    
    
    summary(iris$`Sepal length`)
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      4.300   5.100   5.800   5.843   6.400   7.900 
    

    If you want to something really odd, like embedding backticks in the name, then you may have to use get() to refer to it:

    "test^`#" <- 20
    
    get("test^`#")
    [1] 20
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had another question about this issue, but I didn't ask properly, so here
I'm revisiting and re-implementing the code that caused me to ask this question about
Yes, this is another question about my game engine, which is coming along very
I've asked about this very example in another question: Fill in a form with
This came up in another question but I figured it is best to ask
I would like to ask a theoritical question about how some web sites work.
This is my most confused aspect that I continually have to ask people about.
This question originated when I came upon ( another thread ) about Python's datetime
I want to ask about an edge-case scenario that I understand is very poor
I was just about to ask the same questions as the question aksed here....

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.