For each of the following problems, save your work to a read a file Many of your
ID: 3782642 • Letter: F
Question
For each of the following problems, save your work to a read a file Many of your answers will only a single line. Name your files Iike __HW1_. So my file for problem 2 would Hendrix_Jermany_HW1_2.rda Upload your five files to DropBox. Write an script that will allow a user to enter as many numbers at they would like and then print out "The mean of your data is x" where x is the calculated mean of the data entered. Write an R function that accepts a single vector and than prints 'The maximum value in your vector is X and it occurs Y times" where X is the max value and Y is the number of times it occurs in the vector. For the next set of problems, refer to section 2.7.1 if you need help. Save the file temperatures txt from Pilot to your local hard drive. Use the following commands to load the data into a variable called data dataExplanation / Answer
As per chegg policy i will answer only 3 questions.
1) N <-as.integer(readline(prompt="Enter N "));
sum=0;
dup=N; #duplicating N
while(N>=1)
{
num<-as.integer(readline(prompt="Enter numbers"));
sum = sum + num;
N=N-1;
}
sum=sum/dup;
print(paste("The mean of your data is", sum))
2)
b <- c(2,5,6,1,2,6,6,6);
fn <- function(b) {
max=which.max(b);
num=sum(b == b[3])
print(paste("The max is",b[max]," and count is", num))
}
fn(b)
3)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.