-1

I need to display the following:

  1. Number of total listings - the list is given, from that I need to find the total number
  2. Percentage of listings - which are not reviewed : the list is given and the entries which are not reviewed are marked as NA.

Lastly, I need to add both these variables (number of total listings, percentage of listings) to one data frame and display.

What will be the most suitable R script code to use?

  • Welcome to stack overflow. It's a great idea to show what you have tried and a reproducible example. – PavoDive Sep 22 '20 at 21:04

1 Answers1

0

Creating a sample dataframe:

listings <- c("Listing_1", "Listing_2", "Listing_3", "Listing_4", "Listing_5")
reviews <- c("Good", "Very Good", "Bad", NA, "Very Bad")

df <- data.frame(listings, reviews)

enter image description here

Number of listings:

dim(df)[1]

Percentage of missing reviews:

sum(is.na(df["reviews"])) / dim(df)[1] * 100
ats
  • 141
  • 6