unique length of combinations

0 votes
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
24 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
• 67,140 points

Related Questions In Data Analytics

0 votes
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,700 points
47 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,100 points
34 views
0 votes
1 answer

Counting the frequency of unique values - R

table() function will help you out in ...READ MORE

answered May 18, 2018 in Data Analytics by Bharani
• 4,550 points
2,357 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,550 points
78 views
+1 vote
1 answer

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

You have missed out on "na.rm=TRUE" inside ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,550 points
48 views
+1 vote
1 answer

Finding number of missing values and removing those missing values from a data-frame

This code gives the total number of ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,550 points
27 views
0 votes
1 answer

Building Random Forest on a data-set comprising of missing(NA) values

You have two options, either impute the ...READ MORE

answered Apr 2, 2018 in Data Analytics by Bharani
• 4,550 points
96 views
0 votes
1 answer

With the help of tidyverse: how to rename a column to a variable name

With the help of Dplyr: rename function ...READ MORE

answered Apr 3, 2018 in Data Analytics by DeepCoder786
• 1,700 points

edited Apr 3, 2018 by DeepCoder786 31 views
+1 vote
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
• 56,160 points
2,705 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
• 37,420 points
960 views