Posts

Showing posts from February, 2021

Module 7: Object Oriented Programming

Image
This week we will be exploring object oriented programming (OOP).  GitHub Link:  https://github.com/Ant-nguyen/Intro_r_2021/blob/main/Module7.R Our assignment this week is to obtain any type of data and then try to determine what generic functions can be assigned to the data set. Then see how we can utilize S3 and S4 class structures and OOP paradigms in the data. This week I decided to challenge myself a bit and use a slightly unconventional type of data, a sequence of genomic data. The goal being to try to utilize OOP methods when tackling a sequence of DNA.  For those who are unfamiliar with DNA transcription I will be covering some of the basics through out but the following video is a simple to understand explanation of some of the concepts I will be dealing with: Link to DNA data:  https://www.ncbi.nlm.nih.gov/nuccore/JX262162 Raw genomic sequence:  https://www.ncbi.nlm.nih.gov/nuccore/JX262162.1?report=fasta Let us begin First let me begin by explaining w...

Module 6: Doing math with R. Part 2

Hello this week we will be continuing our exploration of different mathematical functions we can do using R. Github link:  https://github.com/Ant-nguyen/Intro_r_2021/blob/main/Module%206.R Our assignment this time are the following tasks : 1. Consider A=matrix(c(2,0,1,3), ncol=2) and B=matrix(c(5,2,4,-1), ncol=2). a) Find A + B b) Find A - B 2. Using the diag() function to build a matrix of size 4 with the following values in the diagonal 4,1,2,3. 3. Generate the following matrix: ##      [,1] [,2] [,3] [,4] [,5]      [1,]  3    1     1     1    1      [2,]  2    3     0     0    0      [3,]  2    0     3     0    0      [4,]  2    0     0     3    0      [5,]  2  ...

Module 5: Doing math with R. Part 1

This week's assignment we will focus on matrices and the linear algebra we can do using R. We are given two matrices specifications: A=matrix(1:100, nrow=10) B=matrix(1:1000, nrow=10) And told to find an inverse of a matrix and determinant of a matrix using these values. The goal here is starting with these values, we will manipulate these in order for us to attain an inverse matrix and a determinant. Github link : https://github.com/Ant-nguyen/Intro_r_2021/blob/main/Module%205.R Let us begin First we must create matrices A and B in R. To do this we simply assign the matrices to the corresponding variables: A <- matrix(1:100, nrow=10) B <- matrix(1:1000, nrow=10) We get the following matrices: A <- matrix(1:100, nrow = 10) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1 11 21 31 41 51 61 71 81 91 [2,] 2 12 22 32 42 52 62 72 82 92 [3,] 3 13 23 33 43 53 63 73 83 93 [4,] 4 14 24 34 ...

Programming structure assignment (Doctors diagnosis and BP)

Image
This week's assignment we are given a mock up of patients' frequency visiting the hospital(Freq), their blood pressure(BP), and three different doctors rating on the patients condition. The first doctor is a general doctor and is simply stating "bad" or "good", and the other two doctors are external doctors rating the patients condition based on decision regarding immediate care( low or high). We are told to give these rating numerical representation based on either 1 or 0. (bad = 0, good =1) and low = 0 ,high = 1) Variables are : Freq, BP, "First", "second", "final". 1.    "0.6","103","bad","low","low” 2.     "0.3","87","bad","low","high” 3.     "0.4","32","bad","high","low” 4.      "0.4","42","bad","high","high" 5.     "0.2","59...