How to fix linking issue in titlesec? - r

Following this answer I'm using titlesec package to get my headers in sans serif.
Looks pretty; however there seems to be a problem with latex titlesec package using rmarkdown. The bookmarks are confused, also the linking within the document is not working well (i.e. clicking the bookmark doesn't jump correctly to the header).
I'm showing an image of Acrobat Reader bookmarks with titlesec line activated (left) and commented out (right):
Any suggestions? I'm using MiKTeX.
MWE:
---
output: pdf_document
subparagraph: yes
header-includes:
- \usepackage{lipsum} # produces dummy text
- \usepackage[sf,bf]{titlesec} # titlesec line
---
# Header1
\lipsum[1]
## Header1.1
\lipsum[1-7]
### Header1.1.1
\lipsum[1-7]
## Header1.2
\lipsum[1-7]
### Header1.2.1
\lipsum[1-7]
Session info:
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252
[3] LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.12.19 rstudioapi_0.8 knitr_1.20 magrittr_1.5 hms_0.4.2
[6] devtools_1.13.6 munsell_0.5.0 colorspace_1.3-2 rlang_0.2.2 tools_3.5.1
[11] data.table_1.11.8 rio_0.5.10 withr_2.1.2 htmltools_0.3.6 readxl_1.1.0
[16] yaml_2.2.0 rprojroot_1.3-2 digest_0.6.18 tibble_1.4.2 crayon_1.3.4
[21] zip_1.0.0 curl_3.2 memoise_1.1.0 evaluate_0.12 haven_1.1.2
[26] rmarkdown_1.10 openxlsx_4.1.0 cellranger_1.1.0 compiler_3.5.1 pillar_1.3.0
[31] scales_1.0.0 forcats_0.3.0 backports_1.1.2 foreign_0.8-71 pkgconfig_2.0.2

Related

excelTable from excelR package R programming is not showing out put

excelTable() from ExcelR package is showing no output in the Viewer Pane. I have updated all the dependent packages. what could be the problem?
data = data.frame(Model = c('Mazda', 'Pegeout', 'Honda Fit', 'Honda CRV'),
Date=c('2006-01-01', '2005-01-01','2004-01-01', '2003-01-01' ),
Availability = c(TRUE, FALSE, TRUE, TRUE))
columns = data.frame(title=c('Model', 'Date', 'Availability'),
width= c(300, 300, 300),
type=c('text', 'calendar', 'checkbox'))
excelTable(data=data, columns = columns)
sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
1 LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
1 stats graphics grDevices utils datasets methods base
other attached packages:
1 jsonlite_1.6 htmlwidgets_1.5.1 excelR_0.3.1 covr_3.3.2 testthat_2.1.1 shiny_1.4.0
loaded via a namespace (and not attached):
1 Rcpp_1.0.0 pillar_1.3.1 compiler_3.5.1 later_1.0.0 plyr_1.8.4 tools_3.5.1 digest_0.6.18 tibble_2.0.1 gtable_0.2.0 lattice_0.20-35 pkgconfig_2.0.2 rlang_0.4.1 Matrix_1.2-14
[14] rex_1.1.2 rstudioapi_0.9.0 yaml_2.2.0 fastmap_1.0.1 dplyr_0.8.0.1 grid_3.5.1 tidyselect_0.2.5 glue_1.3.0 R6_2.4.0 ggplot2_3.1.0 purrr_0.3.1 magrittr_1.5 scales_1.0.0
[27] promises_1.1.0 htmltools_0.4.0 assertthat_0.2.0 mime_0.6 colorspace_1.4-0 xtable_1.8-3 httpuv_1.5.2 bs4Dash_0.3.0 lazyeval_0.2.1 munsell_0.5.0 crayon_1.3.4
After discussing this issue with the package developer, I found that the version of the rstudio is the main cause of the problem of not viewing the output. The code is running successfully on the versions 1.2.5019 and 1.2.1322 and not in the older versions like 1.1.456. Thanks all!
Check if you are using html_notebook output type. That output type will always have inline output. May be try to choose a different R markdown document type. Go to File and click 'New' then click 'R Markdown' and then 'Document'. That should open an html_document output type, which will follow your preferences for inline output.

Double question mark (??) help search not working in RStudio (and RStudio only)

strange behaviour I noticed in my RStudio installation:
Help search via the double question mark (e.g., ??gg) does not work in RStudio. It gives me "No results found" in the Help pane.
Help search via the upper search field in the Help pane works as intended and returns results for the example search above.
?? works in the Mac OS R GUI ("R.app"), it opens a browser tab with the results page.
Single question mark ? works also in RStudio (but of course only with exact matches to names).
Does anybody know how to resolve this? Thanks!
EDIT: My sessionInfo():
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] jsonlite_1.6 scales_1.0.0 tidyr_0.8.3 ggplot2_3.2.0 koRpus.lang.de_0.1-1 koRpus_0.11-5
[7] sylly_0.1-5 readxl_1.3.1 data.table_1.12.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 highr_0.8 cellranger_1.1.0 pillar_1.4.1 compiler_3.6.0 tools_3.6.0 zeallot_0.1.0
[8] digest_0.6.19 tibble_2.1.3 gtable_0.3.0 pkgconfig_2.0.2 rlang_0.4.0 cli_1.1.0 rstudioapi_0.10
[15] curl_3.3 yaml_2.2.0 xfun_0.8 knitr_1.23 withr_2.1.2 dplyr_0.8.1 vctrs_0.1.0
[22] grid_3.6.0 tidyselect_0.2.5 sylly.de_0.1-2 glue_1.3.1 R6_2.4.0 fansi_0.4.0 purrr_0.3.2
[29] magrittr_1.5 backports_1.1.4 fortunes_1.5-4 assertthat_0.2.1 colorspace_1.4-1 labeling_0.3 utf8_1.1.4
[36] lazyeval_0.2.2 munsell_0.5.0 crayon_1.3.4

