Question

In: Statistics and Probability

Create a data file frame in R called musseldata which has the following observations: species length...

  1. Create a data file frame in R called musseldata which has the following observations:

species length drywght tidehght

calif     113    14.3     low

tross      48     6.9     med

calif      72     8.1     high

calif      82     8.7     med

tross      33     4.9     high

tross      51     7.0     med

calif      94   11.6     low

Type the name of the data frame and copy/paste your R command the result into the green box.

  1. Use a logical condition with the subset() function to create a subset of the data called cal which contains only the observations on Mytilus californianus species (i.e. calif in the data frame). Type the name of the new data frame and the copy paste the R command you used to create the data frame, its name, and the resulting list of its contents into the green box below.
 
  1. Use the order() function to create a listing of the data in the musseldata data frame sorted first by species, and within species, sorted by length. Copy/paste your R command and the resulting listing into the green box below.
 
  1. Using the musseldata data frame, create a numeric vector called ratio that equals the dry weight (drywght) divided by the length. Add the ratio vector as a new variable (column) called ratio into the musseldata data frame, then type the name musseldata to display the data. Copy/paste your R commands and the resulting output into the green box below.
 

Solutions

Expert Solution

A.

B.

C.

D.


Related Solutions

(1) Read in the data and create an R data frame named tennis.dfr that has the...
(1) Read in the data and create an R data frame named tennis.dfr that has the following names for its columns: first.name, last.name, major.match.wins, major.match.losses, overall.match.wins, overall.match.losses, major.titles, overall.titles. (Note that the data file has several explanatory lines before the real data begin that should be skipped when reading in the data lines.) NOTE: For the file name, you must use the following web address (URL): "http://people.stat.sc.edu/hitchcock/tennisplayers2018.txt". Please do not have your code read in the file from your own...
Load the regression data in the file called wagedata.csv and answer the following questions: (a) Create...
Load the regression data in the file called wagedata.csv and answer the following questions: (a) Create an interaction between Ability and PhD (b) Run a regression with the interaction a constant Ability and PhD. Write down you estimators and the t-statistics (c) Compute the difference-in-difference estimate and write down you answer. (d) Test if the difference is significant by showing relevant steps, and write down the conclusion to the test. Wage Ability Phd 3.52942833628898 2.57892317214096 1 11.5241044105103 0.217444617867018 1 6.43708200805673...
a. In R there is an built in data frame Nile. This has the annual flow...
a. In R there is an built in data frame Nile. This has the annual flow in river Nile for year 1871 to 1971. Produce a time series plot. Print graph(s). b. add the title as "Nile River Annual Flow", x axis label as "Year" and y axis label as "Flow". Print graph(s). c. Add a horizontal line showing the average flow over these years. Print graph(s). d. Add text as: "Average Flow:" with the calculated average flow on the...
Name your c++ file Word_LastNameFirstName.cpp. Create a struct that has a word and the length of...
Name your c++ file Word_LastNameFirstName.cpp. Create a struct that has a word and the length of the word. Next, use the struct to store the word read from a text file call “word.txt” and the length of the word. Print out the word x number of times based on the length of the word as shown below. Also, print a statement with the length and determine if the string length has an odd number or even number of characters. You...
Write a C++ program in a file called pop.cpp that opens a file called pop.dat which...
Write a C++ program in a file called pop.cpp that opens a file called pop.dat which has the following data (you’ll have to create pop.dat) AX013 1.0 BX123456 1234.56 ABNB9876152345 99999.99 The data are account numbers and balances. Account numbers are, at most 14 characters. Balances are, at most, 8 characters (no more than 99999.99). Using a loop until the end of file, read an account number and balance then write these to standard output in the following format shown...
The accompanying data file contains 20 observations for t and yt.
The accompanying data file contains 20 observations for t and yt. t 1 2 3 4 5 6 7 8 9 10 yt 12.1 12.2 9.3 12.8 8.6 9.3 14.3 12.1 11.5 15.1 t 11 12 13 14 15 16 17 18 19 20 yt 13.5 9.8 9.6 14.5 14.9 12.4 11.2 8.8 11.8 10 a. Discuss the presence of random variations. The smoother appearance of the graph suggests the presence of random variations. The smoother appearance of the graph...
Instructions tell you how to get the data in R R has built in dataset called...
Instructions tell you how to get the data in R R has built in dataset called Iris. This famous (Fisher's or Anderson's) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica. We are interested in estimating the length of Petal (Y) using the length of Sepal (X). First, load the...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called main that does the following: Creates a directory called CyberSecurity-Notes in the current working directory Within the CyberSecurity-Notes directory, creates 24 sub-directories (sub-folders), called Week 1, Week 2, Week 3, and so on until up through Week 24 Within each week directory, create 3 sub-directories, called Day 1, Day 2, and Day 3 Bonus Challenge: Add a conditional statement to abort the script if...
Create a program that has an array of length 100 which will automatically be filled with...
Create a program that has an array of length 100 which will automatically be filled with randomly generated numbers between 1 and 100 each time the program is run. Have the program ask the user to enter a number between 1 and 100. Check to see if that number is one of the values in the array. If it is display “We found your number XX at position YY in the array” If the number is not in the array...
The accompanying data file contains 20 observations for t and yt. The data are plotted below....
The accompanying data file contains 20 observations for t and yt. The data are plotted below. t 1 2 3 4 5 6 7 8 9 10 yt 10.8 14.1 10.3 10.9 11.3 13.5 10.7 9.2 8.8 12 t 11 12 13 14 15 16 17 18 19 20 yt 9.8 11 15.1 12.5 12.9 12.3 9 14.9 10.1 11.9 b-1. Use the exponential smoothing method to make forecasts with α = 0.2. (Round intermediate calculations to at least 4...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT