I'm trying to figure out how to solve one of the supplemental questions from chapter 2. What's wrong with my code?
Using ```r at the beginning and ``` at the end of your code, you can insert code as below:
# Ask for a positive number and return a vector of all the numbers
# between 1 and the input.
ask <- function() {
z <- readline("enter a positive number: ")
z <- as.numeric(z)
return(1:z)
}
ask()
I've tried running this and it doesn't seem to work!
This is an Example Question
I'm trying to figure out how to solve one of the supplemental questions from chapter 2. What's wrong with my code?
Using ```r at the beginning and ``` at the end of your code, you can insert code as below:
I've tried running this and it doesn't seem to work!