Problem in importing .biom file from the Earth Microbiome Project (release1) in R

I want to import a .biom file in R that I've dowloaded from the ftp server - the Earth Microbiome Project (release 1).
The file comes from the following link: ftp://ftp.microbio.me/emp/release1/otu_tables/closed_ref_silva/
I tried with several of these files but the one I want to import in R (studio) is the first one: 'emp_cr_silva_16S_123.qc_filtered.biom' (293MB)
I've tried several things:
I tried to open it with both the phyloseq::import_biome and the bioformat::read_biom functions :
emp<-import_biom(BIOMfilename = biom.file)
I got the following Error message:
Both attempts to read input file:
E:/Path/to/my/data/EMP_data/emp_cr_silva_16S_123.qc_filtered.biom
either as JSON (BIOM-v1) or HDF5 (BIOM-v2).
Check file path, file name, file itself, then try again.
I then checked the file path and name with the is_file function of the 'fs' package.
Then I checked the .biom file I want to import, openning this .biom file with Notepad shows strange characters (sorry but I am not familiar with developing) such as:
ƒOB§ß;}]0v(ÿQ<ãï8 #OÅ+q8‚´'Ž;º‹ë®Ü-¯§-‡ùP
I had a look at other biom files I have but none of them look like this. I try to open these other files with the same function and it works.
I tried to obtain this file from other repositories (https://zenodo.org/record/890000) but have a similar problem.
The problem most likely comes from the file format but I don't know how to deal with this.
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] biomformat_1.8.0 phyloseq_1.24.2 fs_1.3.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 bindr_0.1.1 compiler_3.5.0 pillar_1.4.2
[5] plyr_1.8.4 XVector_0.20.0 iterators_1.0.9 tools_3.5.0
[9] zlibbioc_1.26.0 jsonlite_1.6 tibble_2.1.3 nlme_3.1-137
[13] rhdf5_2.24.0 gtable_0.2.0 lattice_0.20-35 mgcv_1.8-24
[17] pkgconfig_2.0.2 rlang_0.4.0 igraph_1.2.4.1 Matrix_1.2-14
[21] foreach_1.4.4 rstudioapi_0.10 yaml_2.1.19 parallel_3.5.0
[25] bindrcpp_0.2.2 dplyr_0.7.6 stringr_1.3.1 cluster_2.0.7-1
[29] Biostrings_2.48.0 S4Vectors_0.20.1 IRanges_2.14.10 multtest_2.36.0
[33] tidyselect_0.2.5 stats4_3.5.0 ade4_1.7-11 grid_3.5.0
[37] glue_1.3.1 Biobase_2.40.0 data.table_1.12.2 R6_2.4.0
[41] survival_2.42-3 purrr_0.2.5 reshape2_1.4.3 Rhdf5lib_1.2.1
[45] ggplot2_3.2.0 magrittr_1.5 splines_3.5.0 scales_1.0.0
[49] codetools_0.2-15 MASS_7.3-50 BiocGenerics_0.26.0 assertthat_0.2.0
[53] permute_0.9-4 ape_5.1 colorspace_1.4-1 stringi_1.1.7
[57] lazyeval_0.2.1 munsell_0.5.0 vegan_2.5-5 crayon_1.3.4 ```
The .biom file is encrypted, complessed or mislabled, so I don't think you will be able to use it this way.
A usable version should look like examples given here:
http://biom-format.org/documentation/format_versions/biom-1.0.html
You could ask the owners of the file if they could provide you with a correct version.

Error in generator$render using serve_site in R Blogdown

When I open my R Studio blogdown project and serve_site() it previews in the viewer and seems fine except that the content is not updated as it is in .Rmd files. It seems as though the preview site is getting stuck on the old .html files.
When saving an edited blogdown post in R Studio after executing serve_site() I expect the live preview to update.
Right now however, if I make a small edit to a post and click save, the preview fails and I get the following error that I can't make sense of or fix:
Error in generator$render(input_file = input_file, output_format = output_format, :
You probably should not knit the document in a blogdown project. Just call blogdown::serve_site() once per R session. See https://bookdown.org/yihui/blogdown/workflow.html. If you are sure you want to knit it and know what it means, set options(blogdown.allow_knit = TRUE).
Calls: <Anonymous> -> <Anonymous>
Execution halted
sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.2
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.2.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 compiler_3.4.3 later_0.8.0 prettyunits_1.0.2 remotes_2.0.2
[6] tools_3.4.3 testthat_2.0.1 digest_0.6.18 pkgbuild_1.0.2 pkgload_1.0.2
[11] jsonlite_1.6 evaluate_0.13 memoise_1.1.0 rlang_0.3.1 rstudioapi_0.9.0
[16] cli_1.0.1 curl_3.3 yaml_2.2.0 blogdown_0.10.5 xfun_0.4
[21] stringr_1.4.0 withr_2.1.2 knitr_1.21 desc_1.2.0 fs_1.2.6
[26] devtools_2.0.1 rprojroot_1.3-2 glue_1.3.0 R6_2.4.0 processx_3.2.1
[31] rmarkdown_1.11 bookdown_0.9 sessioninfo_1.1.1 servr_0.12 callr_3.1.1
[36] magrittr_1.5 backports_1.1.2 ps_1.3.0 promises_1.0.1 htmltools_0.3.6
[41] usethis_1.4.0 rsconnect_0.8.13 assertthat_0.2.0 xtable_1.8-3 mime_0.6
[46] httpuv_1.4.5.1 stringi_1.3.1 miniUI_0.1.1.1 crayon_1.3.4

Why does a simple shiny app running on local open source RStudio have very variable loading times?

UPDATE
As an update to the below post I've started to run into issues with inconsistent loading speeds for simple shiny apps launched locally (i.e. not on shiny server) again.
Essentially the very simple app below sometimes does not open within an RStudio window. Sometimes it opens with a long wait time, and sometimes straight away. This is an issue because I'm working on a larger shiny project, and I of course need reliable loading times.
I have a feeling that it may be due to my network/computer configuration - but I can't figure it out.
I've recently installed the latest version of RStudio, R and Shiny (package).
Below is my sessionInfo() result:
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Rcpp_0.12.19 httpuv_1.4.5 lubridate_1.7.4 later_0.7.5 shinyjs_1.0
[6] shinydashboard_0.7.1 shiny_1.1.0 gridExtra_2.3 magrittr_1.5 forcats_0.3.0
[11] stringr_1.3.1 dplyr_0.7.7 purrr_0.2.5 readr_1.1.1 tidyr_0.8.2
[16] tibble_1.4.2 ggplot2_3.1.0 tidyverse_1.2.1
loaded via a namespace (and not attached):
[1] tidyselect_0.2.5 haven_1.1.2 lattice_0.20-35 colorspace_1.3-2 htmltools_0.3.6 yaml_2.2.0
[7] rlang_0.3.0.1 pillar_1.3.0 glue_1.3.0 withr_2.1.2 modelr_0.1.2 readxl_1.1.0
[13] bindrcpp_0.2.2 bindr_0.1.1 plyr_1.8.4 munsell_0.5.0 gtable_0.2.0 cellranger_1.1.0
[19] rvest_0.3.2 broom_0.5.0 xtable_1.8-3 scales_1.0.0 backports_1.1.2 promises_1.0.1
[25] jsonlite_1.5 mime_0.6 hms_0.4.2 digest_0.6.18 stringi_1.2.4 grid_3.5.1
[31] cli_1.0.1 tools_3.5.1 lazyeval_0.2.1 crayon_1.3.4 pkgconfig_2.0.2 xml2_1.2.0
[37] assertthat_0.2.0 httr_1.3.1 rstudioapi_0.8 R6_2.3.0 nlme_3.1-137 compiler_3.5.1
I'm relatively new to Shiny apps and can't get my app to work locally. I used the template before:
ui <- fluidPage("Hello World")
server <- function(input, output){}
shinyApp(ui = ui, server = server)
I could get this to work, deploying a window displaying "Hello World" both in a local R window and in a browser window.
I've since updated R's packages and I cannot get it to work. RStudio deploys a local window which is greyed out (not displaying "Hello World") and the browser window now claims the page cannot be found.
The RStudio console says:
Listening on http://XXX.X.X.X:XXXX
No other error messages are displayed. Any help would be appreciated. Most message boards start with "My app works locally but..." so research hasn't helped.
Thanks.

Resources