Skip to main content

Posts

Matrix Operations and Bioinformatics Insights: Week 6

 Matrix Operations and Bioinformatics Insights: Week 6 This week, I worked on an assignment focused on using R for matrix operations and did some bioinformatics practice related to CDR3 sequences. Here's a simple breakdown of what I did and my takeaways. What I Did This Week Adding and Subtracting Matrices I started by creating two matrices, and then added and subtracted them using R. Here's the code I used: This code performs basic matrix operations, and it was a good way to understand how matrix math works in R. Building a Diagonal Matrix Next, I used the diag() function to create a matrix with specific values on the diagonal. The code looked like this: Creating a Custom Matrix I then built a matrix with specific values in the rows and columns > diag(3,5). Here's how I did it: This code sets up the matrix with a diagonal of 3 and modifies the first row and column. It was a fun challenge that helped me see how to control matrix structure using R’s indexing features. Bi...

Week 5: Matrix Operations and a bit of Data Manipulation

  Week 5: Matrix Operations and a bit of Data Manipulation  Objective This week’s assignment focused on matrix operations, specifically finding the inverse and determinant of matrices. Additionally, I explored some data manipulation techniques, which I will summarize below. Part 1: Matrix Operations Matrix Creation I created two matrices: Matrix A : A 10x10 matrix containing values from 1 to 100. Matrix B : A 10x100 matrix containing values from 1 to 1000. Determinant and Inverse of Matrix A The   determinant   of   Matrix A   was found to be   0 , indicating that it is   singular   and does not have an inverse. Matrix B   is non-square (10x100), so it cannot have a determinant or an inverse. Error Handling When attempting to compute the inverse of   Matrix A   using the   solve()   function, R returned an error indicating that the matrix is singular. This message means that the matrix does not have an inverse because...

Week 4: Analyzing Patient Blood Pressure and Medical Ratings

 Week 4: Analyzing Patient Blood Pressure and Medical Ratings In this week’s assignment, I worked with a dataset collected by a local hospital that includes various observations from eight patients. The data consists of five variables: frequency of hospital visits (Freq), blood pressure measurements (bloodp), first assessment by a general doctor (visit_1), second assessment by an external doctor (visit_2), and the final decision regarding immediate care (visit_3). Data Overview The dataset features a mix of patient blood pressure readings and medical assessments. The "first" and "second" columns indicate the ratings from the doctors (with "bad" coded as 1 and "good" as 0), while the "finaldecision" column reflects the emergency unit’s decision on the patients' care (low = 0, high = 1). Data Visualization I created a side-by-side boxplot and a histogram to visualize the blood pressure data. The histogram illustrates the distribution ...

Week 3 Blog: Playing with DataFrames—Correcting Errors and Analyzing Fictional Poll Results

  Week 3 Blog: Playing with DataFrames—Correcting Errors and Analyzing Fictional Poll Results Introduction This week's assignment involved working with a fictional dataset representing poll results from the 2016 U.S. Presidential election. The dataset included seven candidates and their results from two polling sources: ABC and CBS. However, before diving into the analysis, I encountered a few errors in the initial dataset that I had to correct. Initial Errors and Corrections The data I was provided had some formatting issues that needed fixing before I could proceed. For example: Quotation Marks:   Some of the names had incorrect quotation marks ( “ ”   instead of   " ), which R couldn’t recognize. I fixed this by replacing all smart quotes with regular quotation marks ( " ). Commas:   The ABC and CBS poll results had some missing commas. Without proper separation, R would misinterpret the values. I inserted the missing commas to correctly format the vectors. H...

Week 2: Fixing the myMean Function and Understanding Flexibility in Function Inputs

  Week 2: Fixing the   myMean   Function and Understanding Flexibility in Function Inputs Introduction This week, my assignment involved evaluating and debugging a custom function called   myMean , which calculates the mean (average) of a dataset. While the concept behind the function was simple, there were a couple of key issues with the inputs that prevented it from working correctly. Here's a walkthrough of the problem, how I approached it, and the final solution. The Problem The original function I was asked to evaluate was defined as follows: The dataset provided to test this function was: At first glance, the function seemed like it should calculate the sum of the vector and divide it by the number of elements. However, there were two key issues: Incorrect Input in   sum() : The function was using   sum(assignment) , which referenced a variable not passed into the function. Incorrect Input in   length() : The function referenced   length(som...

Journey Through R Programming: Week 1

  Journey Through R Programming: Week 1 Introduction Welcome to my blog! As part of my Open Source R course with Professor Alon Friedman at the University of South Florida, I’m excited to document my weekly progress in learning R programming. A bit about me: I’m currently pursuing a Master’s in Bioinformatics & Computational Biology, following an undergrad in Biotechnology. My programming journey began with Python through the “100 Days of Code: The Complete Python Pro Bootcamp” on Udemy, which included around 8 mini projects. This experience has made transitioning to R a bit smoother, as many concepts overlap. To support my learning, I’m using the book  The Art of R Programming  and the edX course  Data Science: R Basics  from Harvard University. These resources have been invaluable in deepening my understanding of R. Summary 1. Function Creation Objective: Create a function to count the number of odd numbers in a vector. Code: What I Learned: The modulus op...