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

Image may be NSFW.
Clik here to view.

How to show each year-quarter in x-axis in the time plot generated by ggplot

I want to use ggplot to generate time plot by each year-quarter, but only years are shown on the x-axis. Q1, Q2, Q3,Q4 all missing? How to solve this problem. head(X02_4m_bb)A tibble: 6 x 7Year Quarter...

View Article


R: aggregate data while adding new count column using base R

I would like to aggregate a data frame while also adding in a new column (N) that counts the number of rows per value of the grouping variable, in base R.This is trivial in dplyr:library(dplyr)...

View Article


How to send output to specific location through pipes in R

I am writing a small code where i compare two times and find the difference and display it in HH:MM:SS format. library(magrittr) library(lubridate) s1 <- ymd_hms(Sys.time()) s2 <-...

View Article

Estimate required memory for a process in R

I have a dataframe with around 1.5 million participants and 245 variables. I need to run the following code:data %>% gather(Measure, Result, -Var1, -Var2) %>% group(Var1, Var2, Measure) %>%...

View Article

R - Speeding up loop over array dimensions

I am working with an array with dimensions [1] 290 259 55 4 For each repetition of the last three dimensions, I want to perform a rolling mean on the 290 elements of the first dimension, reducing the...

View Article


How do I show actual dates in a daily time series in R?

I've created a daily time series. Original data:> head(platinum) Date Hong.Kong.8.30 1 2019-12-19 938 2 2019-12-18 929 3 2019-12-17 933 4 2019-12-16 931 5 2019-12-13 947 6 2019-12-12 943 I used the...

View Article

Php mongo client count query not working Mongo 4 version

I have upgrade MongoDB version 4 from 3. the below query is not working in the php mongo client.db.transaction_history.count(array("transaction_type" => "post_create", 'nid' =>...

View Article

In R could not find function "%

I've found an R script online that I cannot run because it uses %<-%. could not find function "%<-%"I've tried to open libraries that have the pipe function (i.e., %>% ) since the script is...

View Article


Unable to install swirl in R with the new update. Version 3.6.2

When I typeinstall.packages("swirl")library(swirl)I get:There is a binary version available but the source version is later: binary source needs_compilation mime 0.7 0.8 TRUE Do you want to install...

View Article


Image may be NSFW.
Clik here to view.

How to make multipanel hyperspectral data plotting in R?

I was trying to plot multipanel average reflectance spectra and their standard deviations using hyperSpec package. But I am not getting the desired results. I am having 10 clusters/groups but plotting...

View Article

R Program explanation

I want to understand this block of code written in R and want to convert this into python.private = list( ..zipcodes = NULL, ..all_cities = NULL, ..city_state = NULL, ..exclude_words = NULL, ..synonyms...

View Article

how to use future_lapply and data.table to read huge folder of csvs in a loop...

I have a folder of 10,000+ csv files stored on my hard drive. Each csv is for a species and gives presence in raster cells (so over 5million cells if the species were present in every cell on earth). I...

View Article

bind lists together giving me incorrect results when using bind_rows,...

I cannot seem to bind my lists together correctly.I have tried:purrr::map(myList, ~dplyr::bind_rows(.)) Error: Argument 1 must have names Which does not work.purrr::map(myList, ~plyr::ldply(.)) Which...

View Article


Only certain plot points responding to row selection in shiny app?

I am attempting to adapt an example (2.1.1) from the tutorial found here on interactive plots in shiny. I have a shiny app as follows: Data: seats = data.table( ID = c("1","2","3","4","5","6"), Row =...

View Article

dplyr:: How to use SE and `%in%` in `filter`?

Considerdf = data.frame(col1 = 1:3, col2 = 2:4) I want to dodf %>% filter(col1 %in% 2:3) which should return the 2nd and 3rd row, but col1 is passed in as a string as variable str_1 = "col1"So I...

View Article


R function for multi-label multi-class imbalance

I am looking for an R function/package to solve an unbalance issue for a multi-label multi-class dataset to be used in a multi-output random forest. An oversample, undersample or synthetic data...

View Article

R Get Sum of Column

I have a simple dataframe in Rdf1 <- data.frame( questionID = c(1,1,3,4,5,5), userID = c(101, 101, 102, 101, 102,101), Value=c(10,20,30,40,50,10)) The basic idea is to have a column that indicates...

View Article


I have 140 renderUI elements to create. Is there a more efficient way?

I have a bit of renderUI code that created numeric input boxes and populates them from a list. it looks like this: output$Small1A <- renderUI({ numericInput("Small1A","",min = 0, max = 100, value =...

View Article

using textInput to define url to scrape from

My goal is an app that scrapes and maps html table data, by date. Each date has its own url with its yyyymmdd suffix,...

View Article

Rename columns using "relational" dataframe in R

I'm dealing with a large dataframe (over 100 columns) and I need to rename the columns. Let's say the dataframe of interest looks like this: C D E F G H 1 10 200 50 40 60 10 2 30 400 20 30 30 10 3 20...

View Article
Browsing all 204742 articles
Browse latest View live