Category "r"

InternetOpenUrl failed: 'A connection with the server could not be established'

I have gone down a rabbit hole trying to set up Github actions to check the builds of my packages via usethis::use_github_action_check_standard(). The function

Facet title alignment using facet_wrap() in ggplot2?

I'm making a plot involving facets, and I am trying to fix the alignment of the facet/strip title. Right now it seems to left align to the panel, which places i

Add tags to post summaries of lithium themed hugo blogdown website

Using the guidance linked to at Add template for taxonomies to Blogdown default theme I was able to add tags to show-up at the top of my posts and create a /tag

Change variable chunk of a Netcdf with R

Regularly I face the same problem when using R to work with big netcdf files (bigger than the computer memory). There is not an obvious way to change the chunk

How to apply slope plot R code to another data

I have dataframe which represents sales by model within 2 different years. 'change' column stands for absolute change by models from 2020 to 2021 while 'chng.pe

Error when renaming columns with plyr in a loop in R

I found similar error but it seems the problem is not the same. for (i in colnames(t[,4:ncol(t)])) { for (j in poids_teff$station) { if (i == j) { t

Is there an R function for setting rows on aggregate data?

The data I am working with is from eBird, and I am looking to sort out species occurrence by both name and year. There are over 30k individual observations, eac

R function to start new line every n words?

I want to create an R function that inserts a "\n" after every n words in a string (where n is an argument). e.g. startstring <- "I like to eat fried potat

Error: $ operator not defined for this S4 class while running hoslem.test

I'm working on an optimization of a logistic regression model made with glm, the optimization is a lasso regression using glmnet. I want to compare both models

I'd like to gather the data frame with two key columns in R

I'd like it to gather the dataframe with two key columns, one would be mean and the other variance. Here is the data frame: est1_mean est1_var est2_mean est

Can't build RDCOMClient using rtools40 and R 4.0

A while back, I created a fork of the RDCOMClient package to keep it working with R 3.6 (https://github.com/dkyleward/RDCOMClient). People are now running into

How could I bar_plot this data.frame?

vertejumi_ceturksnos <- data.frame( Vertejumi = c("0", "1", "2", "3"), Pirmais = c(Pirmaiss), Otrais = c(Otraiss), Tresais = c(Tresaiss), Ce

R not changing Plotly colorscales for Contour plots

Okay, so I am using a generic data set to troubleshoot this problem. Here is the code I am entering into R: library(plotly) fig <- plot_ly( type = 'cont

Abnormal termination of R session on Rstudio server with DECIPHER alignment

I am running an alignment with the DECIPHER package in bioconductor using an Rstudio instance located on a server. dna1 <- RemoveGaps(dnaSet, removeGaps = "a

Access Google's Campaign Manager 360 Reporting API with R

I am trying to access campaign manager 360 Reporting API with using the httr package in R. This is the code I have run so far to test the connection and I keep

How to draw circles of defined radius around multiple points and export to kml file

I have a set of points saved with their respective latitude and longitude in a data frame like this: points = data.frame(point_id = 1:3, lat = c

Split a data frame by median

I would like to divide my data based on the median into high and low. I want to put it in one column. df <- data.frame(salary = c(623.3,515.2,611.0,729.0,843

Is it impossible to install R 4.0 on Ubuntu 18.04.4 LTS because r-base-core requires a libc6 version >= 2.29?

I am trying to install R 4.0 on Ubuntu 18.04.4 LTS but I keep getting errors of > sudo apt install r-base-core Reading package lists... Done Building depen

How to use jupyter notebook with R kernal in VS code?

Now I can use jupyter lab with R kernal in a web browser and use VS Code to edit jupyter note book code with python kernal, is it possible to edit R code in VS

Filling a column based on the value of another column in data.table

I have data as follows: dat <- structure(list(amount_of_categories = c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L ), mun