New and struggling

We've all been there. If not in R in another language when we come from a language we know well.

In the first line of your code, you assign the results of an elaborate query to the object Estimate. The first column (field) is jobnum.

In the second line of your code, you assign the result of an operation on jobnum to a new object of the same name.

But the global environment doesn't know about the existence of jobnum in Estimate1. You can confirm this with


So let's pop it out of Estimate1.

jobnum_init <- Estimate1[1]

(I'm using positional notation, because I'm not 100% sure of the names).

Now, you have an object you can work with

jobnum <- (as.numeric(gsub("([0-9]+).*$", "\\1", jobnum_init )))

The last line is problematic because I don't know the structure of Estimate1.df. If you have trouble post a reproducible example, called a reprex.

There are easier ways of doing everything in your snippet, but we'll leave those for another time. Reply if this doesn't get you over the immediate problem.