How to generate a grouped bar chart with 2 categorical variables
I would like to generate a bar chart similar to the one shown below. I would like to use rhoas x-axis and power as y-axis. And I have 2 categorical variables m and c. How can I generate a grouped bar...
View ArticleHow to demonstrate the power of dplyr's join verbs?
I've been wanting to demonstrate to a friend the elegance and speed of using dplyr's join verbs (e.g. inner_join()) over base R and simple subsetting. Took a big DB (from the nycflights13 package),...
View ArticleMaking a ternary plot
I want to plot the projection of 3-dimensional data on their simplex using ggplot2. I thought I could manage the transformation on cartesian coordinates using coord_trans(), but do not know how to do...
View ArticleTable of classification accuracy in shiny
I'm trying to display a table in shiny that shows the accuracy of classifications for each group. Currently I can only manage to make it display the total count per group. Ideally, I'd like it to do...
View ArticleHow can I make a sentences that report values from each row in R?
Forgive me it's been a while. I'm writing a report and I want to generate sentences from this tree data "fill-in-the-blanks" style.Here's some data for example:species <- c("sugar maple","red...
View ArticleHow to get a dataframe using an Rsocrata API? [closed]
Using the Rsocrata package, I read data into a dataframe that shows the 2018 traffic accidents in and around Nashville, TN. I am trying to have my dataframe (traffic_df) return #of accidents,...
View ArticleOfficer package - Error in absolute_path(target)
Within my function, if I run each line manually I can save normally in docx through the office package. However, when rotating the function the following error appears:Error in absolute_path(target) :...
View ArticleR increment by 1 for every change in value column and restart the counter
I would like to find a way to do very similar to this question. Increment by 1 for every change in columnBut i want to restart the counter when var1 = c using df$var2 <-...
View Articler raster Can I combine two raster bricks directly?
I want to combine two (or more) raster bricks. Here's an example of what I want to dolibrary(raster) r <- raster(ncol=40, nrow=20) r[] <- rnorm(n=ncell(r)) b1 <- brick(x=c(r, r*2, r)) b2 <-...
View ArticleHow to turn the color scale in Plotly r to log scale
I am trying to have a logarithmic scale for the color bar in R, any ideas on how I can do it?My code: TEST_DATAFRAME = read.table(TEST_FILE, sep="\t",skip=2, header=T) PROD_DATAFRAME =...
View ArticleCan formattable in R group a table by a variable?
Is it possible to produce a table using formattable which is grouped by one of the variables in the dataframe? The table could either be divided/split/grouped into separate tables printed consecutively...
View ArticleHow to fill geometric figures created by lines and curves?
I'm trying to fill with different colors the 3 triangles in the following graph. data = data.frame(x=c(125), y=c(220)) #this data is just to be able to use gplot to draw figures ggplot(data, aes(x = x,...
View ArticleDouble Integral implementation in R
I've working on double integrals using mosaicCalc package in R. I'm having trouble getting the correct result of the second double integral.This is the code of the first double integral which yields to...
View ArticleIs it possible to write parquet files to local storage from h2o on hadoop?
I'm working with h2o (latest version 3.26.0.10) on a Hadoop cluster. I've read in a parquet file from HDFS and have performed some manipulation on it, built a model, etc. I've stored some important...
View ArticleHow to take an Average of + or - SD
I have data where the [1] dependent variable is taken from a controlled and independent variable [2] then independent variable. The mean and SD are taken from [1]. (a) and this is the result of SD:...
View ArticleHow to make high smooth, high resolution particle motion animations
For some time I have been having trouble with producing short movies/animations/gifs which are of sufficiently high resolution. I'm going to use R to generate some frames as a random example, but if...
View Articledplyr sample_n by group with unique size argument per group
I am trying to draw a stratified sample from a data set for which a variable exists that indicates how large the sample size per group should be. library(dplyr) # example data df <- data.frame(id =...
View ArticleSetting up a model using R2jags
I'm working on a project for an introductory Bayesian analysis course and I'm also fairly new to using R regularly. We are supposed to build a hierarchical model using a data set we found or put...
View ArticleHow to prevent Machine Learning Services (R) on SQL Server taking up high...
I have had Machine Learning Service installed on SQL Server to be able to run R scripts (called from Stored Procedures).There are now several of these Stored Procedures as part of a script to populate...
View Article"Spread" na.locf data for irregular time data
I have data like the following:data <- tibble(time = c(ymd_hms("2019-11-01 09:33:00"), ymd_hms("2019-11-01 09:35:00"), ymd_hms("2019-11-01 09:40:00"), ymd_hms("2019-11-01 09:52:00")), data = c(1250,...
View Article