ggplot2::geom_text(): how to display all factor levels, but suppress specific...
Here is code to give context to my question:set.seed(1); tibble(x=factor(sample(LETTERS[1:7],7,replace = T),levels = LETTERS[1:7])) %>% group_by_all() %>% count(x,.drop = F) %>% ggplot(mapping...
View ArticlePredicted SE vary from ggeffects::ggpredict - what am I doing wrong? 'Object...
I am running an analysis in r on the effect of canopy cover (OverheadCover, proportion bounded by 0,1) and the number of carcasses placed on the same location (CarcassNumber, factor with 2 levels) on...
View Articleerror with rda test in vegan r package. Variable not being read correctly
I am trying to perform a simple RDA using the vegan package to test the effects of depth, basin and sector on genetic population structure using the following data frame. datafile. The "ALL" variable...
View ArticleHow to find adjusted mean in linear regression in R?
I am trying to build a multiple linear regression model: lm1 <- lm(outcome ~ sex + age + education + cohort, data=data.in) Among the independent variables, sex, education, and cohort are all...
View ArticleDownload Excel File from .ASPX page in R
I am trying to download a .xlsx file from an embedded "Export to Excel" link within a .aspx webpage.https://www.ftportfolios.com/Retail/Etf/EtfHoldings.aspx?Ticker=FTSMI have tried the following code,...
View ArticleIs there a propper Cuthill Mckee reordering for R?
I have a Lagrangian matrix with the following sparsity structures:This is the matrix sparsity structureI want to use the Cuthill Mckee ordering, but I can't really figure out how to use it in R. I...
View ArticleRenaming a column using name that includes a newline character/carriage return
I have imported survey response data and the variables need renamed as their far too long and unwieldly for analysing. As there's 140 variables i was using the rename function in the plyr package,...
View Articlergl: how to produce higher resolution snapshots?
For a book, I want to show two rgl images side-by-side, as in the image below. But the publisher wants images with at least 300 dpi resolution.I created this using the code below to produce two...
View ArticleHow to assign row changes to an existing matrix within an 'apply' function...
In R one can use the <<- symbol within the lapply() function to assign a value to a variable outside lapply().Let's consider a matrix full of 1:m<-matrix(data=1, nrow=5, ncol=5) Let's say I...
View ArticlePandas Dataframe Styles are not working with Jupyter Notebook
I have a dataframe which is constructed using a list and other dataframe that i read from excel file. What I want to do is, I just have to apply the background color to first row of a dataframe which I...
View ArticleHow do I create unique folder for each doParallel process?
I'm using doParallel to process a big dataset. The processing requires me to create a temp folder to store intermediate results. Though I need the folder names to be unique so that doParallel processes...
View ArticleVectorized if_else or case_when which doesn't eagerly evaluate its potential...
dplyr has the vectorized conditionals if_else and case_when.However, both of these eagerly evaluate their possible outputs (true/false for if_else, the RHS of the formula for...
View ArticleHow can i choose the page number in Rmarkdown?
What can i do to my pdf output start not in page 1 but in the page 40?Thanks!
View ArticleError in eigen(S %*% P %*% S, symmetric = TRUE, only.values = TRUE) :...
I'm trying to conduct a network meta-analysis using the netmeta package, but keep getting this error message. All the standard errors and treatment effects are entered and non-zero. Does anyone know...
View ArticleCustom Keras Layer in R
SetupSuppose I have a neural network architecture written in Keras (R) whose last layer outputs n outputs, so something like this A∘σ∘B For some matrices A and B, and some activation function σ (for...
View ArticleR: passing API request as an argument to a function
What is the correct way to form an API request which can be passed to a function as an argument? The request is intended to be constructed inside another function with specific arguments.An example of...
View ArticleCode folding in bookdown
The Code folding option in RMarkdown for html documents is awesome. That option makes the programmatic methodology transparent for those who are interested, without forcing the audience to scroll...
View ArticleRSelenium error - com.google.common.collect.Maps$TransformedEntriesMap...
I am trying to use RSelenium automate a data entry task for my job in which I must input some variables into an online system. There are 5 variables to enter, and my code works for all of them except...
View Articleofficer: this document contains fields that may refer to other files
I'm creating Microsoft Word outputs using the amazing officer package in R. I'm using a template Word document to specify much of the formatting. Below is a code snippet that illustrates what I'm...
View ArticleCreate a variable by assigning a sequence to each id R
I have this column from a dataframe with Ids:id 1 3 9 12 11 The ids don´t repeat in the dataframe. I´m trying to creating a new dataframe assigning a sequence c(-1:1) for each id. I´m trying to get...
View Article