Sunday, March 17, 2024

Module #10 Building your own R package

 This assignment was tricky because I have never before considered being able to create my own R-package before and considered it to be more of a "professionals-only" kind of thing. Regardless, I was interested in finding something inspiring enough to create a package for. I was intimidated by the examples given, mostly because they seem so confident in their premise and goal, but I think I have a proposal for a potential R package that I would be interested in creating; my main concern is developing functions, finding data, and applying R skills to create a package with so many qualities. My proposal for ma final project would be a package that uses data to illustrate geographic data corresponding to forestation and deforestation. I would prefer to limit geographical aspect to South America simply because of its significance to the deforestation problems there and also because I want to limit the scope of the package. I'm not sure how I would do this, but I'm hoping that it's easier than it seems. Link to my GitHub: James GitHub

Sunday, March 3, 2024

Module #8 Input/Output, string manipulation

 This assignment was designed to understand manipulating datasets and being able to interpret their properties through R. 

I naturally imported the file this way out of habit, although the way presented in the module is equally as fruitful for inputting a dataset into R.  I initialized the dataset and placed it into a more user-friendly name to use simply called "data.set". I then used the given hints to create a dataframe that collected names from the dataset that contained the letter "I" and also the given frame for "sex" and the mean grade average.

The final data frame, containing only the names with "i" was saved using the write.csv() function. There's currently no way to incorporate a file into blogger so a screenshot is attached to show the final product:



Sunday, February 25, 2024

Week 7 S3 VS S4 Objects


  1. How do you tell what OO system (S3 vs. S4) an object is associated with?                               In S3, objects are defined by the information already known by the characteristics of the object; a character or numeric are recognized in R for their attributes. S4 relies on the designation determined by a user or creator of the data. setClass() produces circumstances where the classes are harder to change and are set apart at the beginning. In addition, many features pertaining to syntax and etiquette separate these systems. For example, rather than using the argument data.frame$variable to identify a column within a data set, S4 used @ and "slot" to call variables and specific instances of data. 

  2. How do you determine the base type (like integer or list) of an object?                                   Both systems are capable of taking advantage of the class() function to determine the class type of an object. Mode is also a tool that can be used to recognize the base type of objects within R. 

  3. What is a generic function?                                                                                                      A generic function is a simple sequence of code that fulfills a command or task. The methods and route can be different however the purpose and ultimate result is a single goal. 

  4. What are the main differences between S3 and S4?                                                               S3 and S4 have two main differences as listed in the lecture: Firstly, S3 objects have classes and methods identified from the beginning, which are considered more informal and widely used. S4 objects have their classes and methods developed later and take a more formal and spatial methodology. Secondly, the language and protocols for articulating commands are different. Language and syntax provide the most visually distinct differences between the two object programming. 

  5. In your GitHub, create two examples of S3 and S4. Week 7 GitHub

Thursday, February 15, 2024

Module #6 Doing Math Part II

 Module 6 built on the previous module. This weeks lecture and reading were related to additional function of linear of algebra and the different expressions of them through the use of matrices. The assignment for this week thus focused on the generation and calculation of numbers through the application of matrices. My code for this week looked like this:

I was able to quickly apply the concepts we learned last week to determine sum/difference of the two provided matrices in step one. Step two asked to create a matrix containing four rows and columns that produced a diagonal of "4,2,1,3". I use the c() function to combine the numbers as the first argument and generated the following matrix:
I had some difficulty with the last step. As shown in the first screenshot, I had tried a few different inputs to manufacture the expected matrix, however could not find the right combination that would produce it. I looked in the online textbooks and online but the exact array that the assignment wanted w was not forthcoming. I could recognize the pattern but communicating that with R was difficult. A few of the attempts not shown were identical to a few sources online that shifted the pattern but R would ignore or fail to run these. 

Saturday, February 10, 2024

Module #5 Doing Math

 This assignment was primarily concerned with the use of matrices within R. 

The first part of this task was to create matrices that printed 100 and 1000 numbers across 10 rows, respectively. The matrix A contained 1:100 and matrix B contained 1:1000. The first step was to create two vectors. I decided to use the runif() function to create my vectors. 

The results are a randomized sequence of numbers generated to fill the vector without concern for significant figures or specific characteristics. The distribution is as such likely normal. The second task was to find the determinant of the matrices and use a few calculations to find out more about the data. This step involved multiplying the matrices by the vectors and the matrices by one another; the new matrices were used to apply the det() function and find the determinant. 
The outputs were as such:

In hindsight I think I should have put more restrictions on the randomly generated numbers. Size and digits contributed to a messy string of numbers that allowed for longer series to be printed. 



Thursday, February 1, 2024

Module 4 Programming structure in R

The first part of this assignment required the initialization of 5 variables and 10 patients. 



In addition, I chose to create a data frame to better understand the data. 
The goal of this assignment was to graphically present the data in the form of a boxplot and a histogram. 
The two graphical representations reflect the general distribution of the blood pressure reported by the patients. There are a multitude of different calculations and determinations to be make about the data, however the small sample size makes it difficult to make assertions about the trends and characteristics of the data, 












Thursday, January 25, 2024

Module 3: Data Frames

 The dataset for this assignment was related to the construction of a data frame. Poll results from two news stations were included and reported on the results for seven candidates. To create this data frame using the provided data, I listed the names and poll numbers in a series of vectors

Next, I created the data frame using the "data.frame" function within R. In addition, I used the "cbind" function to incorporate the data from the CBS vector. 

I wanted to create column and row names in order to identify the candidate votes and which station these were reported from. "Colnames" and "rownames" allowed me to input new titles for the data frame. 
This is the final outcome for the data frame after these steps were taken. It provides a more organized and concise appearance, allowing comparative insight to be made about these reports.
With this data frame, we can utilize other functions within R to determine a great number of qualities about the data. 






Module #10 Building your own R package

 This assignment was tricky because I have never before considered being able to create my own R-package before and considered it to be more...