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
• 11,360 points
443 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,840 points

Related Questions In Data Analytics

+1 vote
2 answers
+1 vote
2 answers

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

Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
5,011 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 29, 2018 in Data Analytics by Sahiti
• 6,370 points
786 views
+10 votes
3 answers

Which is a better initiative to learn data science: Python or R?

Well it truly depends on your requirement, If ...READ MORE

answered Aug 9, 2018 in Data Analytics by Abhi
• 3,720 points
1,611 views
+1 vote
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,840 points
4,809 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,840 points
797 views
+1 vote
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,840 points
4,186 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP