Watts-College / cpp-529-fall-2021

https://watts-college.github.io/cpp-529-fall-2021/
0 stars 0 forks source link

Lab 04 Error: Fill argument neither colors nor valid variable name(s) #7

Open mtwelker opened 3 years ago

mtwelker commented 3 years ago

Prof. Howell, @AntJam-Howell

This code chunk, for the cluster analysis on the three neighborhood indices, runs fine within RStudio:

fit.ind <- Mclust( df.nhood.metrics )
summary( fit.ind )

tmap_mode("plot")
tmap_style("white")
tm_shape( den_dorling) +  #, bbox=bb ) + 
  tm_polygons( col="cluster.ind", palette="Accent"  )

Here's what it produces: image image

But when I knit the file, I get this error: image (Line 357 is the first line of the code chunk above.)

In case it helps, here's how I created cluster.ind:

df.pct <- sapply( d2, ntile, 100 )
d4 <- as.data.frame( df.pct )
d4$cluster.ind <- as.factor( paste0("GROUP-",fit.ind$classification) )

I think the error is related to the plot, not the cluster analysis, but knitting the file doesn't throw an error for an earlier plot (on the original cluster analysis with all the variables) that is virtually identical, starting at line 223:

tmap_mode("plot")
tmap_style("white")
tm_shape( den_dorling) +  #, bbox=bb ) + 
  tm_polygons( col="cluster", palette="Accent"  )

I googled the error, but couldn't find a solution. Do you have any suggestions?

AntJam-Howell commented 3 years ago

@mtwelker Hi Michelle, can you email me your RMD code. I will take a look. anthony.howell@asu.edu Best,

mtwelker commented 3 years ago

Thank you @AntJam-Howell ! I just sent it to you.