Quantcast
Channel: Active questions tagged r - Stack Overflow
Browsing all 206180 articles
Browse latest View live
↧

Filter Rows Between with Multiple Events per Subject

I have a large data set and I'm trying to filter the days following a specific event for each subject. This issue is that the "event" of interest may happen multiple times for some subjects and for a...

View Article


Getting error about inputting continuous numbers into a discrete scale

I have a homework assignment where I need to make five different graphs for 3 different sets of data. I am using ggplot2 to make the graphs, Openxlsx to load the data, grid to create multigraph figures...

View Article


Avoid sliderInput rounding

I'm having trouble with sliderInput rounding my starting value parameter when the min/max range is large. How can I prevent sliderInput from rounding my starting value parameter in cases like the...

View Article

Python equivalent of R's save()?

In R I can save multiple objects to harddrive using:a = 3; b = "c", c = 2 save(a, b, filename = "filename.R") I can then use load("filename.R") to get all objects back in workspace. Is there an...

View Article

Dropping rows by condition

I'm working on the Brazilian local elections database and now I need to drop rows that contain more than one candidate ELECTED by Municipality. My data looks like:>df Candidate Municipality...

View Article


R data.table : creating a count table of values in multiple columns by using .N

Here is my test DT;a<-data.table(cluster=sample(LETTERS[1:3], size = 10, replace = T), a=sample(x=1:2, size=10, replace = T), b=sample(x=1:2, size=10, replace = T), c=sample(x=1:2, size=10, replace...

View Article

Creating a df of unique combinations of columns in R where order doesn't matter

I want to create a df with all of the unique combinations of three columns where the order of the value doesn't matter. In my example, I want to create a list of all the combinations of ideology groups...

View Article

Draw a line between 2 zip code on US map in R

I have been trying to draw a straight line connecting 2 zip code in the US. So far I've only been able to plot points of each zip code in the US, but can't draw the line between themHere is what my...

View Article


Using a sliding window to identify and return the first success

I have and experiment where I am looking at bird visits to feeders. If they go to the correct feeder, it counts as a success. They are deemed to have learnt which feeder to visit once they are...

View Article


How to show a progressBar in a single function in shiny?

Here is an example. The progress bar just jumps from 0% to 100% due a single function getres(). How to indicate the progress smoothly?library("shiny") library("shinyWidgets") library("DESeq2")...

View Article

What happens when prob argument in sample sums to less/greater than 1?

We know that prob argument in sample is used to assign a probability of weights. For example, table(sample(1:4, 1e6, replace = TRUE, prob = c(0.2, 0.4, 0.3, 0.1)))/1e6 # 1 2 3 4 #0.2 0.4 0.3 0.1...

View Article

Image may be NSFW.
Clik here to view.

Count the number of non-zero elements of each column

Very new to R and I have a .rda file that contains a matrix of gene IDs and counts for each ID in 96 columns. It looks like this:I want to get separate counts for the number of non-zero items in each...

View Article

How to use \textcircled in Rmarkdown?

How can I use \textcircled from the textcomp package in the text of an .rmd document? I have tried using \( \textcircled{r} \) and \textcircled{r}. I would like to make html_document --- title: "my...

View Article


How to write R output with unequal length into excel

I have this R code to simulate time series data, the series have 5 colomns and 35 subN <- c(15L, 20L, 30L, 50L, 100L) SD = c(1, 2, 3, 4, 5) ^ 2 theta = c(0.2, 0.4, 0.6, 0.8, 0.9, 0.95, 0.99) res...

View Article

Easiest way to create indicator variables for changes in time series in R

I have a 14 million row dataset of products, tariff rates, trade volumes, and year-month combinations in the following format:df <- as.data.frame(matrix(c(1220, "2013-1", 10011900, 29307, .1, 1220,...

View Article


Trouble Deciding How to Test for Variance in Bulk RNA sequencing Data

I have some bulk-RNA sequencing data that I need to do differential expression significance testing on. I have two conditions, WT and KO, with two replicates each, giving me a dataframe that looks like...

View Article

Error: could not find a Python environment for /usr/bin/python3

I am trying to use the reticulate() package in R to run some Python packages.I run the following:library(reticulate) py_install("pandas") I obtain this error:Error: could not find a Python environment...

View Article


Image may be NSFW.
Clik here to view.

How to define different y-axis breaks for different facets in ggplot2?

I am doing a plot with 5 facets all in 1 column (one above the other). Each facet has a different scale, so I would like to control them independently. I found many posts about the usage of...

View Article

Complex dplyr group_by filtering

I cannot figure out how to write complex filtering criteria on groups in tidyverse. Consider the example dataframe below:df <- tibble( a = c(1,1,1,2,2,2,2,3), b = c(1,2,3,1,4,50,5,3), c = c("PIZZA",...

View Article

Left join only selected columns in R with the merge() function

I am trying to LEFT Join 2 data frames but I do not want join all the variables from the second data set:As an example, I have dataset 1 (DF1): Cl Q Sales Date A 2 30 01/01/2014 A 3 24 02/01/2014 A 1...

View Article
Browsing all 206180 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>