Get WEEK from the date in R Language [duplicate]
This question already has an answer here:Getting week number from a date format 1 answerI am trying to understand and executing R code. I am new in R and have to run one R script in my system, which is...
View ArticleScaling of horizon chart on R
I have just started to learn R and I have created a horizon chart using R. However, the axes are not appearing properly. Is there any way which I could make the chart bigger and easier to see?This is...
View ArticlePanel data: Adding data by introducing more rows? In R
I have two data.frames both include yearly data on some "ID" -lets say companies. df1 contains data on a national level for example information on the company's age. df2 contains data on state level...
View ArticleFunction, for loop, which, pairtrading
I have a date set (df) with 4 columns: date, price_1, price_2, ratio ratio = price_1/price_2 it has something to do with pairs trading. I need to determine when a position is opened, and closed. A...
View Articleggplot of Time Series Forecast of Daily Data
I have some daily data that look like below: Date Weight 1 2019-09-18 69.4 2 2019-09-19 69.3 3 2019-09-20 69.8 using the package forecast and ggfortifyI was able to get a graph that looks like the...
View ArticleR function for simple lookup replacement of excel
I want to extract the values form file 2 to file matching the values in indicated columns. It is a simple lookup function in Excel. but many solutions given are based on matching column names which I...
View Articleoptimized rolling functions on irregular time series with time-based window
Is there some way to use rollapply (from zoo package or something similar) optimized functions (rollmean, rollmedian etc) to compute rolling functions with a time-based window, instead of one based on...
View ArticleReversing normalized values on a partial dependency plot in R
I am trying to explain my MARS model (for classification). I created a partial dependency plot based on my model:https://imgur.com/39hdHEpAs you can see I have monthly income feature on the x-axis and...
View ArticleProgress_bar with neuralnet
I teach a neural network on a large amount of data ~ 300k lines. How can I follow the process inside neuralnet? I think something with progress_bar (), but I don’t know how to connect it to...
View ArticleR: calculate number of distinct categories in the specified time frame
here's some dummy data: user_id date category 27 2016-01-01 apple 27 2016-01-03 apple 27 2016-01-05 pear 27 2016-01-07 plum 27 2016-01-10 apple 27 2016-01-14 pear 27 2016-01-16 plum 11 2016-01-01 apple...
View ArticleExamples of golem_opts when running app using the golem package
I've been trying to develop more advanced apps using this new golem package in R's Shiny and came across this golem_opts that might be interesting, but still haven't seen no one using it. Can someone...
View Articlemy codewars function is failing tests but unsure why
I'm trying to complete 'Help the bookseller !' on codewars.Here are the details:A bookseller has lots of books classified in 26 categories labeled A, B, ... Z. Each book has a code c of 3, 4, 5 or more...
View ArticleFinding and Filling Missing Observations (Whole Rows not NA Values) with Mean...
I am hoping to get some help identifying:The location of missing observations when no NA values are present (entire row is missing).Create a row for the missing data with mean values based on mean...
View ArticleDetermine positions
I have a date set (df) with 4 columns: date, price_1, price_2, ratio ratio = price_1/price_2 it has something to do with pairs trading. I need to determine when a position is opened, and closed. A...
View Articlemap2 over two lists and create a matrix in a new list
I have two lists, each with 2 observations.I would like to use map2 to create a new list and set up a matrix. What I currently have is the following:library(xgboost) dtrain <- map2( X_list, Y_list ~...
View Articlenote when sending new version of package to cran "checking CRAN incoming...
I am aware that this issue has been answered before, and that I am supposed to ignore that message, however, when I send the package to cran I get an automatic response from Uwe Ligges stating:Dear...
View ArticleMutate function to columns except few cells
I have got a dataset where I need to round of values for few columns at once. I have applied mutate function to do this. But in the columns there are some texts as well that needs to excluded, For...
View ArticleCalculate the number of occurrences of a specific event in the past AND...
this question is a modification of a problem I posted here where I have occurrences of a specific type on different days, but this time they are assigned to multiple users, for example:df =...
View Articlechanging colors of geom_col ggplot2 to show categorical variable at 3 sites
Long time fan of this site, first time user though. Been searching for a similar/working result for this question. I am trying to show the PROPORTION that each level of a 2 level factor appear at three...
View ArticleSeek and replace certain values in R
I know that this has been asked thousand times already but the answers don't work for me. I have a big dataset and need R to automatically seek and replace certain values in certain columns for me.I...
View Article