Skip to main content

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 operator (%%) helps identify odd numbers.
  • Using loops in R allows you to process each element in a vector.

2. String Operations

Objective:

Manipulate and split strings in R.

Code:

What I Learned:

  • paste() joins multiple strings into one.
  • strsplit() splits a string based on a delimiter.


3. Matrix Manipulation

Objective:
Create and access elements in matrices.

Code:




What I Learned:

  • cbind() combines vectors into a matrix.
  • Such indexing allows for easy retrieval of specific elements.


4. Exploring Data with dslabs

Objective:

Analyze the murders dataset from the dslabs package.

Code:





What I Learned:

  • summary() provides a quick overview of the dataset.
  • Functions like str() and head()/tail() help understand data structure and content.


5. Data Visualization

Objective:
Create various plots to visualize data.

Code:

                                       

What I Learned:

  • Scatterplots, histograms, and boxplots are useful for visualizing different aspects of the data, with each function serving the data in a new way.


Additional Resources

For more detailed notes from my R programming journey, check out my comprehensive notes here. Additionally, you can explore my GitHub repository with all my work and projects here.


Conclusion

The first week of exploring R has been both informative and engaging. With the help of The Art of R Programming and the edX course Data Science: R Basics, I’m excited to continue deepening my understanding and skills. Stay tuned for more updates as I progress through the course!



Comments

Popular posts from this blog

DNA Sequence Alignment and Visualization with "SequenceAlignment" Package

 DNA Sequence Alignment and Visualization with "SequenceAlignment" Package In bioinformatics, sequence alignment plays a crucial role in comparing biological sequences, especially DNA sequences. It helps in identifying similarities, differences, and evolutionary relationships between sequences. In this blog, we’ll explore how to use the SequenceAlignment R package for performing sequence alignments, visualizing the results with plots like barplots and heatmaps , and analyzing DNA sequences against multiple reference sequences stored in FASTA files. What is Sequence Alignment? Sequence alignment is the process of comparing two or more biological sequences (e.g., DNA, RNA, or proteins) to identify regions of similarity or difference. In DNA sequence alignment, the sequences are compared to see how closely they match, which can provide insights into genetic similarities, mutations, or evolutionary trends. The SequenceAlignment Package The SequenceAlignment package is a powerf...

Week 8 : Tackling Data Handling Challenges and Finding Solutions

 Week 8 : Tackling Data Handling Challenges and Finding Solutions This time i had the opportunity to dive deeper into R by using the plyr package to compute the mean of grades split by gender and export the results to a file. The task seemed straightforward: import a dataset, perform some basic operations, and output the result. However, as with most programming journeys, I encountered a few hurdles along the way, leading to a wealth of learning. Step 1: Importing the Dataset The first task was to import a dataset into R. I used the read.table() function, which reads the file in a tabular format. Initially, the command worked well, but I did face a minor challenge when choosing the right separator for the CSV file ( sep="," ). This was an easy fix once I realized the file used commas to separate values. Here's the command that worked: Lesson learned: Always double-check the file format and ensure the separator used in the file is correctly specified. Step 2: Calculatin...