Posts

Showing posts from October, 2023

Week 10: Building your own R Package

Hi everyone! This week we learned about R packages and creating our own! The first step is loading in the devtools and roxygen2 packages and then setting up the description page and naming the package.  I was interested with the hiring letter function I started developing in the S3 and S4 module, so I decided to make that an actual template for employers to use in a easy to access R package. Check out GitHub to see my DESCRIPTION page for the hireLetter package I am creating! Final Project Proposal My final project proposal is the hireLetter package. This package will include a function called pass() and fail() where a data frame of employee information and qualifications is inputted as the parameter to output a list of individuals who either pass or fail the employer's expectations. The other function add-ons include the acceptedL() and rejectedL() that customizes a letter for the inputted parameter of the person's name of either acceptance or rejection. I may add more funct...

Week 9: Visualizations

Image
Hi everyone! This week we learned about three types of visualization including basic graphics, lattice, and ggplot2. Basic graphics encompasses functions such as plot() for line graphs, barplot() for bar plots, and hist() for histograms. We can customize symbols, line types, and colors in these visualizations. The lattice package uses the function xyplot(y~x) for plots and bwplot() for box plots. The advantages of this package is multi-conditioning with many panels in one output and convey additional information easier. The ggplot2 package is great for visualizations and is structured as ggplot(dataframe, aes(x,y)) + geom_[].  Choose any data set for your visualization from Vincent Arel Bundock dataset list:  https://vincentarelbundock.github.io/Rdatasets/datasets.html Links to an external site. Using this data, generate three types of visualization on the data set you have chosen. In your blog, discuss and present your three visualizations you will create and express your opi...

Week 8: Inputs and Outputs

Image
Hi everyone! This week we learned about inputs and outputs, string manipulation, and the plyr package in R. Among the functions learned, read.table() and ddply() are particularly interesting. The function read.table() can be used to read in a text file to use in R. The ddply() function can be used to split by a category such as gender to order data, while you can also modify this new data frame using transform and calculate a new column.  Please following steps 1-3 Step # 1   Import assignment 6 Data-set to R   Download Import assignment 6 Data-set to R . Then, Run the commend "mean" using Sex as the category (use plyr package for this operation). Last commend in this step:  write the resulting output to a file. In data frame y, you can see the students are separated into females first and males second with the new grade average column added. Step # 2  Convert the data set  to a  dataframe for names whos' name contains the letter i, then crea...

Week 7: S3 vs S4 objects

Hi everyone! This week we learned about S3 and S4 objects. Objects in R store data elements and are part of classes where you can use different methods or functions to operate on them. An object can be a vector, variable, list, matrix, etc. In R, the two types of objects are S3 used for informal methods from the beginning and S4 used for formal methods in classes and methods developed later.  Download any type of data (from the web or use datasets package) or create your own set.  Then, on the second step, determine if generic function as discussed in this module can be assigned to your data set, and if not, why? (Example, here is list of data set in R) data("mtcars") head (mtcars, 6) list(mtcars, 6) In third and last step, explore if S3 and S4 can be assigned to your data set. I created a dataset of two potential employees with their name, age, years of experience, and the role they are applying to. The generic function print works, but functions such as mean do not because ...