Question

In: Math

Please attach R code: Use library(nycflights13) a. plot histogram for distance where carrier is "FL". Print...

Please attach R code:

Use library(nycflights13) a. plot histogram for distance where carrier is "FL". Print graph(s). b. plot Two box plots side by side for distance where carrier are "FL" and “US”. Print graph(s). c. plot two histograms and two box plots in one graph where carrier are "FL" and “US”, equal scale for each box plot pair. Print graph(s).

Solutions

Expert Solution

The R code will be indented to the right.

install.packages("nycflights13")

library(nycflights13)

# This helps in installing the packages

data= nycflights13::flights

# Load the flights data

FL =subset(data,carrier=="FL")

US =subset(data,carrier=="US")

# Load only the data where carrier is FL and US

a.

hist(FL$distance,bins=10, main = "Histogram of distances of FL carrier")

# This plots the histogram required

b.

par(mfrow= c(1,2))

# Sets the graphing environment to 1x2; thus 2 plots can be plotted side by side.

boxplot(FL$distance,ylim=c(0,2500), main= "Boxplot of distances of FL carrier")
boxplot(US$distance,ylim=c(0,2500), main= "Boxplot of distances of US carrier")

# Gives out the required boxplots

c.

par(mfrow= c(2,2))

# Sets the environment

hist(FL$distance,bins=10, main = "Histogram of distances of FL carrier")

hist(US$distance,bins=10, main = "Histogram of distances of US carrier")

boxplot(FL$distance,ylim=c(0,2500), main= "Boxplot of distances of FL carrier")

boxplot(US$distance,ylim=c(0,2500), main= "Boxplot of distances of US carrier")

# Gives the required graphs


Related Solutions

Coding in R Im trying to plot a histogram in R, and i know the basic...
Coding in R Im trying to plot a histogram in R, and i know the basic code for that, however, the code requires 2 plots coming from the same data set. for example, the voltage of an old process vs. a new process. is there any ways to seperate the 2 processes out from the data set to make 2 relative frequencyt histograms?
Does anyone know the code to use in R programming to create a scatter plot?
Does anyone know the code to use in R programming to create a scatter plot?
Does anyone know the code to use in R programming to create a box plot?
Does anyone know the code to use in R programming to create a box plot?
Arduino code , using DS3231 library to set time/ date by keypad and print that on...
Arduino code , using DS3231 library to set time/ date by keypad and print that on lcd. i would like to make user to set time and date from the keypad .
Stet by step in R and attach R file and R codes too - Thanks Use...
Stet by step in R and attach R file and R codes too - Thanks Use one of the real-world example data sets from R (not previously used in the R practice assignment) or a dataset you have found, and at least two of the tests and R functions covered in the practice assignment to conduct a hypothesis test then report your findings and give proper conclusion(s). Use the following supporting materials for R syntax, data sets and tools, along...
Please Provide R code as well Use R to find probability (p-value). Find probability P(X>12.3), where...
Please Provide R code as well Use R to find probability (p-value). Find probability P(X>12.3), where X follows F-distribution with degree of freedom in numerator 4 and degree of freedom in numerator 10.
Please write code in c++ using iostream library. Also you can use any string library. Create...
Please write code in c++ using iostream library. Also you can use any string library. Create structure plane with the following: 1)plane's ID[int type] 2) location[char*] 3) departure time[char*] Your task is to find the plane with the smallest departure time for the selected city. Pointer, dynamic array and structures have to be used in this code. Input: NOTE: It's just an example of input, you should write code generally for any inputs. First line contains n(0 < n <...
Calculate Percentile in Excel for DIS, DAX, Nikkei225 and FTSE100. Please also plot a histogram in...
Calculate Percentile in Excel for DIS, DAX, Nikkei225 and FTSE100. Please also plot a histogram in your Excel file. Date DIS DAX Nikkei225 FTSE100 7/1/18 102.54 27.46 22304.51 7636.90 7/2/18 103.05 27.32 21811.93 7547.90 7/3/18 101.79 27.41 21785.54 7593.30 7/4/18 101.79 27.41 21717.04 7573.10 7/5/18 103.06 27.87 21546.99 7603.20 7/6/18 103.33 27.95 21788.14 7617.70 7/7/18 103.33 27.95 21788.14 7617.70 7/8/18 103.33 27.95 21788.14 7617.70 7/9/18 104.56 28.15 22052.18 7688.00 7/10/18 104.57 28.30 22196.89 7692.00 7/11/18 106.55 27.70 21932.21 7592.00 7/12/18...
(only matlab code please) solve and plot the relation between the position vs time where m1=...
(only matlab code please) solve and plot the relation between the position vs time where m1= 1 kg , m2 = 1.5 kg (Mass) k1= 100 N/m , k2 = 125 N/m (spring) b = 1 (damper) Initial conditions: y1(0) =0.15 m , y ’1(0) =0.05 m/s y2(0) =0.05 m , y ’2(0) =0.03 m/s U1(t) = unit step starting at t (step time) = 0 sec U2 = u (t,5) (t (step time) = 5 sec) t = linspace(0,25)...
Please write code in c++. Use iostream (and any string library if you need it). Create...
Please write code in c++. Use iostream (and any string library if you need it). Create s structure plane : First line contains n(0 < n < 1001). Then n lines inputed in given format:   First - ID[int type]   Second - FromLocation[char*]   Third - ToLocation[char*]   Fourth - DepartureTime[char*] Output: Sorted list of planes should be in UPPER CASE. Example of input:(it's just one of an examples, you need to write code generally) 10 40 Shuch Satp 05:47 89 Kyzy Taldy  07:00...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT