A function to clean web-scraped data given the tibble containing raw data .
data_cleaner(scraped_df)
scraped_df | A tibble containing web-scraped data like listing url, price and house type. |
---|
tibble A cleaned tibble containing information like listing url, price, number of bedrooms, area in sqft, and city.
data_cleaner(tibble::tibble( "price" = c("$1,300", "$1,200"), "house_type" = c("1br-600ft2-", "2br-"), "listing_url" = c( "https://vancouver.craigslist.org/bnc/apa/d/burnaby-must-see-1br-suite/7282955370.html", "https://vancouver.craigslist.org/rds/apa/d/surrey-bedroom-basement-for-rent/7273877138.html" ) ))#> # A tibble: 2 x 5 #> listing_url price num_bedroom area_sqft city #> <chr> <int> <int> <int> <chr> #> 1 https://vancouver.craigslist.org/bnc/apa/d/~ 1300 1 600 burn~ #> 2 https://vancouver.craigslist.org/rds/apa/d/~ 1200 2 NA surr~