I'm trying to figure out a formula to be able to divide the max and min number inside the intervals.

0 votes

I'm trying to figure out a formula to be able to divide the max and min number inside the intervals.

Nov 16, 2018 in Data Analytics by Ali
• 10,450 points
17 views

1 answer to this question.

0 votes
#One possible solution is to split by (,] (xout is your dataframe)

x1<-strsplit(as.character(xout$factorx),",|\\(|]")
x2<-do.call(rbind,x1)
xout$lower=as.numeric(x2[,2])
xout$higher=as.numeric(x2[,3])
xout$ave<-rowMeans(xout[,c("lower","higher")])

> head(xout,3)
      factorx Freq cumFreq relative higher lower   aver
1 (9.97,13.7]   15      15     0.15   13.7  9.97 11.835
2 (13.7,17.5]   14      29     0.14   17.5 13.70 15.600
3 (17.5,21.2]   12      41     0.12   21.2 17.50 19.350
answered Nov 16, 2018 by Maverick
• 10,040 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

How to count the number of elements with the values in a vector?

You have various options to count the ...READ MORE

answered Apr 12, 2018 in Data Analytics by darklord
• 6,140 points
71 views
0 votes
1 answer
0 votes
1 answer

How to get the output of number of elements to reach a cumulative sum?

You can use the sapply function, to loop ...READ MORE

answered May 28, 2018 in Data Analytics by darklord
• 6,140 points
33 views
0 votes
1 answer

Error saying "vector size cannot be NA" when using R with data mining

You can use the removesparseterm function.  Removes sparse ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
296 views
+1 vote
2 answers
0 votes
1 answer

Trying to find frequent itemsets of a data set using arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", "milk", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
30 views
0 votes
1 answer

Error saying "Error in df$item : object of type 'closure' is not subsettable" when trying to use arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
86 views
0 votes
1 answer
0 votes
1 answer

I'm trying to start rattle on R Studio and end up with an error

You need the package RGtk2 for rattle to ...READ MORE

answered Nov 26, 2018 in Data Analytics by Maverick
• 10,040 points
205 views