4

I loaded some data in R and mistakenly named it as 86. Now when I want to call the data frame I end up with the number 86 instead of my data set. Is there a way to call the data set rather than the number 86? Also, is there a way to change the name of the data so it is no longer a number? Thank you.

1 Answer 1

5

You need to use backticks:

"86" <- data.frame(a = "meow", b = "wouf")
> `86`
#      a    b
# 1 meow wouf

To change the name of your data frame, simply assign (<-) data from 86 to df and remove (rm) the original 86

df <- `86`; rm(`86`) 
> df
#      a    b
# 1 meow wouf

Because of copy-on-modify, this will not allocate memory for df.

> "86" <- data.frame(a = "meow", b = "wouf"); tracemem(`86`)
# [1] "<0x3936b28>"
> df <- `86`; tracemem(df)
# [1] "<0x3936b28>"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.