Here's my best stab at replicating your first plot,
library(ggplot2)
library(ggmap)
library(readr)
library(stringr)
library(usmap)
{
urlToRead<-"http://www2.census.gov/programs-surveys/popest/tables/2010-2011/state/totals/nst-est2011-01.csv"
tempFrame<-read_csv(urlToRead) %>%
as_tibble
tempFrame<-tempFrame[-1:-8,1:5]
tempFrame<-tempFrame[-52:-58,]
tempFrame <- tempFrame %>%
dplyr::rename(
"statename" = 1,
"april10census" = 2,
"april10base" = 3,
"july10pop" = 4,
"july11pop" = 5
) %>%
mutate(state = str_remove(statename , ".")) %>%
mutate_at(.vars = c("april10census","april10base", "july10pop", "july11pop"),
funs(str_remove_all(string = ., ",") %>% as.integer())
)
}
#> Warning: Missing column names filled in: 'X2' [2], 'X3' [3], 'X4' [4],
#> 'X5' [5], 'X6' [6], 'X7' [7], 'X8' [8], 'X9' [9], 'X10' [10]
#> Parsed with column specification:
#> cols(
#> `table with row headers in column A and column headers in rows 3 through 4. (leading dots indicate sub-parts)` = col_character(),
#> X2 = col_character(),
#> X3 = col_character(),
#> X4 = col_character(),
#> X5 = col_number(),
#> X6 = col_character(),
#> X7 = col_character(),
#> X8 = col_character(),
#> X9 = col_character(),
#> X10 = col_character()
#> )
plot_usmap(data = tempFrame, values = "april10base", lines = "white") +
scale_fill_continuous(name = "Population (april10base)", label = scales::comma) +
theme(legend.position = "right")

Created on 2019-02-17 by the reprex package (v0.2.1)
The example code provided seems to be missing a few steps. For example, the population data april10base was a number with comma every third digit (note the warning messages). So a few of my steps handled converting those into integers. Once those numbers are treated as numbers, the map plot will treat them as a continuous number, hence my continuous legend.
If you don't do this, these population numbers are treated as factor values, and that's how you got 51 values in your second plot's legend.
I'd encourage you to check out a good intro to mapping with R and ggplot. For just the US, check out the vignettes with the usmap package https://cran.r-project.org/web/packages/usmap/
For a larger introduction to mapping with R, maybe check out something like
http://eriqande.github.io/rep-res-web/lectures/making-maps-with-R.html