Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab04 - sf package #9

Open
ecking opened this issue Apr 4, 2020 · 4 comments
Open

Lab04 - sf package #9

ecking opened this issue Apr 4, 2020 · 4 comments

Comments

@ecking
Copy link

ecking commented Apr 4, 2020

I know, second question of the night.
But what does "Error in st_cast_sfc_default(x) : list item(s) not of class sfg" mean?

When I put in
msp.sp <- as_Spatial( msp )
I get this message. I'm googling it and trying out different things. But even the help documentation I'm not quite understanding.

@AntJam-Howell
Copy link
Collaborator

@ecking can you attach your .rmd file for me to take a look.

@AntJam-Howell
Copy link
Collaborator

@ecking Just went through and figured out that the problem actually takes place on line 149 of you .RMD file when you merge the 2 datasets together

msp <- merge( msp.pop, census.dat, by.x="GEOID", by.y="tractid" )

For some reason, the merge brings back an empty dataset despite the tractid and GEOID number matching.

When I converted the matching variable in each dataset to be numeric instead of character, and merged, the problem was solved. You can convert the variables to numeric as shown below, and then re-run the merge after.

 census.dat$tractid<-as.numeric(census.dat$tractid)
 msp.pop$GEOID<-as.numeric(msp.pop$GEOID)

@ecking
Copy link
Author

ecking commented Apr 5, 2020

Thanks @Anthony-Howell-PhD, I never would have gotten that...

I'm running the code now and I hit the last section of code under Identifying "Neighborhood Clusters" -- Build the charts to compare census characteristics across the groups. and there is an a reference to object data.dictionary here that is not being found.

How should I go about resolving that? I do see that there is code at the bottom of the page for data.dictionary but seems out of order.

@ecking
Copy link
Author

ecking commented Apr 5, 2020

looks like adding that chunk of code before that last chunk worked.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants