I load and clean my data for problem 1(a), and then I'd like to rename the
columns on my data frame. (Just to keep things sorted out, I've made a data
frame that contains only the columns of data I need for the regression, without
extra info like incumbency in years -8 or party of the winner in years -0.)
So, I'd really like to name my columns, to remember what is what. But the
command isn't working.
clean <- clean.data(hdata)
dim(clean)
[1] 1250 7
names(clean) <- c
("year",
"state", "district", "dpct0", "dpct8",
"dwin8", "incumb0")
Error in "names<-.default"(*tmp*, value = c("year",
"state", "district", :
names attribute must be the same length as the vector
I guess I don't have to name my columns, but I'd like to figure out why this
isn't working. It seems like it should, since the dimensions have 7 columns
and I've concatenated 7 names. Any thoughts?
Anna
--
Anna Lorien Nelson
Department of Government,
Harvard University
alnelson(a)fas.harvard.edu