Export GT table with Officer - r

I am trying to export a gt table using the package officer but I get this error message.
Error in UseMethod("ph_with", value) :
no applicable method for 'ph_with' applied to an object of class "c('gt_tbl', 'list')"
I already updated officer and all the packages I have installed. I also installed the github version. Do you have any idea how to export it?
Thank you very much

Related

Problem loading SjPlot after installing parameters

I'm getting the almost the same error as the previous post, but the answers there are not working for me. I was able to use sjPlot with no issues until this afternoon when I installed parameters and sandwich and clubsandwich. I don't know what else I can do to get over this.
the error:
> library(sjPlot)
Error: package or namespace load failed for ‘sjPlot’:
object ‘standard_error_robust’ was not exported by 'namespace:parameters'
In addition: Warning message:
package ‘sjPlot’ was built under R version 4.1.3
Any help would be much appreciated. Updating parameters didn't solve it. Meanwhile, is there an equivalent function for tab_model()? (since I cannot use it...). Thanks in advance.
devtools::install_github("strengejacke/sjPlot") worked for me :D

rhdf5 package to look at the contents of a RNAseq publically available dataset in Rstudio

Hope you are doing well.
I am getting a publicly available RNA-seq dataset into Rstudio. Anyway, when I want to use the (h5ls) function from the rhdf5 package to look at the contents of this dataset but it returns the following error:
Error in h5ls(archs4.mouse) : HDF5. Object header. Can't get value.
Could you please tell me what is wrong?

How to fix 'found more than one class "xts" in cache' message in R?

In a custom package I'm using the class xts which leads to a namespace conflict when loading the quantmod package. Apparently, one can solve the problem by specifically importing functions from the quantmod package to the custom package. However, I don't want to do that as quantmod in my case is loaded as a dependency of highcharter.
Is there a way to resolve the conflict so that the message Found more than one class "xts" in cache; using the first, from namespace 'custom_package' Also definded by 'quantmod' doesn't show every time I'm working with an xts object?

character(0) warnings when running devtools::load_all(".") in RStudio

I have an R package that I've been building in RStudio, let's called it my_pkg. When I run devtools::load_all(".") within RStudio (specifically using the Ctrl + Shift + L shortcut), I get the following message:
Loading my_pkg
Warning messages:
1: character(0)
2: character(0)
3: character(0)
4: character(0)
5: character(0)
All of the functions in the package work fine. My NAMESPACE and DESCRIPTION files are complete with no syntax errors. When I run ?my_pkg, however, the help file does not match the specifications provided in the DESCRIPTION file. When I remove the Imports from DESCRIPTION, there is no more character(0) warning message. Of course, I need those imports. When I change Imports to Suggests, there is character(0) warning message.
Here is the description file content, with some stuff changed to protect IP.
Package: scoutdroid
Title: This is where the title is.
Version: 0.1
Authors#R: "Ben Hanowell <benjamin.hanowell#redfin.com> [aut, cre]"
Description: This is where the description is.
Depends:
R (>= 3.1.0)
Imports:
dplyr,
lubridate,
mboost,
randomForestSRC,
RODBC,
stringr
License: file LICENSE
LazyData: true
And here is NAMESPACE.
# Generated by roxygen2 (4.0.1): do not edit by hand
import(RODBC)
import(dplyr)
import(lubridate)
import(mboost)
import(parallel)
import(randomForestSRC)
import(stringr)
When I use the RStudio Build & Reload button in the Build tab, I get the following warnings:
** preparing package for lazy loading
Warning: replacing previous import by 'lubridate::intersect' when loading 'scoutdroid'
Warning: replacing previous import by 'lubridate::setdiff' when loading 'scoutdroid'
Warning: replacing previous import by 'lubridate::union' when loading 'scoutdroid'
edit Added some more details to help folks understand what might be going on.
edit 2 I also added the DESCRIPTION file, although I don't provide the full package, which is proprietary.
edit 3 Added NAMESPACE.
edit 4 Added warnings that occur when using RStudio Build & Reload button in the Build tab.
After some dialoge in the comments, we figured out that the empty warnings that load_all is giving you are actually initiated when loading the package because of function name conflicts.
The issue is that you are importing a function from a package, then overwriting that function. When that happens R throws warnings as you saw when you clicked "Build & Reload" in RStudio:
Warning: replacing previous import by 'lubridate::intersect' when loading 'scoutdroid'
Warning: replacing previous import by 'lubridate::setdiff' when loading 'scoutdroid'
Warning: replacing previous import by 'lubridate::union' when loading 'scoutdroid'
It looks like load_all may be attempting to muffle those warnings (just a guess) which is why you see character(0) instead of the actual warnings. (These particular warnings are difficult to silence.)
It is generally not a good idea to import an entire package's namespace. You should instead import only the symbols you need. See this post of mine for more.
The solution is to use importFrom instead of import in your NAMESPACE file.
It can also be due to a broken link in the roxygen2 documentation. For example when you link to a function external to your package with the wrong name, say \link[stringi]{STRI_C} instead of \link[stringi]{stri_c}

R package with dependency on shiny gives RJSONIO warning

My package CTDesignExplorer uses shiny (and shinyIncubator). When I include
Depends: shiny
in the DESCRIPTION file, there are warnings upon loading the package in RStudio:
Warning in .simpleDuplicateClass(def, prev) :
the specification for S3 class “AsIs” in package ‘RJSONIO’ seems equivalent to one from >package ‘BiocGenerics’ and is not turning on duplicate class definitions for this class
In command line R, loading shiny gets multiples warnings; in addition to "AsIs", with "connect", "file", "pipe", and "textConnection".
At https://github.com/joey711/phyloseq/issues/128, the issue is supposedly solved 6 months ago, but here it is, even after update.packages("RJSONIO"). Version is 1.0-3, from 2013-03-27.
At https://stat.ethz.ch/pipermail/bioc-devel/2013-March/004177.html, the suggestion was to remove RJSONIO from NAMESPACE. But it's not there (or in DESCRIPTION) in my package. In shiny, it's under Imports in DESCRIPTION.
This probably has no impact on code execution, but it's hard to be sure. Anyway, sure is ugly for my users to see.
I think it might help to switch Shiny from Depends to Imports in your package. And, if necessary, use importFrom in your NAMESPACE file to import specific Shiny functions, instead of bringing in all of Shiny.
http://cran.r-project.org/doc/manuals/R-exts.html#Specifying-imports-and-exports

Resources