Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Type the R code to compute , where is a variable. Use the script equation.R to type your code, run the script and submit the

Type the R code to compute , where is a variable. Use the script equation.R to type your code, run the script and submit the computed hash value.

Answering this question will require the use of RStudio.

the script equation.R below.

################################################################################# testCode<-function(x){########################################################### ################################################################################# ################################################################################# ## Complete the task below, source the script and submit the code hash number.

## Write the code to compute the provided equation from the quiz question ## using the variable x and assign the result to y. y <- # insert code here

################################################################################# ###################### Do not edit the code below this line! #################### return(y)}; z<-c( -85.77,34.98,-32.63,-80.46,65.13,13.17,48.79,25.73,35.45,-79.4,-39.26,-87.18,-47.99,-65.55,-36.78,53.79,97.33,-6.88,61.43,76.52,24.51,42.3,-55.31,84.88,52.44,92.75,29.77,-68.03,8.23,-95.58,-49.33,87.75,89.23,-25.14,2.65,-89.07,47.65,36.54,65.36,-13.99,-54.95,94.66,-68.77,75.96,21.2,98.51,41.91,59.89,47.52,-11.4 );hash<-sum(abs(diff(as.integer(sapply(strsplit(paste(unlist(lapply(z, testCode)), collapse = ""),"")[[1]], charToRaw)))))%%1e6; print(paste("Provide the followning code hash value as your quiz question answer:", hash)) print(paste("Test input:", z[1])) print("Test output") print(testCode(z[1]))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions