how to see data in R?

I can see my dataset in R studio. But I can't see my dataset (imported from Excel) in R. Can I see my dataset in R?

1 Like

You can run View(your_dataset).

Let's assume you've read the date with the package readxl into the working directory.

x <- readxl::read_excel("file.xlsx")

Then, you can view your data by running x, or print(x). Usually you may want to use head(x) or tail(x), or with a second argument head(x, 5). Most of the time you do not want to use View(x) since it does not make sense in a RMarkdown document, or when running a script. In the upper right corner you may see an Environment pane, it consists of all visible, defined objects in your global environment. You may see the object x as well. You can't see it if you would have named the object .x, because then it is not visible, but callable with .x.

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