-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
126 lines (94 loc) · 2.45 KB
/
README.Rmd
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r echo=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# The keywordr SEO package for R
<!-- badges: start -->
<!-- badges: end -->
The *keywordr* package provides an efficient and user-friendly framework for keyword research. The results are typically used to optimize websites for search engines, create content strategy, design information architecture for websites, etc.
## Installation
You can install the development version of keywordr from GitHub with:
```{r eval=FALSE}
# install.packages("devtools")
devtools::install_github("MarekProkop/keywordr", build_vignettes = TRUE)
```
Note: You must have [R version 4.1.0](https://www.r-bloggers.com/2021/05/new-features-in-r-4-1-0/) because the package makes use of the native R pipe and the new syntax for anonymous functions.
## Example
This is a basic example which shows you how to use the package:
### Attache packages
```{r libs, message=FALSE}
library(tidyverse)
library(keywordr)
```
### Create a `kwresearch` object and import queries
```{r init}
input_data <- tribble(
~query, ~volume,
"seo", 96000,
"seo ye-ji", 22000,
"seo meaning", 6700,
"seo services", 6400,
"what is a seo", 5300,
"seo london", 5000,
"what is seo", 4800,
"seo agency", 4300,
)
kwr <- kwresearch(input_data)
```
### Browse imported queries
```{r}
kwr_queries(kwr)
```
### Prune unwanted queries
```{r}
recipe_file <- file.path(tempdir(), "recipes.yml")
kwr_add_pattern("ye-ji", recipe_file, recipe_type = "remove")
kwr <- kwr |>
kwr_prune(recipe_file)
```
### Check pruned queries
```{r}
kwr_queries(kwr)
```
### Explore queries
```{r}
kwr |> kwr_ngrams()
```
### Classify queries
```{r}
kwr_add_pattern(
pattern = "agenc",
recipe_file = recipe_file,
recipe_type = "label",
dim_name = "bussiness_type",
value = "agency"
)
kwr_add_pattern(
pattern = "meaning",
recipe_file = recipe_file,
recipe_type = "label",
dim_name = "info"
)
kwr_add_pattern(
pattern = "what is",
recipe_file = recipe_file,
recipe_type = "label",
dim_name = "info"
)
kwr <- kwr |>
kwr_classify(recipe_file)
```
### Check classified queries
```{r}
kwr_queries(kwr) |>
select(1:5)
```
Please see `vignette("workflow")` for a more detailed example.