Getting Started With R – Basic functions

Hi everyone , this is my first post about R programming language. I would like to share some basic functions and syntax in order to be be familiar with R.

  1. colnames – Returns the list of names from dataset

2. head – Returns the first 6 rows of vector matrix , table , dataframe

3. str(tablename) – returns the dataframe , array horizontally

4. summarize(tablename,assigned_columnname=aggregation(columnname))- Summarize the data for example mean , median

5. rename ; rename(tablename,assignedcolumnname1=oldcolumnname1,assignedcolumnname2=oldcolumnname2,………)

6. ggplot2 ; this is one of the popular function for getting started with data visualization

-ggplot(data=tablename,aes(x=columnname1,y=columnname2))+geom_point() – Creates the simple ggplot

-ggplot( data=tablename,aes(x=columnname1,y=columnname 2,color=columnname3))+geom_point() – Creates the ggplot with columnname3 category

-ggplot( data=tablename,aes(x=columnname1,y=columnname 2,color=columnname3))+geom_point()+facet_wrap(columnx) – Creates the ggplot with columnname3 category and creates diffirent visualization with columnx category

FIg : SImple GGPLOt
ggplot with color
ggplot with facet_wrap()

Published by lokendrakc

Hi , I am Lokendra KC. I am a Biomedical Engineer and an aspiring BI analyst. I am very keen on Data so I took this challenge to keep the learning log throughout my data Journey.

Leave a comment