Jupyter MD file with jekyll
load("~/Dropbox/Fall 2015/STAT 141/Assignment1/vehicles.rda")
ls()
<ol class=list-inline> <li>‘lungDeaths’</li> <li>‘vposts’</li> </ol>
vehicle = vposts
library(lattice)
library(ggplot2)
library(gmodels)
library(RColorBrewer)
class(vehicle)
‘data.frame’
names(vehicle)
<ol class=list-inline> <li>‘id’</li> <li>‘title’</li> <li>‘body’</li> <li>‘lat’</li> <li>‘long’</li> <li>‘posted’</li> <li>‘updated’</li> <li>‘drive’</li> <li>‘odometer’</li> <li>‘type’</li> <li>‘header’</li> <li>‘condition’</li> <li>‘cylinders’</li> <li>‘fuel’</li> <li>‘size’</li> <li>‘transmission’</li> <li>‘byOwner’</li> <li>‘city’</li> <li>‘time’</li> <li>‘description’</li> <li>‘location’</li> <li>‘url’</li> <li>‘price’</li> <li>‘year’</li> <li>‘maker’</li> <li>‘makerMethod’</li> </ol>
unlist( sapply(X = vehicle, FUN = class) )
<dl class=dl-horizontal> <dt>id</dt> <dd>‘character’</dd> <dt>title</dt> <dd>‘character’</dd> <dt>body</dt> <dd>‘character’</dd> <dt>lat</dt> <dd>‘numeric’</dd> <dt>long</dt> <dd>‘numeric’</dd> <dt>posted1</dt> <dd>‘POSIXct’</dd> <dt>posted2</dt> <dd>‘POSIXt’</dd> <dt>updated1</dt> <dd>‘POSIXct’</dd> <dt>updated2</dt> <dd>‘POSIXt’</dd> <dt>drive</dt> <dd>‘factor’</dd> <dt>odometer</dt> <dd>‘integer’</dd> <dt>type</dt> <dd>‘factor’</dd> <dt>header</dt> <dd>‘character’</dd> <dt>condition</dt> <dd>‘factor’</dd> <dt>cylinders</dt> <dd>‘integer’</dd> <dt>fuel</dt> <dd>‘factor’</dd> <dt>size</dt> <dd>‘factor’</dd> <dt>transmission</dt> <dd>‘factor’</dd> <dt>byOwner</dt> <dd>‘logical’</dd> <dt>city</dt> <dd>‘factor’</dd> <dt>time1</dt> <dd>‘POSIXct’</dd> <dt>time2</dt> <dd>‘POSIXt’</dd> <dt>description</dt> <dd>‘character’</dd> <dt>location</dt> <dd>‘character’</dd> <dt>url</dt> <dd>‘character’</dd> <dt>price</dt> <dd>‘integer’</dd> <dt>year</dt> <dd>‘integer’</dd> <dt>maker</dt> <dd>‘character’</dd> <dt>makerMethod</dt> <dd>‘numeric’</dd> </dl>
densityplot(vehicle$price, main = "Price", xlab = "Price")
tail( sort(vehicle$price), 50)
<ol class=list-inline> <li>95593</li> <li>96590</li> <li>97000</li> <li>97500</li> <li>97911</li> <li>98000</li> <li>99560</li> <li>99999</li> <li>100000</li> <li>100000</li> <li>100000</li> <li>100000</li> <li>104800</li> <li>105000</li> <li>105500</li> <li>107000</li> <li>112000</li> <li>116100</li> <li>116491</li> <li>120000</li> <li>122950</li> <li>123981</li> <li>125000</li> <li>129950</li> <li>129990</li> <li>138500</li> <li>139000</li> <li>139950</li> <li>143000</li> <li>143000</li> <li>143950</li> <li>147000</li> <li>149890</li> <li>149995</li> <li>150000</li> <li>152900</li> <li>159000</li> <li>169000</li> <li>177588</li> <li>202455</li> <li>240000</li> <li>286763</li> <li>359000</li> <li>400000</li> <li>559500</li> <li>569500</li> <li>9999999</li> <li>30002500</li> <li>600030000</li> <li>600030000</li> </ol>
idx = which( vehicle$price >= 9999999 & !is.na(vehicle$price) )
vehicle[ idx, c("header", "price", "maker", "year") ]
<th scope=col>header</th><th scope=col>price</th><th scope=col>maker</th><th scope=col>year</th> | |||
---|---|---|---|
1969 Pontiac GTO | 600030000 | pontiac | 1969 |
1969 Pontiac GTO | 600030000 | pontiac | 1969 |
2002 Caddy Seville sls | 30002500 | cadillac | 2002 |
2001 Honda Accord | 9999999 | honda | 2001 |
idx = ( vehicle$maker == "pontiac" & vehicle$year %in% c(1968, 1969) &
+ vehicle$price < 9999999 & vehicle$price > 1 &
+ grepl(pattern = "GTO", x = vehicle$header, ignore.case = TRUE) &
+ !is.na(vehicle$maker) & !is.na(vehicle$price) & !is.na(vehicle$header) )
dat = vehicle[ idx, c("header", "price", "maker", "year") ]
dat[ order(dat$price), ]
<th scope=col>header</th><th scope=col>price</th><th scope=col>maker</th><th scope=col>year</th> | |||
---|---|---|---|
1968 pontiac gto | 15995 | pontiac | 1968 |
1968 pontiac gto | 15995 | pontiac | 1968 |
1968 Pontiac GTO | 24500 | pontiac | 1968 |
1969 Pontiac GTO | 25000 | pontiac | 1969 |
1969 Pontiac GTO | 25000 | pontiac | 1969 |
1968 pontiac gto | 30000 | pontiac | 1968 |
1968 Pontiac gto | 38500 | pontiac | 1968 |
1968 GTO | 38500 | pontiac | 1968 |
round( mean(vehicle$price[idx]), digits = -3)
27000
vehicle$price[vehicle$price == 600030000 & !is.na(vehicle$price)] = 27000
idx = which( vehicle$price >= 100000 & !is.na(vehicle$price))
length( idx )
40
vehicle[ idx, c("header", "price") ]
<th scope=col>header</th><th scope=col>price</th> | |
---|---|
2008 BMW X5 | 177588 |
2010 CHEVROLET SILVERADO | 359000 |
2000 Mack RD688S | 1e+05 |
2013 Ford | 150000 |
2003 lincoln navigator | 1e+05 |
2009 CHEVROLET IMPALA | 559500 |
2007 CHEVROLET MONTE CARLO | 569500 |
2002 Caddy Seville sls | 30002500 |
2013 Isuzu NRR | 129990 |
1967 chevrolet corvette | 105500 |
2010 ford fusion | 105000 |
2001 Honda Accord | 9999999 |
2004 Toyota Corolla | 286763 |
2009 Lamborghini Gallardo | 129950 |
2009 Mercedes-Benz SL65 | 139950 |
2013 Mercedes-Benz G63 | 122950 |
2011 Bentley Mulsanne | 143950 |
2004 Lexus 470 | 169000 |
2015 mercedes-benz s550 | 107000 |
2012 Mercedes-Benz SLS AMG 2dr Roadster SLS AMG | 149890 |
2006 FORD GT | 4e+05 |
2014 ferrari 458 italia | 240000 |
2014 Audi RS 7 4.0T quattro | 116491 |
2015 Mercedes-Benz S-Class | 143000 |
2014 Porsche 911 | 104800 |
2015 Porsche 911 | 152900 |
1965 porsche 911 | 1e+05 |
2005 TOYOTA AVALON | 112000 |
2011 toyota rav4 | 159000 |
2014 Land Rover Range 5.0L V8 | 123981 |
2016 porsche 911 | 202455 |
2007 Lamborghini Gallardo Spyder | 149995 |
2015 Hyundai Sonata | 138500 |
2015 Porsche Panamera | 116100 |
2015 Mercedes-Benz S-Class | 143000 |
1988 porsche 911 Carrera Targa TL | 120000 |
1976 Porsche 930 | 139000 |
1941 willys | 125000 |
2015 Porsche GT3 | 147000 |
1961 Maserati 151 | 1e+05 |
shortlist = vehicle[ idx, c("header", "price", "maker", "year") ]
filter_high_price = function(maker,year,header,price){
idx = (vehicle$maker == maker & vehicle$year %in% c(year, year+1) &
vehicle$price < 100000 & vehicle$price > 1 &
grepl(pattern = gsub(maker,"",gsub("\\d+\\s","",header), ignore.case=TRUE),x = vehicle$header, ignore.case = TRUE) &
!is.na(vehicle$maker) & !is.na(vehicle$price) & !is.na(vehicle$header))
if(length(vehicle$price[idx])!= 0){
newPrice = round( mean(vehicle$price[idx]), digits = -3)
if(price > 1.5*newPrice) vehicle$price[vehicle$price == price & !is.na(vehicle$price)] <<- newPrice #return to global environment
}
}
sapply(1:length(shortlist$maker), function(i) filter_high_price(shortlist$maker[i],shortlist$year[i],shortlist$header[i], shortlist$price[i]))
- 19000
- 26000
- NULL
- 19000
- 6000
- 7000
- 7000
- NULL
- NULL
- 41000
- 9000
- 3000
- 5000
- NULL
- NULL
- NULL
- NULL
- 19000
- NULL
- NULL
- 14000
- NULL
- NULL
- NULL
- NULL
- NULL
- 6000
- 8000
- 17000
- NULL
- 97000
- NULL
- 20000
- NULL
- NULL
- NULL
- NULL
- 20000
- NULL
- 6000
idx = which( vehicle$price >= 100000 & !is.na(vehicle$price) )
vehicle[ idx, c("header", "price") ]
<th scope=col>header</th><th scope=col>price</th> | |
---|---|
2002 Caddy Seville sls | 30002500 |
2013 Isuzu NRR | 129990 |
2009 Lamborghini Gallardo | 129950 |
2009 Mercedes-Benz SL65 | 139950 |
2013 Mercedes-Benz G63 | 122950 |
2011 Bentley Mulsanne | 143950 |
2015 mercedes-benz s550 | 107000 |
2012 Mercedes-Benz SLS AMG 2dr Roadster SLS AMG | 149890 |
2014 ferrari 458 italia | 240000 |
2014 Audi RS 7 4.0T quattro | 116491 |
2015 Mercedes-Benz S-Class | 143000 |
2014 Porsche 911 | 104800 |
2015 Porsche 911 | 152900 |
2014 Land Rover Range 5.0L V8 | 123981 |
2007 Lamborghini Gallardo Spyder | 149995 |
2015 Porsche Panamera | 116100 |
2015 Mercedes-Benz S-Class | 143000 |
1988 porsche 911 Carrera Targa TL | 120000 |
1976 Porsche 930 | 139000 |
2015 Porsche GT3 | 147000 |
densityplot(vehicle$price, main = "Price", xlab = "Price")
sum( is.na(vehicle$price) )
3328
sum( vehicle$price == 1 & !is.na(vehicle$price) )
612
filter_low_price = function(maker,year,header,price){
idx = (vehicle$maker == maker & vehicle$year %in% c(year, year+1) &
vehicle$price < 100000 & vehicle$price > 1 &
grepl(pattern = gsub(maker,"",gsub("\\d+\\s","",header), ignore.case=TRUE),x = vehicle$header, ignore.case = TRUE) &
!is.na(vehicle$maker) & !is.na(vehicle$price) & !is.na(vehicle$header))
if(length(vehicle$price[idx])!= 0){
newPrice = round( mean(vehicle$price[idx]), digits = -3)
if(price < 1.5*newPrice) vehicle$price[vehicle$price == price & !is.na(vehicle$price)] <<- newPrice #return to global environment
}
}
idx = which( vehicle$price <= 500 & !is.na(vehicle$price))
shortlist = vehicle[ idx, c("header", "price", "maker", "year") ]
sapply(1:length(shortlist$maker), function(i) filter_low_price(shortlist$maker[i],shortlist$year[i],shortlist$header[i], shortlist$price[i]))
Error in if (price < 1.5 * newPrice) vehicle$price[vehicle$price == price & : missing value where TRUE/FALSE needed
library(shiny)
library(DT)
idx = which( vehicle$price <= 500 & !is.na(vehicle$price))
shortlist = vehicle[ idx, c("header", "price", "maker", "year") ]
head(shortlist,n=50)
<th scope=col>header</th><th scope=col>price</th><th scope=col>maker</th><th scope=col>year</th> | |||
---|---|---|---|
2004 Jeep Wrangler X | 23 | jeep | 2004 |
2005 Mini Cooper Sport | 19 | mini | 2005 |
1998 DODGE CARAVAN | 400 | dodge | 1998 |
1995 ford escort wagon | 300 | ford | 1995 |
1995 Subaru Legacy | 499 | subaru | 1995 |
2015 BRIWAY | 210 | NA | 2015 |
2005 Bridgestone dueler | 400 | NA | 2005 |
1964 Pontiac GTO | 30 | pontiac | 1964 |
2001 Chevrolet Malibu | 400 | chevrolet | 2001 |
1986 Mazda RX-7 | 395 | mazda | 1986 |
2008 Honda Accord | 12 | honda | 2008 |
2009 chevrolet equinox | 8 | chevrolet | 2009 |
2012 cadillac srx | 6 | cadillac | 2012 |
2008 Mazda 6 | 2 | mazda | 2008 |
2006 saab 9-3 | 2 | saab | 2006 |
2004 chevrolet trailblazer ext | 3 | chevrolet | 2004 |
2000 trailer | 300 | NA | 2000 |
2006 Hyndai Tucson | 4 | hyundai | 2006 |
1994 acura legend | 300 | acura | 1994 |
2000 Fhfhfhffj | 200 | NA | 2000 |
2000 honda accord 4-door sedan | 450 | honda | 2000 |
1993 ford mustang | 100 | ford | 1993 |
2002 ford taurus x | 2 | ford | 2002 |
2002 TOYOTA COROLLA | 3 | toyota | 2002 |
2001 bobcat v 623 loadall | 55 | NA | 2001 |
1989 case 1835 c diesel | 11 | NA | 1989 |
2016 Variety | 2 | NA | 2016 |
1997 chevy | 495 | chevrolet | 1997 |
2012 cadillac srx | 6 | cadillac | 2012 |
2008 Mazda 6 | 2 | mazda | 2008 |
1969 repair manual | 60 | NA | 1969 |
1972 Chevrolet C10 | 10 | chevrolet | 1972 |
2008 gmc 2500 sierra | 120 | gmc | 2008 |
2013 PowerStation | 80 | NA | 2013 |
2009 Ford F-150 | 50 | ford | 2009 |
1986 Mazda RX-7 | 395 | mazda | 1986 |
1999 toyota supra | 50 | toyota | 1999 |
2013 tral | 50 | NA | 2013 |
1985 300 D | 400 | mercedes | 1985 |
2003 ford windstar van | 4 | ford | 2003 |
1997 Ford pick up | 175 | ford | 1997 |
2014 Nissan Rogue SV AWD | 340 | nissan | 2014 |
2008 cadillac srx | 100 | cadillac | 2008 |
2003 Snowbear | 200 | NA | 2003 |
2015 Tire | 15 | NA | 2015 |
2010 truck | 60 | NA | 2010 |
1997 Chevy Cavalier | 450 | chevrolet | 1997 |
1999 Ford Ranger | 175 | ford | 1999 |
2001 honda accord 2-door coupe | 400 | honda | 2001 |
2003 Mercury marquis gs park lane | 165 | mercury | 2003 |
idx = which( vehicle$price <= 500 & !is.na(vehicle$price) & !is.na(vehicle$maker))
shortlist = vehicle[ idx, c("header", "price", "maker", "year") ]
sapply(1:length(shortlist$maker), function(i) filter_low_price(shortlist$maker[i],shortlist$year[i],shortlist$header[i], shortlist$price[i]))
- 8000
- NULL
- 1000
- NULL
- 2000
- NULL
- 2000
- 2000
- 10000
- 6000
- 16000
- 6000
- 6000
- 3000
- NULL
- NULL
- 3000
- 5000
- 6000
- 4000
- 3000
- 20000
- 7000
- 7000
- 17000
- 19000
- 2000
- 19000
- 5000
- 2000
- NULL
- NULL
- 7000
- 1000
- 3000
- 3000
- NULL
- NULL
- 3000
- 6000
- 5000
- 14000
- NULL
- NULL
- NULL
- NULL
- NULL
- NULL
- NULL
- NULL
- 6000
- 4000
- 7000
- 16000
- 29000
- NULL
- 13000
- NULL
- NULL
- 18000
- 21000
- 15000
- 8000
- 11000
- NULL
- 16000
- 11000
- 33000
- 17000
- 15000
- 16000
- 6000
- 4000
- NULL
- 4000
- 13000
- NULL
- 18000
- 10000
- 10000
- 10000
- 6000
- 16000
- 10000
- 12000
- NULL
- 10000
- NULL
- 11000
- 7000
- 14000
- 18000
- 4000
- 4000
- 6000
- 4000
- 4000
- 4000
- 4000
- 4000
- 12000
- 4000
- 4000
- 4000
- 20000
- 4000
- 4000
- 4000
- 4000
- 8000
- 4000
- 18000
- 23000
- 13000
- 9000
- 8000
- 36000
- 15000
- 32000
- 12000
- 12000
- 13000
- 6000
- 5000
- NULL
- 2000
- 5000
- 17000
- 5000
- NULL
- 6000
- 4000
- 3000
- NULL
- 2000
- 2000
- 2000
- 19000
- 13000
- 3000
- 3000
- 1000
- 3000
- 3000
- 1000
- 4000
- 3000
- NULL
- 1000
- NULL
- 16000
- 5000
- NULL
- 2000
- NULL
- 19000
- 4000
- 2000
- 11000
- 11000
- 13000
- 13000
- NULL
- 12000
- 15000
- 13000
- 30000
- 14000
- NULL
- 9000
- 9000
- 21000
- 2000
- NULL
- 4000
- 5000
- 1000
- 13000
- NULL
- 8000
- 5000
- 18000
- 2000
- 32000
- 18000
- NULL
- 2000
- 2000
- 16000
- NULL
- 2000
- 2000
- 5000
- NULL
- 17000
- 4000
- 11000
- 5000
- 2000
- 2000
- 21000
- 20000
- 26000
- 10000
- 17000
- 4000
- 11000
- 19000
- 3000
- 2000
- 2000
- 13000
- 2000
- 3000
- 17000
- 5000
- 8000
- 2000
- 5000
- 5000
- 4000
- 7000
- 4000
- NULL
- 22000
- 5000
- 12000
- 15000
- 7000
- 5000
- 13000
- 9000
- 19000
- 22000
- 2000
- 5000
- 4000
- 5000
- 4000
- 5000
- 13000
- 2000
- 3000
- 5000
- 7000
- 6000
- 6000
- 5000
- 5000
- 2000
- 5000
- 8000
- 7000
- 5000
- 2000
- 5000
- 22000
- 2000
- 2000
- 2000
- 7000
- 13000
- 9000
- 5000
- 2000
- 5000
- 3000
- 2000
- 2000
- 2000
- 5000
- 8000
- 5000
- 2000
- 3000
- 8000
- 19000
- 4000
- 8000
- 5000
- 23000
- 2000
- 2000
- 2000
- 5000
- 2000
- 6000
- 4000
- 5000
- 9000
- 7000
- 4000
- 6000
- 5000
- 7000
- 2000
- 8000
- 2000
- 5000
- 2000
- 2000
- 2000
- 2000
- 13000
- 3000
- 22000
- 2000
- 5000
- 5000
- 3000
- 3000
- 1000
- 6000
- 4000
- 6000
- 4000
- 4000
- 3000
- 15000
- 4000
- 13000
- 10000
- 1000
- 6000
- 6000
- 9000
- 12000
- 22000
- 6000
- 3000
- 2000
- 17000
- 2000
- 8000
- 2000
- 6000
- 11000
- 5000
- 8000
- NULL
- 6000
- 3000
- 11000
- 21000
- 5000
- 1000
- NULL
- 4000
- 2000
- 18000
- 4000
- 4000
- 5000
- 14000
- 22000
- 13000
- 3000
- 6000
- 5000
- 3000
- 5000
- 8000
- 5000
- 6000
- 3000
- 10000
- NULL
- NULL
- NULL
- NULL
- NULL
- NULL
- NULL
- NULL
- 12000
- 2000
- 2000
- 2000
- 2000
- 2000
- 2000
- 2000
- 3000
- 22000
- 28000
- 9000
- 8000
- 12000
- 13000
- 10000
- NULL
- 28000
- 30000
- 24000
- 16000
- 22000
- 10000
- NULL
- 5000
- 8000
- NULL
- 18000
- 3000
- 2000
- 13000
- 29000
- 12000
- 18000
- 22000
- 22000
- 29000
- 32000
- 27000
- 31000
- 33000
- 35000
- 29000
- 21000
- 22000
- 22000
- 32000
- 12000
- 13000
- 13000
- 14000
- 14000
- 16000
- 18000
- 13000
- 15000
- 15000
- 14000
- 16000
- 17000
- 17000
- 22000
- 15000
- 17000
- 15000
- 18000
- 24000
- 14000
- 15000
- 15000
- 15000
- 16000
- 20000
- 15000
- 15000
- 28000
- 31000
- 15000
- NULL
- 13000
- 10000
- 10000
- 10000
- 21000
- 19000
- 11000
- 22000
- 18000
- 25000
- 25000
- 16000
- 23000
- 32000
- 17000
- 36000
- 16000
- NULL
- 14000
- 17000
- 25000
- 22000
- 18000
- 4000
- 29000
- 7000
- 10000
- 15000
- 12000
- 15000
- 9000
- 23000
- 33000
- 34000
- 20000
- 18000
- 25000
- 33000
- 2000
- 14000
- 22000
- 18000
- 35000
- 13000
- 9000
- 10000
- 14000
- 10000
- 22000
- 24000
- 18000
- 10000
- 17000
- 15000
- 19000
- 17000
- 3000
- 5000
- 17000
- 17000
- 14000
- 16000
- 3000
- 29000
- 34000
- 17000
- 5000
- 18000
- 4000
- 17000
- 17000
- 33000
- 34000
- 17000
- 13000
- 5000
- 16000
- 27000
- 17000
- 5000
- 3000
- 23000
- 23000
- 34000
- 17000
- 15000
- 14000
- 10000
- 18000
- 18000
- 17000
- 16000
- 11000
- 23000
- 20000
- 25000
- 18000
- 10000
- 22000
- 10000
- 12000
- 9000
- 9000
- 18000
- 18000
- 17000
- 21000
- 24000
- 24000
- 13000
- 24000
- 20000
- 20000
- 30000
- 43000
- 16000
- NULL
- 25000
- 27000
- 25000
- 25000
- 10000
- 18000
- 19000
- 33000
- 14000
- 5000
- 10000
- 8000
- 5000
- 8000
- 24000
- 10000
- 22000
- 8000
- 8000
- 33000
- 19000
- 5000
- 10000
- 14000
- 22000
- 12000
- 10000
- 26000
- 24000
- 21000
- 14000
- 12000
- 24000
- 22000
- 22000
- 12000
- 22000
- 15000
- 18000
- 13000
- 23000
- 34000
- 13000
- 19000
- 17000
- 20000
- 4000
- 4000
- 30000
- 18000
- 17000
- 18000
- 18000
- 15000
- 30000
- 14000
- 14000
- 34000
- 30000
- 36000
- 23000
- 22000
- 35000
- 17000
- NULL
- NULL
- 14000
- 18000
- 18000
- 27000
- 27000
- 24000
- 30000
- 14000
- 32000
- 10000
- 10000
- 10000
- 8000
- 10000
- 10000
- 20000
- 20000
- 16000
- 26000
- 4000
- 8000
- 8000
- 8000
- 8000
- 15000
- 1000
- NULL
- 8000
- 8000
- NULL
- 4000
- 11000
- 3000
- NULL
- 14000
- 3000
- 24000
- 12000
- 12000
- 1000
- 1000
- 20000
- 3000
- 10000
- 10000
- 2000
- 13000
- 13000
- 25000
- 11000
- 7000
- 9000
- 9000
- 25000
- 2000
- 6000
- 11000
- 10000
- 7000
- 15000
- 2000
- 15000
- 22000
- 10000
- 3000
- 15000
- 15000
- 6000
- 14000
- 22000
- 10000
- 3000
- 5000
- 5000
- 1000
- 14000
- 14000
- 16000
- NULL
- 14000
- 10000
- 5000
- 9000
- 20000
- 8000
- 5000
- 18000
- 13000
- NULL
- 13000
- 13000
- 13000
- 10000
- 14000
- 14000
- NULL
- 11000
- 11000
- 10000
- 12000
- 14000
- 30000
- 22000
- 16000
- 20000
- 8000
- 6000
- 12000
- 8000
- 7000
- 7000
- 9000
- NULL
- 4000
- 23000
- 4000
- 13000
- 1000
- 5000
- 1000
- 3000
- 3000
- 4000
- 5000
- 1000
- 6000
- 16000
- 2000
- 1000
- 6000
- 4000
- 4000
- 4000
- 7000
- 1000
- 6000
- 20000
- 16000
- 1000
- 7000
- 2000
- 11000
- 10000
- 12000
- NULL
- 18000
- NULL
- 1000
- 4000
- 1000
- 27000
- 8000
- 1000
- 18000
- 4000
- 6000
- 4000
- 2000
- 2000
- 5000
- 6000
- NULL
- 2000
- NULL
- 2000
- 13000
- 20000
- 14000
- 12000
- 18000
- 19000
- 19000
- 13000
- 14000
- 3000
- 4000
- 1000
- 10000
- 1000
- 5000
- NULL
- 16000
- 1000
- 9000
- 5000
- NULL
- 14000
- 9000
- 6000
- 11000
- 5000
- 1000
- 1000
- 4000
- 1000
- 1000
- 16000
- 15000
- 23000
- 4000
- 19000
- 1000
- 1000
- NULL
- 10000
- 8000
- 2000
- NULL
- 4000
- 9000
- 7000
- 3000
- 8000
- 2000
- 4000
- 25000
- 3000
- 3000
- 12000
- 8000
- 5000
- 4000
- 19000
- NULL
- NULL
- NULL
- 15000
- 10000
- 4000
idx = which( vehicle$price <= 500 & !is.na(vehicle$price) & !is.na(vehicle$maker))
vehicle[ idx, c("header", "price", "maker", "year") ]
<th scope=col>header</th><th scope=col>price</th><th scope=col>maker</th><th scope=col>year</th> | |||
---|---|---|---|
2005 Mini Cooper Sport | 19 | mini | 2005 |
2014 Nissan Rogue SV AWD | 340 | nissan | 2014 |
2003 Mercury marquis gs park lane | 165 | mercury | 2003 |
2012 Audi Q5 3.2 Quattro Premium Plus | 455 | audi | 2012 |
2014 Ford Explorer Limited | 365 | ford | 2014 |
1957 CHEVROLET BELAIR | 70 | chevrolet | 1957 |
2012 Audi Q5 3.2 Quattro Premium Plus | 455 | audi | 2012 |
1997 Subaru legacy | 80 | subaru | 1997 |
2014 Ford Explorer Limited | 365 | ford | 2014 |
2012 Chrysler 300-Series | 179 | chrysler | 2012 |
1998 ford e150 econoline | 375 | ford | 1998 |
1992 Saturn SL2 | 80 | saturn | 1992 |
1961 chevrolet corvette convertible | 53 | chevrolet | 1961 |
1961 chevrolet corvette convertible | 53 | chevrolet | 1961 |
1961 chevrolet corvette convertible | 53 | chevrolet | 1961 |
vehicle = vehicle[-idx,]
quantile(x = vehicle$price, probs = c(0.05,0.99), na.rm = TRUE)
<dl class=dl-horizontal> <dt>5%</dt> <dd>1350</dd> <dt>99%</dt> <dd>46000</dd> </dl>