hw04p.marc.estevadeordal is homework 4 for STAT 613.
Name: Marc Estevadeordal
Github: marc-estevadeordal
This is an example of the functions in this package:
library(hw04p.marc.estevadeordal)
Function fun_rec_seq
calculates a recursive sequence where element n
is the sum of element n-1 and the difference between elements n-2 and
n-3 divided by n.
fun_rec_seq(x = c(2, 3, 3), n = 3)
#> [1] 3
fun_rec_seq(x = c(2, 4, 3), n = 4)
#> [1] 2.5
fun_rec_seq(x = c(2, 4, 3), n = 5)
#> [1] 2.7
fun_rec_seq(x = c(2, 4, 3), n = 6)
#> [1] 2.783333
fun_rec_seq(x = c(2, 4, 3), n = 7)
#> [1] 2.754762
We then use function fun_plot
to allow the user to input a data frame
with four columns, and runs fun_rec_seq
to generate a line plot.
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)
fun_plot(my_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.