Category "r"

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

How to get x-axis to show all months in dataset

I can't figure out how to customize the x-axis in the graph below. At minimum, I would like each month to be labeled on the x-axis. All help is appreciated. dpu

Dynamically named dots passed to lapply

This isn't really a httr2 specific problem though it is easy to illustrate this way. If I have a param that is being to a function that I want to lapply on and

Checking the normality assumption of a linear mixed effects model

I have the following code for an LME: IDRTlme <- lme(Score ~ Group*Condition, random = ~1|ID, data=IDRT) I want to check the normality assumption, and so I h

An R Loop to wrap text in multiple saved excel files

I have hundreds of excel files with a single column and a single sheet containing text. I am trying to write a loop that will 'Wrap Text' and align the single c

Why doesn't R dplyr arrange sort properly using a vector element within a for loop

I'm having trouble getting r's dplyr::arrange() to sort properly when used in a for loop. I found many posts discussing this issue (like ex.1 with the .by_grou

Merging data frames by selecting for correct value

I have a data frame called "ref" that contains information that allows mapping of gene entrez ID to the gene's start and end positions. I have another data fram

Is there an R function to convert 'flowFrame' structure of 'flowCore' package to a 'data.frame'?

Objective: To view .fcs data as a dataframe using R language. Flow Cytometry data comes in .fcs file format. The file is read in the flowFrame structure produce

What is the python equivalent for names() function in R

I have a code in R, where in the data frame "inputdata" there are multiple columns, and we are replacing the word "new" with "old" in the entire data frame: nam

How to return a reactive dataframe from within a shiny module that depends on a button click?

Aim: Return a reactive dataframe object from within the module named "modApplyAssumpServer" Problem: I am getting an endless loop. Even if I wrap everything wi

Create different xlsx sheet header colors in R

I would like to have different header colors for the xlsx sheet I'm creating. However, I'm only able to create a single color for the header with the below code