R Calculate Combinations & Permutations (Example) | combinat Package | permn, combn, length & ncol

R Calculate Combinations & Permutations (Example) | combinat Package | permn, combn, length & ncol

Statistics Globe

3 года назад

5,578 Просмотров

How to generate and count all possible permutations and combinations of the elements in a vector in the R programming language. More details: https://statisticsglobe.com/calculate-combinations-and-permutations-in-r
R code of this video:

install.packages("combinat")
library("combinat")

permut <- permn(3) # Create list of permutations
permut # Print list of permutations

permut_count <- length(permn(3)) # Count permutations
permut_count # Print count of permutations

commbi <- combinat::combn(3, 2) # Create matrix of combinations
commbi # Print matrix of combinations

commbi_count <- ncol(combinat::combn(3, 2)) # Count combinations
commbi_count # Print count of combinations

Follow me on Social Media:
Facebook: https://www.facebook.com/statisticsglobecom/
LinkedIn: https://www.linkedin.com/company/statisticsglobe/
Patreon: https://www.patreon.com/statisticsglobe
Pinterest: https://www.pinterest.de/JoachimSchork
Reddit: https://www.reddit.com/user/JoachimSchork
Twitter: https://twitter.com/JoachimSchork

Тэги:

#statistics_globe #statisticsglobe.com #statistical_programming #r_programming #statistics #r_programming_language #r_statistics #rstudio #r_language #r_tutorial #learn_r #r_code #r_programming_tutorial #calculate_combinations_and_permutations_in_R #combinat_Package #length() #ncol() #matrix #combn #permn
Ссылки и html тэги не поддерживаются


Комментарии: