Category "r"

How to Determine the K^th character in the concatenated string

Given a list that contains N strings of lowercase English alphabets. Any number of contiguous strings can be found together to form a new string. The grouping f

Mean columns with almost the same name

I have a data frame containing only one row with named columns. The data frame looks somewhat like this: poms_tat1 poms_tat2 poms_tat3 tens1 tens2

Fast matrix determinant calculation with specific structure

I have a k*k squared matrix with diagonal elements x>0 and all other elements y>0. The values of k, x, y are all subject to change. Now I need the determi

Saving patchwork ggplots with furrr future map only saves one of the plots

I am trying to save a list of patchworked ggplots (ie ggplots that have been wrapped together into 1 plot using the package patchwork). My real data is creating

R markdown not knitting because of parse raw had been removed

I've been having problems on knitting Rmarkdown, and it's been frustrating that I have no idea what to do. Every time I knit them, it always ended up with an er

error in command "installed.packages" in R language

This command: installed.packages(c("ggplot2","swirl","lattice","car","fimport","tseries")) generates the error "Package LibPath Version Priority Depends Im

more VARBINARY columns in result set fo SQL Server R sript

In my R script for MS SQL Server I try to return one column VARBINARY() and one VARCHAR(). However, server allow only one column when VARBINARY is returned: T

Plot customised vertical lines up to the curve

I want the vertical lines to not go beyond the curve line after they intersect Example data: x <- 1:50 dat <- data.frame(x = x, y = 1 - exp(-x/43)^4) ggp

How to swap x-axis tick labels with plus/minus signs table

I'm struggling to figure how to change my x-axis label in ggplot2 from regular identifications to not-so-regular plus/minus signs to relate the addition or abse

Suppress messages in console when running shiny

See example: shinyFunction <- function(){ shinyApp( ui = basicPage( actionButton('print_message', "Print a message") ), server = fun

Modify a single cell value in dplyr

Let's say I have the following dataset: dat <- read.table(text="id_1 id_2 123 NA 456 NA NA 3

truthTable in Rstudio Error: incorrect outcome specification

I was trying to do a QCA analysis of sufficeny in RStudio 4.1.3. using truthTable command. By running the code i get Error: wrong outcome specification. The out

Connect to Azure SQL - Token Based

I've tried this over on the Rstudio forums and they've suggested i post here/azure support. Azure doesn't seem to be helping right now so if anybody has any sug

Trying to bold y axis in ggplot

I am trying to bold my y-axis. The title for the axis is bold, but I can't seem to figure out how to bold the number themselves. Here is my code so far, combi

Pandas: How to add a grouping variable based upon another column?

I have a dataframe with some id's and some dates. I want to be able to group the id's by their change in date to create a generalized "grouping_variable". In r

Change sparkline coloring in shiny DT table

Below is the code to develop sparkline in R. Wanted to check if we can change the color . I mean the negative values to be black and positive values to be red l

Conditional mutate - creating a new variable with coalesce

I'm scraping data from a website and depending on the structure of the page. I have an inner join in my final table that either joins clean on WON and LOST vari

Can anyone help me with this crontab?

We want to download the stock price of Tesla every day, using the package "quantmod" in R. We managed to write the function that downloads the last available st

Spade in FlowJo v10.0

I have an issue with installing the spade package in R: > source("http://bioconductor.org/biocLite.R") Bioconductor version 3.7 (BiocInstaller 1.30.0), ?bio

Conditional formatting of multiple columns in gt table

This is my first post, so apologies if I messed something up. I am trying to apply conditional formatting to multiple columns (comparing results for samples Sam