Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are given messy.csv containing submissions for an online form regarding regi

ID: 3663504 • Letter: Y

Question

You are given messy.csv containing submissions for an online form regarding registration for an event. These files contains raw submissions from the online form and
we want to filter these submissions to only show viable event attendees. Write an
R script to generate clean.csv with the constraints listed below. Provide R code for
your solution.
(a) All attendees must be over 19 and younger than 70 years old
(b) Names can only have letters from A–Z and spaces in them
(c) Favorite food can be only one of Salad, Pizza, or Pasta

Explanation / Answer

install.packages("caTools") # external package

library(caTools)         # external package write.gif function

jet.colors <- colorRampPalette(c("green", "blue", "red", "cyan", "#7FFF7F",

                                 "yellow", "#FF7F00", "red", "#7F0000"))

m <- 1000             # define size

C <- complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),

              imag=rep(seq(-1.2,1.2, length.out=m), m ) )

C <- matrix(C,m,m)             # reshape as square matrix of complex numbers

Z <- 0                   # initialize Z to zero

X <- array(0, c(m,m,20))     # initialize output 3D array

for (k in 1:20) {        # loop with 20 iterations

Z <- Z^2+C             # difference equation

X[,,k] <- exp(-abs(Z)) # capture results

}

write.gif(X, "Mandelbrot.gif", col=jet.colors, delay=900)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote