Kickstarting development on R
Having spent last 6months in learning Data Engineering, I decided to check what can I pick next. So, continuing in that quest starting off some work in learning R-
Installing R
R can be installed from Cran website. Just download the installer based on your OS and you should be ready to go-
Once it’s installed, you can create programs in R language and execute in R studio.
Here, Iam loading a dataset in R and then doing some processing over it-
library(datasets)
head(iris)
summary(iris)
plot(iris)
# Clear all packages
detach("package:datasets", unload = TRUE)
# Clear all plots
dev.off() # But only if there IS a plot
To execute a particular line of code, just press Command + Return
Let’s take it line by line now-
library(datasets) — I. R has sample functions alongwith sample data which are stored in a dirctory called ‘library’. When we start R, default packages are loaded, if we want to load a specific package then we need to specify in the library function. Here, we are loading datasets package.
To get a list of packages in R, execute the below command-
library()
To get all packages loaded in R environment-
search()
To get first X rows of a dataset, we use head(<<dataset name>>), by default its 6 rows
summary()- Summarizes the important columns of a dataframe. Important quantiles, min, max,mean, median
plot() — is to plot a dataset -
Happy Learning :)