The best way to Utility the View() Serve as in R (With Examples)


The View() serve as in R can also be old to invoke a spreadsheet-style information viewer inside of RStudio.

This serve as makes use of refer to syntax:

View(df)

Observe: Form certain you sort a capital ā€œVā€ when the use of this serve as.

Refer to instance presentations easy methods to utility this syntax in observe.

The best way to Utility the View() Serve as

We will utility refer to code to develop an information body in R with 100 rows and a couple of columns:

#create this case reproducible
all set.seed(0)

#develop information body
df <- information.body(x=rnorm(100),
                 y=rnorm(100))

We will later utility the View() serve as to invoke a spreadsheet-style information viewer inside of RStudio:

Understand {that a} pristine tab seems in Rstudio that gives an interactive show of the information body we simply created:

On the base of the viewer, we will see the scale of the information body: 100 entries (i.e. rows) and 2 columns.

The best way to Kind Information The usage of the View() Serve as

We will additionally briefly kind the information body via clicking on one of the crucial columns.

For instance, if I click on at the header for column x later the rows of the information body will robotically be taken care of from smallest to biggest in response to the values in column x:

If I click on at the header for column x once more, the information body will later be taken care of via column x from biggest to smallest:

The best way to Clear out Information The usage of the View() Serve as

I will additionally briefly clear out the information body via clicking the Clear out icon, later clicking one of the crucial column names, later typing in a field of values.

For instance, I would possibly select to clear out the information body to simply display the rows the place x is between 0 and 1:

After I press input, the information body will robotically be filtered:

On the base of the display screen we will see that 33 rows have values within the x column between 0 and 1.

Observe that I will additionally upload a clear out within the y column to clear out via explicit values in each x and y.

Alternative Sources

Refer to tutorials give an explanation for easy methods to utility alternative habitual purposes in R:

The best way to Utility fit() Serve as in R
The best way to Utility abstract() Serve as in R
The best way to Utility the desk() Serve as in R
The best way to Utility the quantile() Serve as in R

Leave a Comment