Maybe you could do something like this. To read the data, use the fill argument in read.table. Where text = txt, you would put your file name there.
(dat <- read.table(text = txt, header = TRUE, fill = TRUE))
# LA NY MA
# 1 1 2 3
# 2 4 5 6
# 3 3 5 NA
# 4 4 NA NA
Then we can take the column means and create a new two column data frame.
cm <- colMeans(dat, na.rm = TRUE)
data.frame(state = names(cm), mean = unname(cm))
# state mean
# 1 LA 3.0
# 2 NY 4.0
# 3 MA 4.5
where txt is
txt <- "LA NY MA
1 2 3
4 5 6
3 5
4"