Sort Rating Matrix in R
My rating matrix that I make has a lot of N/A values (users rate jokes matrix). I need to sort the matrix where is the user with the most rates is at the start of the matrix and and the user with the...
View ArticleRWordPress knit2wp Unknown SSL protocol error in connection to site.com:443
I am trying to publish a .Rmd file as post on my website which uses WordPress. I get the following error: Error in function (type, msg, asError = TRUE) : Unknown SSL protocol error in connection to...
View ArticleIs there a function to get multiple frequency tables within a table in R
I would like to get multiple frequency tables within a single table. Here is my data:df<-read.table(text=" group score night ticket book gender course A Y 1 0 0 Male M A Y 1 0 0 Female N A N 1 1 1...
View ArticleR lineal model function (lm) doesn't exclude predicted variable from predictors
I have a dataframe where I want to predict all variables from the other variables, so I construct a loop like this one:df = iris df$Species <- NULL mods = list() for (i in 1:ncol(df)) { mods[[i]]...
View Articlecoercing columns of a data frame to numeric
I can't get the following formula to coerce selected columns of a data frame to numericx<-read.csv("more.csv",colClasses="character") test<-list(more[,10],more[,11],more[,12])...
View ArticleTidying financial data with mixed decimal and grouping digits
ContextI need to clean financial data with mixed formats. The data has been punched in manually by different departments, some of them using "." as decimal and "," as grouping digit (e.g. US notation:...
View ArticleAlternative to Sending Automated Emails using RStudio and Windows Task...
I am looking for a better solution to something I am currently doing. We send out hundreds of emails a day using a combination of Windows Task Scheduler and r-scripts and the mailr package. Some issues...
View ArticleBrowser-friendly way of drawing rectangles on top of image R Shiny
I know how to draw rectangles on top of an image in R:library(png) library(RCurl) myurl = 'https://raw.githubusercontent.com/Tixierae/deep_learning_NLP/master/CNN_IMDB/cnn_illustration.png' my_img =...
View ArticleIn R, how can I count the number of variable after argmax?
this below is sample of raw data which I have: sentiment pos neu neg 1 0 0 0.2 0.3 0.5 0.3 0.3 0.4 0 0 1 0.2 0.7 0.1 In this raw data of sentiment, "pos" refers to probability of positivity in comment,...
View Articlespot bid AWS backend for R foreach
I'd like to set up an AWS architecture where I have a memory-optimized instance (say, an X1) running a head node for a dynamically allocated cluster, and then the rest of the cluster is spun on demand...
View ArticleJoin data points on boxplot with lines ggplot2
I'm trying to visualize paired sets of data points on the following graphs:ggplot(grid.mag.ROIcontrols.allRuns, aes(Model,Grid_Magnitude)) + geom_boxplot(aes(fill=Model),outlier.shape = NA,alpha=0.6) +...
View ArticleHow do I get capture.output functionality while capturing ANSI color codes...
What ways are there to capture output à lacapture.output but which will retain the ANSI color encoding which comes out of crayon?> crayon::green("green") [1] "\033[32mgreen\033[39m">...
View ArticleFilter rows based on the column of a CSV file in R
I have a large data frame with around 25 000 entries. The variables in this frame have generic names, from V1 to V8. However, one of these variables, namely V2 in my case (representing a series of ZIP...
View ArticleSpeeding up dplyr pipe including checks with mutate_if and if_else on larger...
I wrote some code to performed oversampling, meaning that I replicate my observations in a data.frame and add noise to the replicates, so they are not exactly the same anymore. I'm quite happy that it...
View ArticleEfficiently counting occurrences of a word list in a column using R
If I have a word list, how do I efficiently count the number of occurrences of these words in a dataset?An example: set.seed(123) df_data <- data.frame( data_strings = sample(c("tom smith", "smith...
View ArticleHow to convert a spatial map to a probability map in R?
I made a spatial map of the UK showing the estimated mean effect of a location variable ID for each city. See the image here (as i haven't enough reputation to post the image on here).But is it...
View ArticleHow to download workbook via downloadHandler on Shiny?
How can we save a workbook in a certain folder and make it available for user to download it ?ref: Shiny + downloadHandler + Openxlsx does not generate a xlsx fileProcedure:Create a data Save as...
View ArticleMutate Next unique values in one hour and expand and aggregate
I am trying to achieve an sliding window aggregation. I tried something using tidyr functions but I am sure there are much better / faster ways to achieve.Let me explain what I want to achieve:I have...
View ArticleFilter the 2nd untill 6th observation each day in R
I have a date set. Per date i have 10 measurements, but i'm only interested in the 2nd untill the 6th each date. How can i fix this?Thx in advance!
View ArticleSplit a single row into multiple rows keeping the delimiter intact
I am trying to split a single row in my data set into multiple rows by keeping the delimiter intact.This is a sample of my input data set...
View Article