0

I keep getting the following error: Error in numeric(KMEA_EMP3_RT) : object 'KMEA_EMP3_RT' not found

I am new to r code and I have worked through importing and cleaning up the data to run the analysis, however, I need to change the variable types but it won't recognize my column name.

See code below: (I didn't include the "IMPORTING DATA" code)

# INSTALLING PACKAGES AND LIBRARIES
install.packages("zoo", repos="http://R-Forge.R-project.org")
install.packages(c('skimr', 'RANN', 'randomForest', 'fastAdaboost', 'gbm', 'xgboost', 
'caretEnsemble', 'C50', 'earth'))
library(caret)
library(caretEnsemble)
library(tidyr)
library(zoo)
library(skimr)
library(tibble)
library(dplyr)


# TESTING DATA TABLES WERE IMPORTED
Congestion[1:6,1:4]
LMP[1:6,1:4]
Weather[1:6,1:4]
Holiday[1:6,1:4]

# MERGE CONEGESTION AND LMP DATA.FRAMES
df = merge(LMP, Congestion[, c("KMEA_DA", "KMEA_RT", "DTStamp")], by = "DTStamp", all.x = 
TRUE, no.dups = TRUE)
df[1:6,1:4]

na.omit(df)

# MERGE df AND WEATHER DATA.FRAME
df.2 = merge(df, Weather[, c("DTStamp", "Temperature", "Windspeed")], by = "DTStamp", 
all.x = TRUE, no.dups = TRUE)
df.2[1:6,1:4]

na.omit(df.2)

# MERGE df.2 AND HOLIDAY DATA.FRAME
df.3 = merge(df.2, Holiday[, c("DTStamp","Holiday")], by = "DTStamp", all.x = TRUE, 
no.dups = TRUE)
df.3[1:6,1:6]

# PREPPRING DATA FOR ANALYSIS
str(df.3)
df.4 = df.3[-which(df.3$DTStamp==""), ]
df.5 = subset(df.4, !is.na(KMEA_DA))
df.5 %>% mutate_all(numeric(df.5, KMEA_EMP3_RT))
  • Assuming the error is raised after the last line in the code you posted, it tells us that there is no column named `KMEA_EMP3_RT` in `df.5` which is a subset of `df.3`... so you could check what happened there. In general its going to be difficult to find a solution without a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) (with emphasis on **minimal**, the mre should only be as exhaustive as necessary to replicate the problem and not a bit larger ;) – dario Jun 04 '20 at 15:44
  • Thanks! I will take a look again and if not, I will provide a minimal reproducible example. – Katie Shearn Jun 04 '20 at 21:11

0 Answers0