Search code examples
rview

How do I view the contents of my subset in RStudio?


I have a large tabular data set (csv) which I set as my working directory.

dir()

setwd("~/Desktop/folder with data.csv file")

dir()

(1) data.csv

dataframe <- read.csv('data.csv')

dataframe <- read.csv('data.csv',header=TRUE)

dataframe <- read.csv('data.csv',header=TRUE, as.is=TRUE, sep=',')

It has over 20 columns, 2000 rows, and plenty of na values.

One subset I created is of the column that lists the "primary role" (job) for the 3000+ people. This is is because I want to later filter for specific job roles, and let R count how many instances there are.

roles_df <- (data$column)

I removed all na values using na.omit and have a subset of Factors w/ 1076 values.

no_na_df <- na.omit(job_df)
job_no_na_df <- na.omit(job_df)

When I now try to use view to see the data, I get the following error: "could not find function "view""

What can I do to fix this error? I want to inspect the data in the column as I then want to filter out specific words.

I have the following packages loaded:

library(tidyr)
library(dplyr)
library(tinyverse)

I have tried to view the data via

view(job_no_na_df)

And then get: Error in view(job_no_na_df) : could not find function "view"

I have also tried

view(data$job)

this returns the error:

Error in view(data$job) : 
  could not find function "view"

Solution

  • The function is View(), with a capital V.