Error in eval(predvars, data, env) : object 'ind_total_OFSI' not found

hi im trying to replace my teachers code with my variables, I'm plotting my data and my professor has this code:
plot(latentmean_FA~govexp_edu_WDI, data=mydata,
main="Human Rights by Government Education Expenditures",
xlab= "Government Education Expenditures, % of GDP",
ylab= "Human Rights Respect, Fariss (2014) Latent Variable")

so i ran this code, replacing his titles with mine:
plot(latentmean_FA~ind_total_OFSI, data=mydata,
main="Human Rights in Latin America by United States Foriegn Direct Investment",
xlab= "U.S. Foreign Direct Investment",
ylab= "Respect for Human Rights in Host Country")
and i got this error code :
Error in eval(predvars, data, env) : object 'ind_total_OFSI' not found.

I dont really know what I'm doing in R so I would be really thankful for any help! :slight_smile:

It looks like the plot() function does not see a column named ind_total_OFSI in the data frame mydata. You can check the column names with


Check the spelling of the column, including the case of the letters.

yes that was it, got it , thank you so much !

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.