Calling an object with a numeric name

I loaded some data into R and mistakenly named it 86. Now that I want to call the data frame, I get the number 86 instead of my data set. Is there a way to invoke a dataset rather than the number 86? Also, is there a way to change the data name so that it is no longer a number? Thank.

+4
source share
1 answer

You need to use backlinks:

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

To change the name of your data frame, simply assign ( <-) the data from 86to dfand delete ( rm) the original86

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

Due to 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>"
+5
source

All Articles