Generation

generate functionSun, 19 Mar 2023

# A group of analysist have recognized that a given variable F in their study demonstrates a harmonic-geometric pattern. the sequence of numbers {πΉπ}π=1β defined by the non-linear recurrence equation: Fn=(F(n-1)/n) * a a. You should check if x, a and f1 are vectors with multiple components and pick their first component only. b. You should check if x, a and f1 are character variables. If at least one of them is a character variable, the function must display the message: "Invalid Argument. A single integer is expected." Then return NA. c. Before the function begins its core operation, you should check if x, a and f1 are positive numbers and return NA if any one of them is not. d. Before the function begins its core operation, you should check if x, a and f1 are numeric and convert them into an integer. Define the R function "runFSequence" to accept THREE single integer parameters x, a and f1 and return a vector of x number of F values [x = the number of F values to return, a = the multiplier, f1 = the starting number].

``````runFSequence <- function(x, a, f1) {