Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to use Language R to solve this problem? The file indeafinger.tat records th

ID: 3863420 • Letter: H

Question

How to use Language R to solve this problem?

The file indeafinger.tat records the length and width of the index finger of 8 adults. Length is ezplanatory variable) (a) Read in the data set "indexfinger.txt" an print it out (b) Draw a scatterplot of the width and length (c) Find out the longest finger lengths of both male and female. Then mark this two points in the scatterplot in (a). You can use any aesthetic feature you like as long as these two points can be distinguished from other points (d) Draw a new scatterplot, but substitute all the points with letter "F" or "M" according to the gender. Hint: pch E as. character ser). For male the female conduct the linear regression separately to determine the relationship of width and length of fingers. Calculate the coefficients of these two models. Then you can use the results from the linear regression to draw two predicted lines on the scatterplot above by different line types (One line for male and the other for female

Explanation / Answer

(a)
indexfinger.data <- read.table("File location:/indexfinger.txt", header = TRUE, sep = ";", sep = ",")
print(indexfinger.data)

(b)
data <- read.table("File location:/indexfinger.txt", header = TRUE, sep = ";", sep = ",")
plot(data$length, data$width, ylim=c(0,750))

(c)
data <- read.table(h=T, text = "length width")
apply(data, MARGIN = 2, function(x) max(x, na.rm=TRUE))   
// data referz to the dataframe, MARGIN = 2 is to scan the columns , MARGIN = 1 is to scan the rows, function(x) is the function you wish to apply over your selected MARGIN.
//The above answer creates a user-defined function that finds the max value while disregarding NA values.
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote