Question
Create a text vector called Months with names of the 12 months of the year. Create a numeric vector Summer, with Calendar month index positions
-
Create a text vector called Months with names of the 12 months of the year.
-
Create a numeric vector Summer, with Calendar month index positions for the summer months (inclu-
sive, with 4 elements in all).
-
Use vector indexing to extract the text values of Months, indexed by Summer.
-
Multiply Summer by 3. What are the values of Months, when indexed by Summer multiplied by 3? Why do you get that answer?
-
What is the mean (average) summer month, as an integer value? Which value of Months corresponds to it? Why do you get that answer?
-
Use the floor() and ceiling() functions to return the upper and lower limits of Months for the average Summer month. (Hint: to find out how a function works, use R help if needed.)
-
Using the data below, how many visits did Berts store have?
-
store.num <- factor(c(3, 14, 21, 32, 54)) # store id store.rev <- c(543, 654, 345, 678, 234) # store revenue, $1000 store.visits <- c(45, 78, 32, 56, 34) # visits, 1000s store.manager <- c("Annie", "Bert", "Carla", "Dave", "Ella") (store.df <- data.frame(store.num, store.rev, store.visits, store.manager, stringsAsFactors=F))
-
Answer using Program R
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started