Closed Josh-Lee1 closed 4 years ago
problem was just above. try this:
foodtraits<- traits %>%
select("X3_Taxon_common_name_2", "X99_Body_mass_average_8", "X163_Food_Fruit_10":"X173_Food_fish_or_invertebrates_Inland_waters_10", "X115_Feeding_habitat_Terrestrial_Arid_shrubland_9":"X145_Feeding_habitat_Urban_landscapes_9", "X193_National_movement_local_dispersal_13":"X197_National_movement_Irruptive_13") %>%
rename(species = "X3_Taxon_common_name_2") %>%
mutate(species=gsub(" ", "_", species))
#### needs fixing!!!
traitseds<- recode(foodtraits$species, 'Black-faced_Cuckoo-shrike' = "Black-faced_Cuckooshrike",
'European_Common_Blackbird' = "Eurasian_Blackbird",
'European_Common_Starling' = "European_Starling",
'Grey_Butcherbird' = "Gray_Butcherbird",
'Grey_Fantail' = "Gray_Fantail",
'Grey_Shrike-thrush' = "Gray_Shrikethrush",
'Australian_Wood_Duck' = "Maned_Duck",
'Red-browed_Finch' = "Red-browed_Firetail",
'Scarlet_Honeyeater' = "Scarlet_Myzomela",
'Superb_Fairy-wren' = "Superb_Fairywren",
'Variegated_Fairy-wren' = "Variegated_Fairywren",
'Willie_Wagtail' = "Willie-wagtail",
'Jacky_Winter' = "Jacky-winter")
Thank you! But now I have a list of names with corrected species separate from the trait data frame. Is there I way I can recode and replace in one move?
foodtraits$species <- recode(foodtraits$species, 'Black-faced_Cuckoo-shrike' = "Black-faced_Cuckooshrike",
'European_Common_Blackbird' = "Eurasian_Blackbird",
'European_Common_Starling' = "European_Starling",
'Grey_Butcherbird' = "Gray_Butcherbird",
'Grey_Fantail' = "Gray_Fantail",
'Grey_Shrike-thrush' = "Gray_Shrikethrush",
'Australian_Wood_Duck' = "Maned_Duck",
'Red-browed_Finch' = "Red-browed_Firetail",
'Scarlet_Honeyeater' = "Scarlet_Myzomela",
'Superb_Fairy-wren' = "Superb_Fairywren",
'Variegated_Fairy-wren' = "Variegated_Fairywren",
'Willie_Wagtail' = "Willie-wagtail",
'Jacky_Winter' = "Jacky-winter")
Oh of course. haha thanks ok should be good now!
So I made a map of all of the checklists inside the fire boundary. Is it a real hassle to get a basemap/shapefile for Aus underneath? and will it look rubbish without it?
It is not a hassle!
Try googling it, but you can download one easily from 'rnaturalearth' package. If you get stuck, let me know and I can chuck one into the repository.
And it looks kinda rubbish without it... :)
On Tue, Jul 28, 2020 at 4:37 PM Josh-Lee1 notifications@github.com wrote:
[image: map] https://user-images.githubusercontent.com/59299694/88627835-54b38100-d0f0-11ea-9cb1-50015e20bfd7.png
So I made a map of all of the checklists inside the fire boundary. Is it a real hassle to get a basemap/shapefile for Aus underneath? and will it look rubbish without it?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Josh-Lee1/eBird-Fire-Index/issues/12#issuecomment-664807998, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWSEJTFADNPQCCV2FQPVKLR5ZWX7ANCNFSM4PIZJOJA .
https://ropensci.org/tutorials/rnaturalearth_tutorial/
remember that we're dropping everything about -25 S so, all that stuff in FNQ and the top end is out.
True. The trick is to download as an 'sf' object directly. Then can easily plot with geom_sf(data=australia) in ggplot2.
On Tue, Jul 28, 2020 at 4:42 PM Will Cornwell notifications@github.com wrote:
https://ropensci.org/tutorials/rnaturalearth_tutorial/
remember that we're dropping everything about -25 S so, all that stuff in FNQ and the top end is out.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Josh-Lee1/eBird-Fire-Index/issues/12#issuecomment-664809657, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWSEJW5QK5MFNFSYNFG6JDR5ZXKNANCNFSM4PIZJOJA .
Amazing. Thanks! I'll let you know how I go. Should I cut at 25degrees at the end or all the bits before it goes together?
half a dozen of one or six of the other....
On Tue, Jul 28, 2020 at 4:47 PM Josh-Lee1 notifications@github.com wrote:
Amazing. Thanks! I'll let you know how I go. Should I cut at 25degrees at the end or all the bits before it goes together?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Josh-Lee1/eBird-Fire-Index/issues/12#issuecomment-664811431, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWSEJVWAL5T24KLOOUXJJDR5ZX4ZANCNFSM4PIZJOJA .
I got an outline of Aus but I guess I need to turn it into a sf? but I need to know coordinate system for that? i cant see any data with the map.
Something like this? ne_download(scale = 110, type = "countries", category = c("physical"), destdir = tempdir(), load = TRUE, returnclass = c("sf")) It says that it cant reach the website...?
Try this:
library(rnaturalearth)
library(sf)
library(ggplot2)
aus <- ne_countries(country="australia", returnclass="sf")
ggplot()+
geom_sf(data=aus, fill="orange")
And then should be able to add other layers to the plot. Let me know if it works.
Error in st_as_sfc.SpatialPolygons(sp::geometry(x), ...) : package rgeos required for finding out which hole belongs to which exterior ring
Ah dont worry just needed that package
try making sure rgeos and sp are installed I reckon? The code I just pasted works for me on my machine....
On Tue, Jul 28, 2020 at 5:17 PM Josh-Lee1 notifications@github.com wrote:
Error in st_as_sfc.SpatialPolygons(sp::geometry(x), ...) : package rgeos required for finding out which hole belongs to which exterior ring
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Josh-Lee1/eBird-Fire-Index/issues/12#issuecomment-664823664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWSEJWTM7LZ3NX4IQ7JEYTR5Z3NXANCNFSM4PIZJOJA .
I WAS worried.
On Tue, Jul 28, 2020 at 5:18 PM Josh-Lee1 notifications@github.com wrote:
Ah dont worry just needed that package
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Josh-Lee1/eBird-Fire-Index/issues/12#issuecomment-664824364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWSEJR74TFNU4YMMNI3GXTR5Z3UPANCNFSM4PIZJOJA .
My next obstacles are rearranging layers so that the base map is actually on the base. and also cropping at 25 degrees. The former has crashed R twice so I think I'm trying the wrong things. Any tips?
Should just be something like:
ggplot()+
geom_sf(data=australia)+
geom_sf(data=points)+
geom_sf(data=fire_extent)+
xlim(x1, x2)+
ylim(y1, y2)+
coord_equal()
Finally got it! You said it wouldn't be a hassle haha Thanks!
Hahaha
Hey @wcornwell and @coreytcallaghan , So I've been trying to plug a leak but can't seem to manage a fix. When I joined the trait data to the model coefficients, 13 species were lost due to spelling/name differences in the two data sets. I have located the species and wrote this code: traitseds<- recode(foodtraits$species_name, 'Black-faced_Cuckoo-shrike' = "Black-faced_Cuckooshrike", 'European_Common_Blackbird' = "Eurasian_Blackbird", 'European_Common_Starling' = "European_Starling", 'Grey_Butcherbird' = "Gray_Butcherbird", 'Grey_Fantail' = "Gray_Fantail", 'Grey_Shrike-thrush' = "Gray_Shrikethrush", 'Australian_Wood_Duck' = "Maned_Duck", 'Red-browed_Finch' = "Red-browed_Firetail", 'Scarlet_Honeyeater' = "Scarlet_Myzomela", 'Superb_Fairy-wren' = "Superb_Fairywren", 'Variegated_Fairy-wren' = "Variegated_Fairywren", 'Willie_Wagtail' = "Willie-wagtail", 'Jacky_Winter' = "Jacky-winter") but I can't get her to go. I'll push the changes in case you would like to have a look.