Question

In: Computer Science

PLEASE ANSWER using R studio . VARIABLE ASSIGNMENT AND SIMPLE FUNCTIONS ## ######################################################### #Section 2 instructions:...

PLEASE ANSWER using R studio .

VARIABLE ASSIGNMENT AND SIMPLE FUNCTIONS ##
#########################################################


#Section 2 instructions:
#Answer the following questions by defining the provided objects.


#Question 2.1 (2 points)
#Create a numeric vector that contains all integers between 1 and 1,000 (inclusive)
aS2Q1 <-


#Question 2.2 (2 points)
#Create a numeric vector that contains all even integers between 2 and 1,000 (inclusive)
aS2Q2 <-


#Question 2.3 (2 points)
#Four strings are defined as character vectors below. Using the already defined
#character vectors, create a single character vector that combines all of them
#and separates the contents of each with a comma followed by a space.
str1 <- "The National Mall in Washington"
str2 <- "D.C. has monuments"
str3 <- "museums"
str4 <- "and scenery that draws many tourists from around the world."

aS2Q3 <-


#Question 2.4 (2 points)
#Translate the following mathematical function into an R function named "zFunction": z = (x + x^2 + x^3) - (y + y^2 + y^3)
#Then, evaluate for (x, y) = (3, 4) and save your answer to the provided object.

zFunction <-

aS2Q4 <-


#Question 2.5 (2 points)
#Create a four-element list where each element is your answer to questions 2.1-2.4.
#Name the four elements ans1, ans2, ans3, and ans4
aS2Q5 <-


#Question 2.6 (2 points)
#Display the element ans3 from the list created in question 2.5 using two different methods

Solutions

Expert Solution

Please give thumbs up to my answer, If you find it helpful.


#Question 2.1
aS2Q1 <- c(1:1000)

#Question 2.2
aS2Q2 <- seq(2,1000,2)


#Question 2.3

str1 <- "The National Mall in Washington"
str2 <- "D.C. has monuments"
str3 <- "museums"
str4 <- "and scenery that draws many tourists from around the world."
aS2Q3 <-c(str1,str2,str3,str4)

#Question 2.4

zFunction <- function(x,y){
z=(x+x*x+x*x*x)-(y+y*y+y*y*y)
return(z)
}
  
aS2Q4 <- zFunction(3,4)


  
#Question 2.5

aS2Q5 <- list(ans1=aS2Q1, ans2=aS2Q2, ans3=aS2Q3, ans4=aS2Q4)


#Question 2.6

aS2Q5['ans3']


Related Solutions

Please Use R studio to answer the question. This is the Statistics section of Comparing Groups....
Please Use R studio to answer the question. This is the Statistics section of Comparing Groups. One month before the election, a poll of 630 randomly selected votes showed 54% planning to vote for a certain candidate. A week later, it became known that he had had an extramarital affair, and a new poll showed only 51% of 1010 voters supporting him. Do these results indicate a decrease in voter support fo his candidacy? a) Test an appropriate hypothesis as...
Can You please Answer the question using R studio and R cloud Telomeres are complexes of...
Can You please Answer the question using R studio and R cloud Telomeres are complexes of DNA and protein that cap chromosomal ends. They consist of the same short DNA sequence TTAGGG repeated over and over again. They tend to shorted with cell divisions and with advancing cellular age, which will lead to chromosome instability or apoptosis (programmed cell death). Eukaryotic cells have the ability to reverse telomere shortening by expressing telomerase, an enzyme that extends the telomeres of chromosomes....
I want this to be solved using R studio or R software, please. Here is the...
I want this to be solved using R studio or R software, please. Here is the example: The data in stat4_prob5 present the performance of a chemical process as a function of sever controllable process variables. (a) Fit a multiple regression modelrelating CO2product (y) to total solvent (x1) and hydrogen consumption (x2) and report the fitted regression line. (b) Find a point estimatefor the variance term σ2. (c) Construct the ANOVA tableand test for the significance of the regression using...
Instructions for C++ project This Assignment will Focus on Software Engineering: Using Functions in a Menu...
Instructions for C++ project This Assignment will Focus on Software Engineering: Using Functions in a Menu Driven Program Hint: Chapter 6 Program 6-10 is a great example of this type of programs. Your Task: Write a calculator Program with following functions (lack of function will result in a grade of zero). Your program must have the following menu and depending on the users choice, your program should be calling the pertaining function to display the result for the user. 1...
Using R-Studio please answer the following questions and show your code. 1. Julie buys a take-out...
Using R-Studio please answer the following questions and show your code. 1. Julie buys a take-out coffee from one of two coffee shops on a random basis: Ultimo Coffee and Joe’s Place. This month, she measured the temperature of each cup immediately after purchase, using a cooking thermometer. Sample data is shown below, temperatures are in Fahrenheit. ultimo =  c(171,161,169,179, 171,166,169,178,171, 165,172,172) joes = c(168,165,172, 151,162,158,157,160, 158,160,158,164) State the null and alternative hypothesis in your own words. What type of statistical...
Instructions: You are not required to use R markdown for the lab assignment. Please include ALL...
Instructions: You are not required to use R markdown for the lab assignment. Please include ALL R commands you used to reach your answers in a word or pdf document. Also, report everything you are asked to do so. Problem 3 : In lab lecture notes and demo code, I simulated random samples from Exp(1) to verify classical central limit theorem numerically. I also stressed that no matter what type of random samples you use, the standardized partial sum Sn...
Instructions: You are not required to use R markdown for the lab assignment. Please include ALL...
Instructions: You are not required to use R markdown for the lab assignment. Please include ALL R commands you used to reach your answers in a word or pdf document. Also, report everything you are asked to do so. Problem 1 : Consider a binomial random variable X ∼ Bin(100, 0.01). 1. Report P(X = 7), P(X = 8), P(X = 9), try to use one ONE R command to return all these three values. 2. Find the probability P(0...
Using R-Studio find the answer to The average number of patrons arriving at a restaurant per...
Using R-Studio find the answer to The average number of patrons arriving at a restaurant per hour is eleven. What is the probability that eight or less will arrive in the next hour? 1. 0.232 2. 0.173 3. 0.1432 4. 0.8881
I have an assignment that must be done on R/R studio R/RStudio - Chapter 4- Correlation...
I have an assignment that must be done on R/R studio R/RStudio - Chapter 4- Correlation and Regression Step 1 – Download and Install the R/RStudio software on your computer. The link and instructions to do that are on Blackboard under Course Information. Step 2 – Access the Data Sets in MyLab through StatCrunch. In chapter 4, a data set called “Used BMW prices 2017” is what we’ll use. Step 3 – When you open the data set in StatCrunch,...
Please Use R studio and show all the steps to answer this question NY Marathon 2013...
Please Use R studio and show all the steps to answer this question NY Marathon 2013 the table below shows the winning times (in minutes) for men and women in the new york city marathon between 1978 and 2013. (the race was not run in 2012 because of superstorm sandy.) assuming that performances in the big apple resemble performances elsewhere, we can think of these data as a sample of performance in marathon competitions. Create a 90% confidence interval for...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT