unique length of combinations

+1 vote
hi i am working with mtcars data , if mpg=21.0 and cyl=4 ,i want to find how many times the same combination repeated int he data set. i want its frequency
Dec 24, 2018 in Data Analytics by anonymous
664 views

2 answers to this question.

0 votes

Hello.

You can use the count method of the plyr package to get the frequency. Example:

install.packages('plyr')
library(plyr)
count(mtcars, mpg)
answered Dec 26, 2018 by Karuna
0 votes

Try this:

sum(mtcars$mpg == 21.0 & mtcars$cyl == 4, na.rm = TRUE)
answered Dec 26, 2018 by Omkar
• 69,220 points

Related Questions In Data Analytics

+1 vote
1 answer

How to convert a list of vectors with various length into a Data.Frame?

We can easily use this command as.data.frame(lapply(d1, "length< ...READ MORE

answered Apr 4, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,661 views
0 votes
1 answer

Find length of string in R

You can try nchar > nchar("fast") [1] 4 > set.seed(10) > ...READ MORE

answered Apr 17, 2018 in Data Analytics by DataKing99
• 8,250 points
1,110 views
+5 votes
3 answers

Counting the frequency of unique values - R

Hi, You can use plyr module. It will give ...READ MORE

answered Dec 14, 2020 in Data Analytics by MD
• 95,460 points
98,476 views
0 votes
1 answer
0 votes
1 answer

Manage length of field values

Hi, Use str_pad() function to format the length ...READ MORE

answered Oct 23, 2019 in Data Analytics by Cherukuri
• 33,030 points
611 views
+1 vote
3 answers

Integration of Google Collaboratory with github

You can use SSH protocol to connect ...READ MORE

answered Aug 7, 2018 in Data Analytics by Kalgi
• 52,350 points
3,156 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
5,890 views
+1 vote
2 answers

Custom Function to replace missing values in a vector with the mean of values

Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
1,937 views
0 votes
1 answer

Show count of unique values for each value in the field in dataframe

Hi, Use below r code. For one field, you ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
2,005 views
+2 votes
3 answers

Problem with installation of Wordcloud in anaconda

Using Anaconda Python 3.6 version For Windows ...READ MORE

answered Aug 7, 2018 in Data Analytics by Priyaj
• 58,020 points
18,689 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