How to delete or rename data frames and values

I am still very new. I started working on a project and, from the source data frame, I created several additional data frames and named values, and many of them are useless. They have the data manipulated in ways that don't serve any purpose or they are named things that are completely contrary to what they actually are, mostly because I was confused about what I was doing. I need to get rid of them so that I don't mistakenly use them. How can I do this? There is no delete option when right-clicking them.

Hi,

for example for select some variables of a data frame you could use this.

df <- tribble(
  ~NAME, ~ VALUE1,  ~VALUE2,
  "G10263", 41.70,  -8.17,
  "G22652", 2.69,  -16.84,
  "G22656A", 32.67,-17.05,
  "G22659", 32.73,-16.79,
)

# for select only the 1 and 3 colums  with all rows.
filte1 <- df[ , c ( 1 ,  3 ) ]

# NAME     VALUE1   VALUE2
# 1 G10263   41.7   -8.17
# 2 G22652    2.69 -16.8 
# 3 G22656A  32.7  -17.0 
# 4 G22659   32.7  -16.8 
# for select only the 1 and 3 colums  and first row.
filte1 <- df[ 1 , c( 1,3)]

# # A tibble: 1 × 2
# NAME   VALUE2
# <chr>   <dbl>
# 1 G10263  -8.17
# for select only the first row and colum
# NAME  
# <chr> 
#1 G10263
# For change the name of variables. In this case the first colum. 

names(df)[1] <- 'New_name'

# A tibble: 4 × 3
# New_name VALUE1 VALUE2
  <chr>     <dbl>  <dbl>
1 G10263    41.7   -8.17
2 G22652     2.69 -16.8 
3 G22656A   32.7  -17.0 
4 G22659    32.7  -16.8 

Hi @tchntm43 ,

Are you just trying to delete data frames you've created that exist in your Environment pane?

See screenshot below of the environment pane that contains all of the dataframes created

If you close your R session and start a new one all objects (data.frames and variables) will be removed.
During a session you can remove one or more objects with the rm function. Type

? rm

This is what I was looking for, thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.