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

Trying to calculate retention rate in R, how to divide one row by another...

I am attempting to calculate retention rate of an Instagram story (# of viewers on the last frame divided by # viewers on first frame) within the same date. I have this data within a data frame in R...

View Article


Save a data.frame of a list as a csv file in R

I have an object named output that is of class data.framecontaining a list. I was wondering if it might be possible to save output as a csv file from R?Here is my code:d <- data.frame(list(A = c(kap...

View Article


How to pipe to if statements in R

I have data from my Facebook, Twitter, Instagram, Youtube, and LinkedIn accounts that I'd like to analyze. I have a data frame similar to the following:df <- data.frame(tw_likes =...

View Article

How do I superimpose a frequency polygon on top of a histogram in R using lines?

I'm a beginner at R and RStudio and I'm trying to make a frequency polygon on top of a histogram using the "cars" dataset.hist(speed) lines(speed, lwd=2, col = "royalblue") This is the output I'm...

View Article

Prepend a ggplot2 object to a list of plots

Suppose I have a list of plots plotlist and I want to call patchwork::wrap_plots(plotlist).I also want to prepend one more plot to the beginning of the list.Let's start with a list that has 2...

View Article


Get X rows from dataframe based on lowest values in specified column; and...

top_n in dplyr is doing almost what I want; however, when there are ties it returns all, but I would like it to randomly select among the ties to satisfy my cutoff of 2 rows. top_number=2 x <- c(1,...

View Article

In R is there a way to increase the number of iterations of a likelihood...

I have a GLMM that I am performing using lme4 that requires me to increase the number of iterations of a given model for it to converge. (see below)Eavers <-glmer(Total.Aversive ~...

View Article

Zonal statistic calculating pixel share and determine the most frequent class...

I already posted a related question here: Zonal statistics to get majority pixel value per polygon in R? , but this time I want to determine the pixel-class with the highest share on the weights in...

View Article


How to calculate a (co-)occurrence matrix from a data frame with several...

I'm a rookie in R and currently working with collaboration data in the form of an edge list with 32 columns and around 200.000 rows. I want to create a (co-)occurrence matrix based on the interaction...

View Article


Image may be NSFW.
Clik here to view.

Plot time series with years in different columns

I have the following data frame dt(head,6):I need to create a graph in which I have the years (2015, 2016, 2017, 2018, 2019) on the x-axis , different columns (W15, W16, W17, W18, W19 - each one...

View Article

Frequency table with second variable as "analytic weight" in R

I'd like to create a frequency table in R that takes another variable in consideration as weight. To be more precise, as an "analytic weight", such as in Stata. According to the help files...

View Article

Convert from long to wide format with multiple unique variables to other...

I am trying to convert from long to wide format but multiple columns denote the unique rows. In the example below, the block, density, species columns denote the unique individuals. Every individual...

View Article

Select rows by column value based on range of values in another column in R

I have a dataframe similar to this:x <- data.frame("A" = c(11:24), "B" = c(25,25,25,25,25,37,37,16,16,16,16,16,42,42), "C" = c(1:3,1:2,1:2,1:3,1:2,1:2)) A B C 11 25 1 12 25 2 13 25 3 14 25 1 15 25 2...

View Article


Why does a question mark in a dataframe column title show as a period when...

Suppose I use the xlsx package to write a dataframe from r to excel. And suppose I have a dataframe with a column title that includes a question mark (code below): library(xlsx) rm(list = ls()) fpath...

View Article

Image may be NSFW.
Clik here to view.

How to find totals of different categories in same dataset?

I'm a student doing exploratory analysis/data vis with this hate crime data set. I am trying to create a matrix of the different categories (i.e. race, religion, etc.) within from my dataset...

View Article


Image may be NSFW.
Clik here to view.

R shiny: Add weblink to actionButton

I have a box in my shiny application that has a button included within a shiny dashboard box like this:shiny::fluidRow( shinydashboard::box(title = "Intro Page", "Some description...",...

View Article

Bookdown: Chapter/Section cross referencing not working (gitbook)

I was having trouble with one of my bookdown projects where the chapter/section cross-references were no longer working in the html output. The problem is the html links work but they are displayed as...

View Article


Trying to correct values using mutate case_when and it's not changing any...

I have 4 csv files representing 4 different nests. I'm trying to combine them all into one spreadsheet. I have a few errors that were made when inputting data and I am trying to change them in R. For...

View Article

How can I increase the number of iterations of an afex::mixed test when the...

I am using R. A GLMM that I am performing using lme4 that requires me to increase the number of iterations of a given model for it to converge. (see below)Eavers <-glmer(Total.Aversive ~...

View Article

RSelenium concurrent users for multiple scenarios on Shiny

I am trying to do a charge test with RSelenium on my deployed Shiny application. Several users connect to the adress and do random tasks at the same time.I have searched doParallel but the number of...

View Article
Browsing all 206180 articles
Browse latest View live


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