view table/dataframe in r
To view a table or dataframe in R, you can use the View()
function or simply type the name of the object you want to view.
Step 1: Create or load a table or dataframe in R.
For example, let's say we have a dataframe called my_data
:
my_data <- data.frame(
Name = c("John", "Jane", "Alice"),
Age = c(25, 30, 35),
Salary = c(50000, 60000, 70000)
)
Step 2: Use the View()
function to open a separate viewer window that displays the table or dataframe.
View(my_data)
Alternatively, you can simply type the name of the object to view it in the console.
my_data
By executing either of these commands, the table or dataframe will be displayed in a viewer window or in the console, respectively. The viewer window allows you to interactively explore the data, whereas the console displays the data in a tabular format.
That's it! You have successfully viewed a table or dataframe in R.