0

I have uploaded the excel file into the R environment when I view(data) then this shows like this

this red circle has "...1" which is not actually in the excel sheet, so how to delete it in the R?

Ronak Shah
  • 355,584
  • 18
  • 123
  • 178

3 Answers3

2

If you just want to rename the first column:

colnames(data)[1] <- ""

Otherwise you can either sett it to Null

data[1] <- NULL 

... or subset the dataframe ...

data <- data[,-1]

... but there are lots of ways to do this.

2

With tidyverse, we could use column_to_rownames from tibble

library(dplyr)
library(tibble)
df <- df %>%
        column_to_rownames(var = "...1")
akrun
  • 789,025
  • 32
  • 460
  • 575
1

You can add the first column as rowname and then delete the first column.

rownames(df) <- df[[1]]
df[, 1] <- NULL
Ronak Shah
  • 355,584
  • 18
  • 123
  • 178