All Questions
49
questions
3
votes
4
answers
141
views
Efficient way to implement rule-based value assignment
I'm trying to come up with an elegant, rule-based way to assign codes to rows in a data frame based on combinations of values in columns, using this data:
library(tidyr)
df <- crossing(yr2018=c(&...
1
vote
1
answer
103
views
apply many expressions to one row of a matrix
I have input data X in the form of a single row of a matrix that is updated several times per second
# fake data
set.seed(123)
X <- matrix(rnorm(1),ncol = 10,nrow = 1)
I have a model in the form ...
0
votes
1
answer
104
views
check boolean expression in dataframe Rcpp (C++)
I have a dataframe dat with data and a vector rule with logical rules
set.seed(124)
ro <- round(runif(n = 30,1,10),2)
dat <- as.data.frame(matrix(data =ro,ncol = 3)) ; colnames(dat) <- paste0(...
0
votes
1
answer
121
views
create a rule in R to count number of consultations per patient per day
I have created the following dataset with key scenarios that I have in my actual dataset:
df <- data.frame (organisation_id = c("1","1","2","2","2"...
0
votes
0
answers
235
views
Can you use references for conditionalFormatting rules in R?
I have a dataframe in R which is comprised of Weeks as the columns and categories in the rows. The last four columns are summary statistics (include 52-week average and 52-week std deviation). Each ...
8
votes
3
answers
434
views
find a sequence of rules in a dataframe, with break rules
I showed how I see the implementation of this algorithm, I divided it into two steps
step one sequence search
step two check break rules
set.seed(123)
dat <- as.data.frame(matrix(sample(10,60,...
4
votes
2
answers
325
views
Match all logic rules with a dataframe (need super fast function)
I have a function that checks for the presence of logical sequences in a dataframe
fu <- function(dat , rule , res.only=T){
debug.vec <- rep("no",nrow(dat)) # control of rule triggers
...
0
votes
2
answers
1k
views
How to create new dataset based on existing dataset
I have the following dataset:
individual sequence_special_drug all_drugs
A NA A
A NA B
A 1 ...
1
vote
1
answer
83
views
sequence design trees (Is there such a package or code)
Here I asked the question of how to search for the triggering of a sequence of rules in the feature matrix
I am wondering if there is a way to find / generate rules like this automatically..
For ...
2
votes
2
answers
134
views
Match all logic rules with a matrix and in the same order
For example, I have a matrix like this
dat <- cbind(1:10,11:20,21:30)
colnames(dat) <- paste0("x",1:ncol(dat))
dat
x1 x2 x3
[1,] 1 11 21
[2,] 2 12 22
[3,] 3 13 23
[4,] 4 ...
1
vote
1
answer
50
views
Match all logic rules with a vector and in the same order
I have a function that takes two vectors
a vector of logical rules pat
a vector of data dat.
The function checks if all the rules have been executed and in the right order
dat <- 1:100
pat <- ...
0
votes
1
answer
379
views
Cleaning Data & Association Rules - R
I am trying to tidy the following dataset (in link) in R and then run an association rules below.
https://www.kaggle.com/fanatiks/shopping-cart
install.packages("dplyr")
library(dplyr)
df <- ...
0
votes
0
answers
263
views
How to use the R implementation of the Apriori or FP-Growth algorithm starting from a CSV file?
I have a CSV file with twelve fields: the first six represent events, the other six actions. For example:
q,w,e, , , ,a,s,d,f, ,
q,t,y,i, , ,s,f,g, , ,
w,r, , , , ,d,f,g,j,k,l
...and so on (I ...
0
votes
1
answer
200
views
How can I compare two apriori rules created from the same dataset in R
I have a dataset and I divided it into 2 datasets RANDOMLY A and B, where A is 70% of the main dataset and B is 30%... Then I applied Apriori algorithm on the both A and B separately, generating its ...
0
votes
1
answer
34
views
Decreasing support threshold for arules in R
I am working on association rules that are considered outliers. I noticed that arules does not show results for rules that have a support less than .10. Is there any way that I could view rules that ...