Category "r"

Organize columns with numerical info in colnames via dplyr relocate

I have a large amount of annual data in a data frame that will only get larger. I would like to organize it, grouping columns according to the year, which is

information on .o files for x64 is not available: NOTE on R package checks using Rcpp

I am using windows and just updated to R 4.0.3 (with RStudio to 1.3.959) and ran the R check for one of my packages which uses Rcpp and RcppArmadillo and I got

rpivottable: drop down lists open in wrong position

When clicking on drop down arrow, near grouping categories, the corresponding list opens on top of the page. (At first I thought it didn't work at all.). The co

syntax error near unexpected token in jupyter terminal

I write a r script below and want to run it in jupyter terminal. But it shows error: ./Rda_to_csv.r: line 1: syntax error near unexpected token `(' ./Rda_to_csv

Remove part of string after "."

I am working with NCBI Reference Sequence accession numbers like variable a: a <- c("NM_020506.1","NM_020519.1","NM_001030297.2","NM_010281.2","NM_011419.3"

Remove part of string after "."

I am working with NCBI Reference Sequence accession numbers like variable a: a <- c("NM_020506.1","NM_020519.1","NM_001030297.2","NM_010281.2","NM_011419.3"

Traverse a link tree for Shiny dashboard

I am making an interactive Shiny dashboard with typical "drill-down" capability. There are hundreds of thousands of links in the database. I am working on takin

if values of a column is in between two columns in R, populate a new column

I have two data frames of different lengths, like : df1 locusnum CHR MinBP MaxBP 1: 1 1 13982248 14126651 2: 2 1 21538708 2

How to use grep to search for patterns matches within a list of data frames using a second list of character vectors in R

I have two lists in R. One is a list of data frames with rows that contain strings (List 1). The other is a list (of the same length) of characters (List 2). I

How do I use geom_bar to not take the frecuency of my class but another value?

Im trying to graph the number of bases (A,C,G,T) each of my viruses have on a single histogram. library(readxl) library(ggplot2) Bases <- read_excel("/Users/

How can I distinguish results in ifelse

I want distinguish between $p-values$ for t-test and $p-values$ for Wilicoxon in this code, How can I do that? replicate(1000, ifelse(shapiro.test(rnorm(4))$p.v

Data Frame- Add number of occurrences with a condition in R

I'm having a bit of a struggle trying to figure out how to do the following. I want to map how many days of high sales I have previously a change of price. For

Multiply columns in dataframe by values given in another dataframe

I've been trying to accomplish this in dplyr but not been able to figure it out. In one data frame (df1) I have columns with values. |A |B | |23 |43 | |24 |11

How to do sum and filter in rbind function

I am using an R package which extracts data from tables in a database based on the flag for each table. If the flag is 1, extract data from that table. If the f

How to split negative and positive bars by zero line in barplot?

My data have 2 numerical columns (positive and negative values) and 2 categorical variables. Now I want to plot negative and positive bars on same line, instead

How to count unique entries in a column across multiple columns in R

I have a data set that looks something like this data set example I am trying to find unique entries in each of the columns I managed to do it for 1 column util

How do you populate missing dates for lag?

Say that I have a dataset. date <- c("2004-02-01", "2004-03-05", "2004-08-09", "2004-08-13", "2004-10-20", "2004-11-02", "2008-01-05", "2008-02-03", "2008-08

In a dashboard made with R, how can I filter/unfilter based on selectInput?

I have created a simple dashboard (link here) to display some data in R using selectInput. How can I activate/deactivate a filter reactively, so that the output

Customize R linters in VSCode

I'm trying to customize the linter settings in VSCode for R but I'm a little confused. I've checked just about every source available, from SO questions to the

How to get the names of factor levels corresponding to fixed effect regression coefficients for a GAM in R?

I have a gam in R (mgcv package) with 7 parameters, and one of them is a fixed effect with 30 levels (30 names). I want to analyse the regression coefficients f