Skip to content
Prev 303822 / 398513 Next

Unable to reference variable created in dataframe

That simple code works for me as well, but for some reason my actual code
still isn't working. Here is exactly what I'm doing:

- The code for importing my data is:

/Bridges = read.csv(file = "C:/R/Bridges.RData.csv", head=TRUE, sep=",")/


- Within my group of highway bridges, I have defined a subgroup of bridges
that are Interstates, and are made of concrete. The code for this is:

/Interstates_Concrete = Bridges [Bridges$ROUTE_PREFIX_005B == 1 &
Bridges$STRUCTURE_KIND_043A == 1 | 
	Bridges$STRUCTURE_KIND_043A == 2,]/

where "ROUTE_PREFIX_005B" signifies an interstate bridge if it is equal to
1, and "STRUCTURE_KIND_043A" signifies a concrete bridge if it is equal to 1
or 2


- Then, my code for converting the dependent variable to log form is:

/Bridges$LOG_DECK_COND = log(Bridges$DECK_COND_058, base = exp(1))/

where "DECK_COND_058" is the condition of the bridge deck, with values
ranging from 3 to 9


Both of these code snippets run without error. However, when I try to run
the code for the actual model:

/exp.int.con= lm(LOG_DECK_COND ~ CUM_ADTT_2011 + CUM_WSL_2011, data =
Interstates_Concrete)/

where CUM_ADTT_2011 and CUM_WSL_2011 are existing variables in the
dataframe, I get the following:

/Error in eval(expr, envir, enclos) : object 'LOG_DECK_COND' not found/


Since:

/lm.int.con= lm(DECK_COND_058 ~ CUM_ADTT_2011 + CUM_WSL_2011, data =
Interstates_Concrete)/

runs without any issues, I have to conclude that there is definitely a
problem with the log conversion; I just don't know what it is. I have tried
running this on multiple machines and in multiple workspaces, and the
problem remains.






--
View this message in context: http://r.789695.n4.nabble.com/Unable-to-reference-variable-created-in-dataframe-tp4640822p4640900.html
Sent from the R help mailing list archive at Nabble.com.