Rank computation considering time stamp in grouped data
In my dataset, I have observations for several game players for several points in time. For each observation, I want to compute a rank for this user based on the number of points compared to the number...
View ArticleHow do I fix a summarise function in dplyr package error?
I have some problems summarise function in "dplyr" package. This is the code. library("dplyr")a <- read.csv("Number of subway passengers.csv",header = T, stringsAsFactor = F)a <-...
View ArticleR - group data in dataframe by two columns and rearrange into new dataframe
I have a dataframe foo: A B C1 x m 22 x n 33 x o 114 y m 55 y o 8Edit: thanks to @akrun for reminding me, I add the code to produce this df:foo <- structure(list(A = c("x", "x", "x", "y", "y"), B =...
View ArticleUsing values from slider in javascript DataTables calculations
I've got a nested DataTable in my shiny app that is made from the data below. There are two sliders that I have which make up a percentage of 100. If one slider is 50 the other sider is 50. These two...
View ArticleR: possible truncation of >= 4GB file
I have a 370MB zip file and the content is a 4.2GB csv file.I did:unzip("year2015.zip", exdir = "csv_folder")And I got this message:1: In unzip("year2015.zip", exdir = "csv_folder") : possible...
View ArticleColored Points Disappearing When Creating an Animation in R using Plotly
I'm trying to create an animation in R using plotly where a point can change colors based on its state at the current time. Each point can transition from one phase to another at any time, and I think...
View ArticleIncrease end argument in str_sub up until we get unique values in dataframe
Here is my toy datadf <- tibble::tribble( ~names,"apple alpha","grapes beta","orange gamma",'graphite alpha',"a bc","apple gamma")Here a sample code:df_1 <- df %>% mutate(first_word =...
View ArticleHow to pivot_long pairs of date-var combinations with non-matching dates?
Here is my toy data. df <- tibble::tribble( ~date1, ~A Equity, ~date2, ~B Equity, ~date3, ~C Equity,"1/29/2016", 35, "10/31/2017", 67, NA_character_, NA_real_,"2/29/2016", 40, "11/30/2017", 31,...
View ArticleExporting Caret Resamples Results Summary to dataframe/csv
I have run several train objects and collected the resampling results via the resamples() function in caret. However, I would like to export those results to a data frame or ideally to a csv directly....
View ArticleR Error message "Error in open.connection(con, "rb") : HTTP error 404"
I am using the package parlitools in R. This basically downloads UK election data so you can plot on a Map. I have a lot of code that does not now work as it can't download the data. The error message...
View Articlehow can I translate c# binary files reading into R?
I have to translate a project from c# to R. In this c# project i have to handle binary files.I have three problems:1.I am having some issues to convert this code://c# //this work fineusing...
View ArticleCreate in R a dataframe column that indicates how many times each row value...
I am using R to draw a random sample of 24 elements (species) out of a vector containing 36 elements. As I have to repeat this process several times, I would like to create a data frame in which the...
View ArticleProblem installing packages in R "unable to create temporary directory"
I am having problems installing packages in Rstudio, I tried to install "nortest" among others and it keeps saying the following error:> install.packages("nortest")Installing package into...
View ArticleHow do I incorporate SE in place of SD in my bar chart error bars? Also, how...
I have created a bar chart displaying proportion of time spent on different behaviours for groups of lemurs. However I am placed with two problems. 1) I had hoped to use standard error bars in place of...
View ArticleAdd Table Caption to RHandsontable in R
I have the following dataframe in R library(rhandsontable) library(data.table) ###LIBRARIES IMPORTEDWe next create the dataset DF = data.frame(val = 1:10, big = LETTERS[1:10], small = letters[1:10],...
View ArticleReorganize data frame elements depending on the content of the rows in R
I have this dataset:df <- structure(list(V1 = c("B1D01", "B1D01", "B1D01", "B1D01", "B1D01", "B1D01", "U0155"), V2 = c("U0155", "U0155", "U0155", "U0155", "U0155", "U0155", "U3003"), V3 = c("U3003",...
View ArticleHow to identify subnetworks in adjacency matrix in R?
Assume I have a network graph "G" based on the following edges:edges <- data.frame( from=c(1,1,4,4,4,5,5,6), to= c(2,3,5,6,7,6,7,7))G <- graph_from_data_frame(d=edges, directed=F) This example...
View ArticleProblems storing reactives in shiny R session$userData / scoping issue?
I am trying to assign a reactive value inside a module. I have two use cases and one seems to work "mod1" and the other "mod2" is not workinglibrary(shiny)mod1UI = function(id){ ns = NS(id)...
View Articleheatmaply: ajust the colour
I am using heatmaply to visualise single cell expression data.I want to use custom colours and to assign "yellow" to expression levels > 2 , "magenta" to expression levels < -2. The range between...
View ArticleR 3.5.2: Pipe inside custom function - object 'column' not found
I am having issues with pipes inside a custom function. Based on the previous posts, I understand that a pipe inside a function creates another level(?) which results in the error I'm getting (see...
View Article