-1

I have the following problem.

When I was looking up a specific value it usually looked like this:

df1[383,54]
[1] "This is a Test-String."

But when I load something from excel:

library(readxl)
df2 <- read_excel("~/Test.xls", col_names = FALSE)

It started looking like this:

df1[383,54]
# A tibble: 1 x 1
               X__54
               <chr>
1 This is a Test-String.

What have I done wrong? It is not because of the tibble package, because when I detach it, it is the same output. Why does the output of my dataframe change, when I load a different dataset. I tried a lot but did not find an answer. Hopefully this is not a question with an overly obvious answer.

xyz
  • 134
  • 1
  • 12
  • What is the problem with the output other than it is a column in a `tbl_df` If you want to get the same format extract with `[[` i.e. `df1[[54]][383]` You can check the `str(df1)` and `str(df2)` The difference is the classes, i.e. the first one is just a `data.frame` but the second one has additional features i.e. `tbl_df` – akrun Jul 06 '17 at 17:25
  • Why would you think it isn't because of the package? The package loads that function which returns a tibble instead of a data.frame. – Dason Jul 06 '17 at 18:12
  • @Dason Yes, I realized, that it was because of the package. The problem is, that also after detaching the package nothing changes. – xyz Jul 07 '17 at 18:03
  • @D.P. Why would it? The data is already loaded. I'm not sure what you think would change after detaching the package? – Dason Jul 07 '17 at 18:03
  • 1
    `read_excel` reads in a tibble. Detaching the readxl package doesn't change the fact that the data is still a tibble. Working with tibbles is similar but slightly different than working with data.frames. You can read more about them here: https://cran.r-project.org/web/packages/tibble/vignettes/tibble.html – Dason Jul 07 '17 at 18:12

1 Answers1

0

df2 <- as.data.frame(df2) should prevent the header from showing by changing from a tibble back to a standard data.frame.

Mako212
  • 6,787
  • 1
  • 18
  • 37