Obtaining Metadata Information using ee_print function from RGEE - r

I am using the package RGEE (R wrapper for the Google Earth Engine Python API). The function ee_print() seems to work perfectly for an ImageCollection of just one variable, but seems to fail for ImageCollection with different variables where one needs to select the variable of interest. Any ideas on how to approach this issues with the latter kind of data.
Here's an example code:
GRIDMET = ee$ImageCollection("IDAHO_EPSCOR/GRIDMET")
ee_print(GRIDMET)
Where I get the following error message in return:
Error in strsplit(code, ":") : non-character argument

Have you considered the following approach?
GRIDMET = ee$ImageCollection("IDAHO_EPSCOR/GRIDMET")
print(GRIDMET, type = getOption("rgee.print.option"))
And play with the list of all metadata properties
GRIDMET$propertyNames()$getInfo()# Get a list of all metadata properties
(GRIDMET$get("product_tags")$getInfo()) # you can choose to show a characteristic like "product_tags"

Related

Error in upset_data : unused argument (nsets = 5) What could be causing this and how coul I fix the issue?

I am very new to R and I would like to make UpSet plot of peptides.
I have five lists (sets) in .txt format (ID_list_vysledok_pos_vs_healthy_files.txt, ID_list_vysledok_pos_neg_files.txt, ID_list_vysledok_New_vs_Old_collumn_files.txt, ID_list_vysledok_neg_vs_healthy_files.txt, ID_list_vysledok_Coated_vs_Liquid_junction_files.txt)
Each .txt file is just list of peptides in this format: List of peptides
I was following step by step instructions by this link : http://genomespot.blogspot.com/2017/09/upset-plots-as-replacement-to-venn.html
The code is working without problems until I want to make the graph with : upset(res2, nsets=5)
It gives me following error: Error in upset_data(data, intersect, mode = mode, encode_sets = encode_sets, : unused argument (nsets = 5)
The res2 dataframe looks like it should be looking to make this graph : View(res2)
I think the problem is trivial and sets may not be properly defined (but in the link I was following it is working), but I was not able to fix this...
I installed these libraries : library(plyr), library(reshape2), library(UpSetR)
Just to be sure I will provide the code (same as in link): Photo of code
Thank you for any suggestions.
It looks like you might be mixing up packages. You are trying to use upset_data function from ComplexUpset package, but passing nsets argument which works with upset from UpSetR package. I would recommend taking a closer look at which functions you use. If you want to use both UpSetR and ComplexUpset, you can distinguish them with ComplexUpset::upset and UpSetR::upset.

R package rcites: bulk enquiry using functions "spp_taxonconcept" and "map"

I have a csv file with a list of bird species (heading=Sci.Name) which I would like to bulk enquire their CITES appendix listing using the "spp_taxonconcept" function in the package rcites.
After setting the token, loading the csv file and all the packages needed I use the following code to generate the result in the column named "results":
bird.cites<-mutate(bird.cites,results=map(Sci.Name,spp_taxonconcept(taxonomy="CITES")))
which returns the following error msg:
x argument "query_taxon" is missing, with no default
Elements of the object "Sci.Name" was not passed to spp_taxaonconcept as the first argument, which should be query_taxon = "sci names of individual species" using the map function.
Any help with this would be greatly appreciated!
I think there are some syntax issues Try. -
bird.cites <- mutate(bird.cites,results=map(Sci.Name,spp_taxonconcept, taxonomy="CITES"))
which can also be written as -
bird.cites <- mutate(bird.cites, results = map(Sci.Name,~spp_taxonconcept(.x, taxonomy="CITES")))

How to see available parameters and documentation for a class method in R?

How can we see all available parameters (or view documentation more generally) for a class method?
For example, if we look at arguments for print()
?print
x
an object used to select a method.
...
further arguments passed to or from other methods.
quote
logical, indicating whether or not strings should be printed with surrounding quotes.
-- leaving others out for brevity --
useSource
logical indicating if internally stored source should be used for printing when present, e.g., if options(keep.source = TRUE) has been in use.
Note that we do not see any documentation for the parameter max_n.
Now suppose we call print() on something of class xml_nodes, e.g:
library(rvest)
library(dplyr)
# Generate an object of class xml_nodes
a <- rep("<p></p>", 30) %>%
paste0(collapse="") %>%
read_html %>%
html_nodes("p")
class(a)
# [1] "xml_nodeset"
a is of class xml_nodeset, and if we call print(a), it prints only 20 results, and that's because (I think) the xml_nodeset class is configured such that when print is called on it, it will only return 20 results. (the '20' number can be changed via the max_n parameter).
How do we find the specific documentation for how print will behave when called on the object of class xml_nodeset? (preferably via RStudio/manuals)
Note that the example above is just a random example, I would like to find a general way of finding documentation for all class methods
You can see all the "special" version of print by running methods(print). These versions are typically in the form <function name>.<class name>. Many listed there have astericks which means they are not directly exported from the packages where they are defined. If they have documentation, you can access it via ?print.rle for example. In this case there is no documentation for the print.xml_nodeset function. But you can look at it if you do getAnywhere(print.xml_nodeset) or if you happened to know it was from the xml2 namespace, you could do xml2:::print.xml_nodeset (with three colons).
There's also the sloop package which can tell you which S3 method will be called for a given invocation. For example
sloop::s3_dispatch(print(a))
=> print.xml_nodeset
* print.default
You could file an issue with the package maintainer asking to provide documentation for the function, but otherwise R can't really give you documentation if the author did not include it.

openmap NullPointerException Error in osmtile could not obtain tile

I am trying to plot a small rectangle of a map:
library(OpenStreetMap)
upper_left <- c(47.413, 8.551);
lower_right <- c(47.417, 8.556);
map_osm <- openmap(upper_left, lower_right, type = 'osm' );
plot(map_osm );
When I run that, the openmap function gives me the error Error in osmtile(x%%nX, y, zoom, type) : could not obtain tile: 540 298 10.
The documentation of OpenStreetMap seems to indicate that I need to add an API key. However, I am not sure how exactly I would do that (because I use type='osm', not type = url) and I am also unclear where I'd get such an API key from.
The java.lang.NullPointerException and the following R-error (Error in osmtile(...)) seem to come from an older version of OpenStreetMap.
By updating OpenStreetMap to the latest version (0.3.4 currently), the error disappears and the example code of OP should work as it is, without needing an API key.
The accepted answer is not adequate as the error can occur even with the most recent package version.
Sometimes if a particular area is not available in a specific style, you get an error similar to the one mentioned above independent of the package version. The solution would be to try the function with a different style. This is mentioned in the following blog post
As an example, the following modification may solve the issue:
library(OpenStreetMap)
upper_left <- c(47.413, 8.551);
lower_right <- c(47.417, 8.556);
map_osm <- openmap(upper_left, lower_right, type = 'opencyclemap');
plot(map_osm)

problems with multiDiv in paleotree package

I am trying to use the package paleotree to build LTT plots, but I get the following error when I try to input my trees.
a=read.tree(file.choose()) # to choose newick/nexus file
multiDiv(a)
Error in multiDiv(a) : Data of Unknown Type
Does paleotools only take objects of class 'multiphylo' ? I converted the imput tree to class multiphylo, but it still gives the same error. Can anyone suggest how to go about it?
I'm the author of package paleotree. I think what is going on here is that you are passing a single tree to multiDiv, which is setup for analyzing lists of objects, each of which are converted to a diversity curve. You probably want phyloDiv() instead. I can't be certain without know more about your data.

Resources