How to Remove Unwanted Columns & Rows in RStudio
RStudio is an integrated development environment for R, a programming language for statistical computing and graphics.
In this blog, we go over how to remove unwanted columns and rows in RStudio. Some information might just not be necessary or needed in certain reports we already have from files.
Here's an example for further understanding. We created a table full of data. When it imported into RStudio, extra columns or rows that are unwanted also were included. Here's how we can remove them.
Steps to Rename Columns in RStudio
In RStudio, make sure to have the required packages: tidyverse and readxl
After those packages have been installed, you can Run the libraries and make sure they are loaded in
Create a variable (we called it Tests)
Tests gets assigned read_excel function with the TestScores xlsx file
Tests <- read_excel("TestScores.xlsx")
You can go ahead and Run that line
The Tests variable should show up in the Environment window (on the right) and the data set has been imported
The data table did import, however you can see that it also included a few rows and a column that are blank and we don't need those in our data set
To remove columns, call the variable Tests add the $ and pick ...4 and assign that to NULL
Tests$...4 <- NULL
Run that line and you can check back to the data set that the extra blank column has been removed
To remove rows, call the data set assign the data set again
Use brackets and subtract the rows you would like to remove as the following
Tests <- Tests[-12:-14, ]
Note that the rows we want to remove is 12 through 14 and there is a space before ending the last bracket
Run that line and taking a look at the data table, the unwanted rows are gone
For a more step by step visual tutorial, there will be a video (stay tuned).
Check out this blog where we go through how to import xlsx and csv files into RStudio.
#rstudio #tibble #r #coding #program #language #statistical #computing #import #howto #remove #unwanted #columns #rows #table #data #qbo #excel #xlsx #csv #files #bookkeeping #financialservices #accounting #financialgps