First R Exercises
Make a new R Project called 1_intro_to_r_homework_YOURNAME (where you fill in your name with underscores). In it, create a markdown folder where you will make a Quarto document for this homework. Make sure you compile your homework. Once done, zip the whole project folder up and submit on Canvas.
On the quarto document, answer the following questions using code blocks but also writing text to explain your answers.
Create a vector of 100 randomly distributed numbers between 0 and 100 using the
runif()function and save the vector into the variablemy_vec. What information doesstrandsummarytell you aboutmy_vec? How do they differ?Try out a little plot. What does
hist(my_vec)show you? What information does the helpfile forhisttell you about what you just did?Install a package! Install the
ratdatpackage usinginstall.packages(ratdat). Once you have done that, load the ratdat library usinglibrary(ratdat). Please comment out the loading ofinstall.packages()in your code block, as you only need to install once!Ratdat has a data set called
complete. Apply the following functions to complete:class,str,summary. What do these three functions tell you about complete? Look at the helpfile forcomplete- what does it tell you that meshes with the output of the above functions.To run a function from a library without loading is, we use the syntatx
name_of_library::function_name()- so library first, ::, and then the function. Usevisdat::vis_dat()on complete. What does it tell you? How might this be useful relative to just using the functions from question 4? NOTE: If you do not have the library, you might have to install it withinstall.packages()again. You can just do this in your console instead of in the quarto document.Same question as 5, but, this time try out
skimr::skim()as well asnaniar::miss_var_summary()on complete. What do they tell you.I know it’s early, but, if I asked you right now, what kind of data are you thinking about working with for your final project? Give me a brief description of the what it is and what you might want to explore. This isn’t a final thing, but I want you to start dreaming.