Can you change R scripting front-end version in command line?
Currently on my system (macOS Catalina) I installed R 3.6.2, and also installed R in anaconda. However, when I ran Rscript --version it says R scripting front-end version 3.5.1 (2018-07-02). I am...
View ArticleMinimising objective function problem using lpsolve in R
I'm tackling a simple linear optimisation problem. I have a bunch of crops with have their associated land requirements per tonne and their water footprints per tonne. I want to know how many tonnes of...
View ArticleHow do I create a geom_bar plot that has numeric variable values but where...
I am trying to create a bar plot but I am having troubles with the fact that my x axis variable (forest tree species) are in the form of numerical codes. That makes it seem as if it is a continuous...
View ArticleHow to create a summation function with data frame in R?
Just for fun, I am trying to create a basic savings calculator. My current code is:value <- function(years,apr,initial,investment) { df <- as.data.frame(matrix(nrow = years, ncol = 2))...
View ArticleCreate a index to create a network graph from dataframe
This is a bit challenging question (I guess), please hold on and read the entire bit, I promise it would be a satisfying result at the end (plus its about office the TV Show)So I have a dataframe like...
View ArticlePackage SBRL in R
I'm trying to use the Scalable Bayesian Rule Lists Model for creating some rule lists in R. I read data into a list, split into train and test and plug into the function with the below code:adult <-...
View ArticleAbout generating matrix of random numbers following Bernoulli distribution...
Assume a probability matrix is A(nxm), then I want to generate a matrix(B) of random numbers of which each follows Bernoulli distribution with corresponding probability in A. That means B[i,j] ~...
View ArticleFB Prophet shifting my history dates by 12 hours
I have an hourly training data set that is from 04/11/16 (00:00 AM) - 10/11/16 (00:00 AM) which shows some value of moisture. I am trying to predict the next 24 hours of data (for an entire day of...
View ArticleRemove columns from dataframe where some of values are NA
I have a dataframe where some of the values are NA. I would like to remove these columns.My data.frame looks like this v1 v2 1 1 NA 2 1 1 3 2 2 4 1 1 5 2 2 6 1 NA I tried to estimate the col mean and...
View ArticleUsing rvest or RSelenium to Scrape Table
The goal: Scrape the table from the following website using R.The website:https://evanalytics.com/mlb/models/teams/advancedWhat has me stuck: I use rvest to automate most of my data gathering process,...
View ArticleConditional matching based on two variables
I have a DF with similar multiple rows and columns. I want to match Name with Name1. If Name does not match Name1, I want to also try to matchName to Name3. Then if it matches, I want the value of...
View ArticleR : count of entries of XXXX post inquiry date of ABC using group,count and...
I am intended to list-out count of all ID's who have inquired post inquiring ABC(where XXXX means other companies). Sample table is given below:ID Company INQUIRY-DATE A15217177635833 XXXX 25-08-2018...
View ArticleR optim, can I pass a list to parameter :par?
Question:I am using optim to optimise my function. However, my function have 2 paramters, first is a scalar, second is a dynamic length vector. I initialized parameters with a list and then pass into...
View ArticleR Finding elements matching with each other within a vector
I have a list of addresses. These addresses were input by various users and hence there are lot of differences in the way a same address is written. For example,"andheri at weh pump house", "andheri...
View Articlecount of entries of XXXX post inquiry date of ABC using group,count and loop...
I am intended to list-out count of all ID's who have inquired post inquiring ABC(where XXXX means other companies). Sample table is given below: ID Company INQUIRY-DATE A15217177635833 XXXX 25-08-2018...
View Articlegganimate with changing scales (axis limits)
I'd like to create a gif using gganimate, but my axis ranges vary wildly in one frame. This is causing all subsequent frames to be squeezed.In ggplot2's facets, there's an option to have scales="free"....
View ArticleSequence date and data frame
I am foresting with ets function from the forecast package.I have daily data from sales for each days in the period from 2015-01-01 until 2015-12-01.Output from this coding is forecast object.This...
View Articledplyr 0.8.1 count throws a strange error message
I ran into an issue with dplyr 0.8.1: It throws this error message when using count() on a character column:error in count(., gender): Argument x must be a vector: list However the usual workaround...
View ArticleR: plotting sky map in Mollweide projection in galactic coordinate system
I need to produce the star map with constellations etc in the Mollweide projection (elliptical projection giving 360 view angle, used in plotting night sky). I found a recipe at...
View Articlehow to obtain morphological features of head_token along with lemma in Udpipe?
I am relatively new to Udpipe-environment. Is there a way to extract morphological features of headtokens and along with KWIC in same dataframe in Udpipe? For instance, I would like to get subjects and...
View Article