Code Refactoring Services

A well written and organized script reduces maintenance costs by allowing faster debugging, and feature updating. We write code that reads like English to make the script easier to understand. We adhere to the best practices of coding on every chunk we refactor.

Does your code light a candle with a bazooka?

Although there will always be dependencies within your code, it is always better not to rely to much on packages. Relying on packages often leads to code breaks thereby increasing maintenance costs. At Econometricus we leverage base R as much as possible avoiding time-consuming package updates as well as break-prone script black-boxes.

### Load Unnecessary Packages :(
stringr::str_replace()
dplyr::if_else()
dplyr::left_join()
dplyr::inner_join()
### Load Necessary Packages ;)
base::gsub()
base::ifelse()
base::setdiff()
base::match()
base::intersect()

Increase readability and portability of your code with Econometricus Code Refactoring Services.

We deliver improved scripts that read like a regular English text following a left-to-right, top-down structure like on the books we all read.

One command line at a time.

###
### Realized Inflation Data by Quarters
###

Realized_Inflation$Quarter           <- quarters(as.Date(Realized_Inflation$DATE))
Realized_Inflation$Year              <- substr(as.Date(Realized_Inflation$DATE),0,4)

Realized_Inflation$Quarter_Year      <- paste0(Realized_Inflation$Year,"-",Realized_Inflation$Quarter)
Realized_Inflation$Mean_Inflation    <- mean(Realized_Inflation$Growth_Rate_Previous_Period)
Realized_Inflation$Median_Inflation  <- median(Realized_Inflation$Growth_Rate_Previous_Period)

A simple wide-known trick of well aligned text, makes scanning for functions and steps more convenient decreasing time as well as frustration. We have been there.

Before / After

Recorder_Data <- Recorder_Data[, c("X.ATTOM.ID.","PropertyAddressFull","Mortgage1LenderNameFullStandardized","Mortgage1Amount","Mortgage1InterestRate","Sold_Price","Mortgage1Term","Year","Census_Tract_with_Zeroes")]

Try finding “Sold_Price” column name in both code chunks to realize how important and time-saving is to have a well organized code-base.

Recorder_Data <- Recorder_Data[, c("X.ATTOM.ID.",
                                   "PropertyAddressFull",
                                   "Mortgage1LenderNameFullStandardized",
                                   "Mortgage1Amount",
                                   "Mortgage1InterestRate",
                                   "Sold_Price",
                                   "Mortgage1Term",
                                   "Year",
                                   "Census_Tract_with_Zeroes")]

Book an Appointment

← Back

Thank you for your response. ✨

Econometricus App Store

Subscribe to our Blog

Analytics Use Cases and AutomationsAnalytics Use Cases and AutomationsAugust 5, 2021Giancarlo Salazar-Caicedo
Advanced Modeling Use CasesAdvanced Modeling Use CasesMarch 2, 2023Giancarlo Salazar-Caicedo
Analytics Use CasesAnalytics Use CasesAugust 5, 2021Giancarlo Salazar-Caicedo