My journey with R and RStudio has been amazing! As I dive into the world of data analytics, RStudio has made learning R more intuitive and enjoyable. From writing my first lines of code to exploring data visualization and basic statistical operations, every step has been exciting.
## Declaration of variables
a <- 5
b <- 3
## R as a calculator
## Addition
c <- (a+b)
c
## [1] 8
##Subtraction
d <- (a-b)
d
## [1] 2
## Multiplication
e <- (a*b)
e
## [1] 15
## Division
f <- (a/b)
f
## [1] 1.666667
## Let's calculate the circumference of a circle which has the radius of 3m
radius <- 3
circumference <- 2 * pi * radius
circumference
## [1] 18.84956
area <- pi * (radius)^2
area
## [1] 28.27433
## Let's get the user to enter the value of the radius, then print the result
radius <- as.integer(readline("Enter the radius of the circle: "))
## Enter the radius of the circle:
circumference <- 2 * pi * radius
area <- pi * (radius)^2
circumference
## [1] NA
area
## [1] NA
## An alternative output format with the unit of measurement (m) attached
cat("The circumference of the circle is: " ,circumference,"m\n")
## The circumference of the circle is: NA m
cat("The area of the circle is: " ,area, "square m")
## The area of the circle is: NA square m
## The results here, is showing "NA" (not available) because no value has been entered by the user.
## If the user enters a value say, '3', the output would be:
## The circumference of the circle is: 18.8496 m
## The area of the circle is: 28.27433 square m
One of the first things I learned was how to use R for basic data manipulation, such as reading datasets, filtering rows, and summarizing information. The tidyverse package has been a game-changer, making data handling much more efficient.
I’ve also experimented with ggplot2, which is an excellent tool for creating beautiful and insightful visualizations. Seeing raw data transform into meaningful graphs has been one of the highlights of my learning process.
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## starting httpd help server ...
## done
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Using size for a discrete variable is not advised.
## `geom_smooth()` using formula = 'y ~ x'
There’s still so much to explore—machine learning, advanced statistical modeling, and even interactive dashboards with Shiny. I’m looking forward to deepening my skills and applying them to real-world problems.
I can’t wait to share more of what I learn as my journey continues!
…Stay tuned!