Categories
Tag: rnaturalearth
Phyloecology of nitrate ammonifiers and their importance relative to denitrifiers in global terrestrial biomes
Steffen, W. et al. Planetary boundaries: guiding human development on a changing planet. Science 347, 1259855 (2015). Article PubMed Google Scholar Kanter, D. R. et al. Nitrogen pollution policy beyond the farm. Nat. Food 1, 27–32 (2020). Article ADS Google Scholar Tian, H. et al. A comprehensive quantification of global…
Coloring map, receiving error about palette in RStudio – rstudio
Below is part of a code I am working on, I am trying to map the city_names onto the map but I keep coming across an error about requesting colour from hue palette. I did some research to look for a soultion and one of them being to utilizing as.character…
How can I color code a region in static map? – rstudio
The code you provided doesn’t seem to reproduce – the tanzania object you refer to in the first line of the ggplot call is not exported from any of the packages you import. Which is a problem that can be helped, but please give us an idea what kind of…
6.6 Data sources | ggplot2
The USAboundaries package, github.com/ropensci/USAboundaries contains state, county and zip code data for the US. As well as current boundaries, it also has state and county boundaries going back to the 1600s. The tigris package, github.com/walkerke/tigris, makes it easy to access the US Census TIGRIS shapefiles. It contains state, county, zipcode,…
deployment – Shiny App with leaflet map runs well in Rstudio but when I try to deploy it in shinyapps.io, it deploys but then I just get an error message
Below is some sample code for a shiny app I am trying to deploy on shinyapps.io. Whilst it runs just fine in Rstudio, when I deploy it it deploys but then just shows an error message on the browser page. Please help! Is it perhaps something with leaflet, sf or…
r – RStudio repeatedly crashes/freezes and weird dplyr errors at random points in code
I’m running code in an R project after updating to newer versions of R/RStudio and the most recent tidyverse package versions. When I run certain dplyr/tidyverse functions, primarily joins, pivoting, or summarizing, I either have R crash, freeze, or get strange errors. For example, when I tried to summarize across…
Ancient Clostridium DNA and variants of tetanus neurotoxins associated with human archaeological remains
Identification and assembly of C. tetani-related genomes from aDNA samples To explore the evolution and diversity of C. tetani, we performed a large-scale search of the entire NCBI Sequence Read Archive (SRA; 10,432,849 datasets from 291,458 studies totaling ~18 petabytes; June 8, 2021) for datasets potentially containing C. tetani DNA…
ggplot2 – How can I get equal lan lat grids using WGS84 with ggplot in R
I use am familiar with R and ArcGIS pro. I want to plot maps using WGS84 in R using ggplot. I get equal lat Lon grids in ArcGIS pro while zooming to, say, Germany. But I am not able to get equal grids in R using ggplot2 using WGS84. Following…
r – Adding contour line to ggplot2 map
I am wanting to add a contour line to a ggplot2 plot to show the global average (1mm) similar to this figure where the green contour shows the global average I have gotten as far as making the plot but can’t figure out how to get the contour, geom_hline() just…
Whole mitogenomes reveal that NW Africa has acted both as a source and a destination for multiple human movements
Callaway, E. Oldest Homo sapiens fossil claim rewrites our species’ history. Nature. doi.org/10.1038/NATURE.2017.22114 (2017). Article PubMed Google Scholar Lucas-Sánchez, M., Serradell, J. M. & Comas, D. Population history of North Africa based on modern and ancient genomes. Hum. Mol. Genet. 30(R1), R17–R23. doi.org/10.1093/HMG/DDAA261 (2021). Article PubMed Google Scholar Scerri, E….
r – Add horizontal gradient fill to geom_tile in ggplot geom_sf map
I’m making a map and want to add rectangles with a horizontal color gradient (darkest color on the left, fading to white on the right). I initially made the rectangles with geom_rect but other SO questions suggested that geom_tile would accept a variable fill. I tried that below by generating…
r – How to make a magnified inset of a map plot with ggmagnify and ggplot2
For one of the past week’s tidytuesday challenge, the one where Tornado dataset was analyzed, I tried to practice ggmagnify package with ggplot2 to make a magnified inset map of Texas with the US map. So, let me write down the code to demonstrate what I have achieved so far,…
r – How to specify exacts axis breaks in a map using sf and ggplot2?
This should be close. You might want to adjust how the x-axis labels are displayed. Be careful though, people can be touchy about maps. The pretty function wasn’t consistently returning exactly four distinct numbers for the x-axis. library(ggplot2) library(sf) #> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1; sf_use_s2() is…
merge (all=T) error – rstudio
I have two installations of RStudio with each different updates of the packages. On the recent packages I get two errors that I don’t have with the previous packages. Can someone tell me what the problem is? Error 1: df_lofreq_3_DEL <- merge(df_lofreq_3_DEL, deletions_VAR_df_sub_freq, by.x=”VAR_MUT”, by.y=”lofreq_del”, all=T) Error in if (all.x)…
Degree symbol not appearing in ggplot output using sf file – RStudio IDE
I saw this thread github.com/r-lib/ragg/issues/51 . There is there is the reference to this stopgap: ragg.r-lib.org/#use-ragg-with-knitr which did fix the current problem. Is there a more permanent solution? I am using Windows 11 and :RStudio 2022.12.0+353 “Elsbeth Geranium” Release (7d165dcfc1b6d300eb247738db2c7076234f6ef0, 2022-12-03) for WindowsMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,…
r – How to show the full legend of LISA cluster map using ggplot2
I want to create a LISA cluster map using ggplot2 after calculating local Moran’s I statistics. The following shows how I calculate the local Moran I’s statistics of the world population using rgeoda package. The polygons and population data are obtained from rnaturalearth package. library(rnaturalearth) library(rgeoda) library(sf) world_map <- ne_countries(scale…
Learn to draw with Nature Genetics: a simple example of R language ggplot2 drawing a world map
Whole genome resequencing of 445 Lactuca access requests the household history of cultivated lettuce image.png The data of this paper is public. We can try to reproduce the graph used to display the data in the paper with the public data. The first figure uses a map to show the…