First step is to install httr
install.packages("httr")
library(httr)
Next step is to activate an API key with the census. Just go here and follow the directions.
Once that is done the following should get your data into R. Be sure to put your active API key in the URL.
myURL<-"http://api.census.gov/data/2010/sf1?key=YOUR_API_KEY_HERE&get=P0010001,NAME&for=state:*"
x<-content(GET(myURL))
xdf<-data.frame(do.call("rbind",x[-1]))
names(xdf)<-x[[1]]
xdf
Trick to get other data out of census is to dig into the Census API.