R-STUDIO

How to keep or delete columns/Variable of a data frame in R

After reading a data in R, the 1st thing we should do before processing/enriching/ preparing the data in require format is to retain the required columns that can be used further and remove rest of the columns. This will  improve the performance in the subsequent steps. There could be 2 scenarios Dropping list of columns from a […]

How to change the case (Lower to Upper and Vice Versa) in R

Below are few scenarios for changing cases(upper to lower and vice ) of column_name or column_value in R . Scenario -1 (Changing column names from upper case to Lower case) Library used – > Data.table Syntax ->setnames(),tolower() — Example df=setnames(df, tolower(names(df[1:3]))) Note: in the above example [1:3] means the range of the columns , i.e. […]

How to rename Columns in R

Below are the different methods for renaming columns in R-studio tool. Each method uses different libraries. You can follow any one method as per convenience.. DEMO: Below are the old and new column details:   METHOD -1:( using Library : dplyr ) To rename single column: — Syntax DF %>% Rename (“New name” = “Old […]

How to Read CSV files in R studio

There are multiple methods to read a csv file in R studio. We have explained few easy methods in this article. NOTE – > No additional package is required for this . METHOD-1: (Read the file directly form from folder) ##Make sure the we use double back slash DF=read.csv(“C:\\Users\\path\\file_name.csv”) METHOD 2 : (first set the […]