#' Plot recursive sequence output
#'
#' This takes a data frame with four columns (The first three columns are the values
#' of the three numerics to be input to function 1 and the fourth column is the
#' positive integer n for the sequence to be generated). The function will return a
#' line plot of the output values for the different values of n.
#' @param x data frame
#'
#' @return line plot
#' @export recurseq2
#' @importFrom ggplot2 ggplot aes geom_line
#'
#' @examples my_data <- tibble::tribble(
#' ~x, ~y, ~z, ~n,
#' 2,4,3,3,
#' 2,4,3,4,
#' 2,4,3,5,
#' 2,4,3,6,
#' 2,4,3,7,
#' 2,4,3,8,
#' 2,4,3,9,
#' 2,4,3,10,
#' 2,4,3,12)
#' recurseq2(my_data)
recurseq2 <- function(x){
calcn2_v <- vector("numeric", length = nrow(x))
for(i in seq(calcn2_v)){
calcn2_v[i] <- recurseq1(c(x$x[i], x$y[i], x$z[i]), x$n[i])
}
output <- calcn2_v
n <- x$n
data.frame(output, n) %>%
ggplot2::ggplot() +
ggplot2::geom_line(ggplot2::aes(n, output))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.