-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSortApprox.Rmd
More file actions
69 lines (57 loc) · 1.33 KB
/
SortApprox.Rmd
File metadata and controls
69 lines (57 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
title: "SortingApproximately"
author: "Abid Ali Shaikh"
date: "12/31/2021"
output:
html_document:
code_folding: show
theme:
bg: "#202123"
fg: "#B8BCC2"
primary: "#EA80FC"
base_font:
google: Prompt
heading_font:
google: Proza Libre
version: 3
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{css}
pre code {
font-size: 14px; /* Adjust the font size as desired */
}
```
### Sampling & Re-grouping
```{r grouping by approximate sorting, size=16}
names <- sample(c(
"John", "Jon", "Jhon", "Jonh",
"Michael", "Micheal", "Michel",
"Emily", "Emili", "Emely", "Emiley",
"Sarah", "Sara", "Sera", "Serah",
"Matthew", "Mathew", "Mathhew",
"Jessica", "Jessika", "Jesica", "Jessicah",
"Daniel", "Daniele", "Danial",
"Elizabeth", "Elisabeth", "Elisabet",
"David", "Davi", "Davide",
"Jennifer", "Jennipher", "Jenifer",
"Christopher", "Cristopher", "Christoper",
"Amanda", "Amandah", "Amandaa",
"Andrew", "Andrw", "Andew",
"Stephanie", "Stephany", "Stephaine",
"Joshua", "Josh", "Jshua"
), replace = FALSE)
group <- function(names)
{
val2=NULL
for (i in names)
{
val=agrep(i,names)
val2=c(val2,val)
}
val2=unique(val2)
return(names[val2])
}
group(names)
```