I am trying to do a simple linear regression in R and I keep getting an error. Here is my code:
> LinearMod <- lm('2015--teen pregnancy rates' ~ '2012 -- Domestic Violence Calls For Service per 1,000 Residents', data=Copy_of_BNIA_data_7_24_17)
I keep getting this error: Error in terms.formula(formula, data = data) : invalid term in model formula
Also here is some more info:
> str(Copy_of_BNIA_data_7_24_17)
$ 2012 -- Domestic Violence Calls For Service per 1,000 Residents : num 60.5 51.5 56... $ 2015--teen pregnancy rates : num 126.3 73.9 69 ...
> dput(head(Copy_of_BNIA_data_7_24_17, 10))
structure(list( 2012 -- Domestic Violence Calls For Service per 1,000 Residents
= c(60.5,
51.5, 56.6),
"2015--teen pregnancy rates"), row.names = c(NA, 10L), class = c("tbl_df",
"tbl", "data.frame")
Please let me know what the issue is. Thank you!
str(Copy_of_BNIA_data_7_24_17)
anddput(head(Copy_of_BNIA_data_7_24_17, 10))
and paste the results into your question. – G5W