iPad 7:08 PM Notes #Please write your R codes in this file and submit it online
ID: 3741988 • Letter: I
Question
iPad 7:08 PM Notes #Please write your R codes in this file and submit it online at Canvas #You file name should be LastnameFirstname - #1 Please clear all objects in the memory #2 assign "Welcome to Harvard University" to a variable, message, and print it out #3. Generate a vector v1 containing elements: 100, 200, 1000, 5000 #4. Print out the type of v1 #5. Print out the length of v1 #6. Generate a vector v2 containing elements from 10 to 100000 #7 Generate a vector V3: from 100 to 1000 with step size of 0.05 #8. Print out the length of V3 #9 Generate a vector v4: from 100 with step size of 0.001 with length of 1000000 #10 Generate a vector x-(1,2,3,4,5); y: (10,9,8,7,6) # find the sum of x+y and the product of x and yExplanation / Answer
#1
rm(list = ls())
#2
message <- "Welcome to Harvard University"
print(message)
#3
v1 <- c(100, 200, 1000, 5000)
#4
print(typeof(v1))
#5
print(length(v1))
#6
v2 <- seq(10, 100000, by=1)
#7
v3 <- seq(100, 1000, by=0.05)
#8
print(length(v3))
#9
v4 <- seq(100, by=0.001, length.out = 1000000)
#10
x <- c(1, 2, 3, 4, 5)
y <- c(10, 9, 8, 7, 6)
sum <- x + y
product <- x * y
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.