Question

In: Statistics and Probability

Perform the following tasks on R Studio/R Construct a function called conv3 which inputs a measurement...

Perform the following tasks on R Studio/R

Construct a function called conv3 which inputs a measurement in centimeters and outputs the corresponding measurement in inches. However, if a negative value is entered as an input, no conversion of unit is done and an error message is printed instead.

Solutions

Expert Solution

The R is as follows :

conv3 <- function(x){if (x>=0) {
x/2.54
} else {
"no conversion of unit is done "
}}


Related Solutions

Perform the following tasks on R Studio Construct a function called conv1 which inputs a measurement...
Perform the following tasks on R Studio Construct a function called conv1 which inputs a measurement in centimeters and outputs the corresponding measurement in inches and construct another function called conv2 which inputs a measurement in centimeters and outputs the corresponding measurements in inches, feet, and meters
1) a) Write a MATLAB function called Area1 having two inputs, r and N, and an...
1) a) Write a MATLAB function called Area1 having two inputs, r and N, and an output, A1. The output A1 should be the area under a curve, f(x), for x starting at x_start and ending at x_end. The input r should be a vector (array) having x_start and x_end as its two elements. The input N should be an integer equal to the number of equallength sub-intervals in which the interval from x_start to x_end should be divided. Here,...
pl use r studio to do that What is the most appropriate analysis to perform on...
pl use r studio to do that What is the most appropriate analysis to perform on the following data?   x<-c(8.1, 9.4, 9.9, 9.6, 10.7, 10.2, 10.4, 13.6, 15.5, 17.8) Y<-c(7.3, 8.6, 9.9, 9.6, 9.3, 9.2, 10.9, 10.7, 11.4, 16.1) Determine Spearman’s Rho coefficient (2dp) for the following data. x<-c(56,56,65,65,50,25,87,44,35) y<-c(87,91,85,91,75,28,122,66,58)
Hello, i have this excersice in R studio Write a function in R that generates simulations...
Hello, i have this excersice in R studio Write a function in R that generates simulations of a Poisson random variable as follows: define I = [λ], and use p_i + 1 = λp_i / (i + 1) to determine F recursively. Generate a random number U, determine if X≤I by comparing if U≤F (I). If X≤I searches downwards starting at I, otherwise it searches upwards starting from I + 1. Compare the time it takes for the two algorithms...
what is the function of gene To perform vital tasks in cell, like transporting ions To...
what is the function of gene To perform vital tasks in cell, like transporting ions To contain information for building various cellular products To help cells move toward fuel and away from threats To allow cells to behave dynamically
construct an AOV table including expected mean squares in R studio A study was designed to...
construct an AOV table including expected mean squares in R studio A study was designed to evaluate the effectiveness of new treatments to reduce the systolic blood pressure of patients determined to have high blood pressure. Three drugs were selected for evaluation. There are numerous nondrug treatments for reducing blood pressure including various combinations of a controlled diet, exercise programs, biofeedback and so on. the researchers randomly selected three non drug treatments for examination in the study. The age of...
In R studio Write a function that takes as an input a positive integer and uses...
In R studio Write a function that takes as an input a positive integer and uses the print() function to print out all the numbers less than the input integer. (Example: for input 5, the function should print the numbers 1,2,3,4 { for input 1, the function should not print a number.) Use the lapply function, do not use any of the loop commands in your code.
R studio programing . can someone do an example of when to perform a one-sample wilcox...
R studio programing . can someone do an example of when to perform a one-sample wilcox signed-rank test. after, show modification to the previous function to perform a hypothesis comparing 2 population center with independent samples (mann-whitney test).
Write a function called tokenizeTelNum that inputs a telephone number as a string in the form...
Write a function called tokenizeTelNum that inputs a telephone number as a string in the form (555) 555-5555. The function should use the function strok to extract the area code as a token, the first three digits of the phone number as a token and the last four digits of the phone number as a token. The seven digits of the phone number should be concatenated into one string. The function should convert the area code string to int and...
construct a bijective function of f:[0, inf) -> R   
construct a bijective function of f:[0, inf) -> R   
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT