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
60 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,060 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
264 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,150 points
82 views
0 votes
2 answers

Counting the frequency of unique values - R

Try this, lapply(mtcars,function(x){ length(unique(x))}) READ MORE

answered Aug 20, 2019 in Data Analytics by anonymous
• 32,460 points
14,173 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
• 32,460 points
40 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
• 51,850 points
1,554 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,560 points
1,154 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
171 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
• 32,460 points
281 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
• 57,530 points
6,746 views