Category "r"

Lag and lead a variable in a dataframe by 1 month and 6 business days for panel data

I have a large panel data set and I would like to lag and lead a variable by 1 month and 6 business days. I know, for instance, from dplyr there is the lag or

Combine list of dataframes into one dataframe and summarize in one step

I want to combine/reduce a list of dataframes into one dataframe, but I also want to summarize the data in one step. The output is from a simulation; therefore,

Exporting data from power query to csv in sharepoint using R

I hope to get a solution here. I am completely new to R and really all i need it for is to extract data from power query and append it to an existing csv file.

How to send a bulk email with csv file and a jpg image attachments using gmailr

I want to send a bulk email with an attachment. The list of receiving email addresses and the body of the email are in a CSV file as below. I want to attach a

R memory issues after reinstall

I have been running several R scripts without issue until one day I tried to open RStudio and it said "Fatal error: unable to open base package in R." I uninst

Creating a new column in a dataframe based on the answer choices in the other columns

I'm a bit confused on how to populate my new column based on character combinations I have from each of my other columns. Here is my original dataframe: df <

Is it possible to know the size of a variable that is being created while the function is running?

I am very new to R and I was exploring a function in a library that download data from a server and leaves the data as dataframe. The data are stored in a varia

renderPlots() not showing when on shinyapps.io but do show when I run app locally using conditionalPanel

I am trying to make one of two plots depending on browser size (from shinybrowser) using conditionalPanel. The plots are appearing when I run the app locally bu

Getting error $ operator not defined for this S4 class when findings mean of residuals [duplicate]

heyy i have a problem with getting the the below error. I am new to R and not sure how to resolve this!! I am trying to find the mean of resid

How to filter very small values in r?

I have a large dataset in which one column is p-values that range from 0.9 to being extremely small like 5e-79. In R I can sort the data in descending order and

Remove column with unique length in R [duplicate]

I have this data frame (train) where I have 2314 variables and I want to drop the columns where the unique length of the column is < 2 and

Use dplyr::select's where with base R grepl and anonymus function

There is a very similar question here: How to select columns based on grep in dplyr::tibble However I think that the select_if was superseeded with select(where

Issue with 'group_by' function when doing shapiro_test in R

I've asked this question previously with no luck, so here goes again: My dataframe: data.type <- c("DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA

adding more standard deviations to a plot

I'm trying to add more standard deviation to my current plot. I need to add 1std and 3std, I've already addeed the 2std to my plot. This is my code: tidyverse_

Storing looping rows in R

laststop <- NULL stopinfo <- NULL for (i in journeys$JourneyID){ laststop <- get_last_stop(i) stopinfo <- c(stop_info(i,laststop)) final_stops

Mean and Standard Deviation of x>=5 of 10000 data points binomial(10, 1/4)

I have a data range of 10,000 points as per: data = rbinom(10000, size=10, prob=1/4) I need to find the mean and standard deviation of the data values >=5.

Downloading files from GSE datasets

Does someone know where I can find the full files (Matrix, Barcodes and Features) in GEO datasets? I've been trying to download that from previous studies for a

Add text annotations at consistent locations in facet_grid when scale = 'free_y' + ggplot2 + r

I need to annotate a set of chats in a facet grid where the y axis is scale is set to scale = 'free_y'. As the scales are very different, when I set the y posit

How to interpret interactions in a multinomial ordinal regression (r)

A colleague and I ran a multinomial logistic regression using the 'ordinal' package in r and I am not sure how to interpret interactions between variables with

Fetching values from one column based on other column keys in long-formatted dataset

I have a long format dataset of 100,000+ individuals, capturing clinic visits at 5 different time points (not chronological). I've included an example dataset b