extract token using R

0 votes
I am trying to extract a token from a file. The problem is that the lines get merged and extracts every word with token as prefix or postfix.
Nov 16, 2018 in Data Analytics by Ali
• 10,400 points
26 views

1 answer to this question.

0 votes

Just add collapse = FALSE in your unnest_tokens:

library(tidytext)
library(dplyr)

jobs %>% 
  unnest_tokens(ngram, POSITION, token = "ngrams", n = 2, collapse = FALSE)
answered Nov 16, 2018 by Maverick
• 10,040 points

Related Questions In Data Analytics

0 votes
1 answer

How to extract every nth element of a vector using R?

m <- 1:50 n<- m[seq(1, length(m), 6)] The above ...READ MORE

answered May 14, 2018 in Data Analytics by zombie
• 3,690 points
4,260 views
0 votes
1 answer

How to change y axis max in time series using R?

The axis limits are being set using ...READ MORE

answered Apr 3, 2018 in Data Analytics by darklord
• 6,140 points
100 views
0 votes
1 answer
0 votes
2 answers

How to use group by for multiple columns in dplyr, using string vector input in R?

data = data.frame(   zzz11def = sample(LETTERS[1:3], 100, replace=TRUE),   zbc123qws1 ...READ MORE

answered Aug 5 in Data Analytics by anonymous
2,810 views
0 votes
1 answer

Why is data cleaning needed?

Data cleaning is the fourth step in ...READ MORE

answered Nov 14, 2018 in Data Analytics by Maverick
• 10,040 points
21 views
0 votes
2 answers

What are the steps in data analysis process?

Well explained @Maverick, In simple words the ...READ MORE

answered Aug 22 in Data Analytics by anonymous
• 25,820 points
67 views
0 votes
2 answers
0 votes
1 answer

Parallel programming In R using GPU

Check out the CRAN Task View on High-Performance ...READ MORE

answered Feb 4 in Data Analytics by Tyrion anex
• 8,270 points
58 views
0 votes
1 answer

Downloading an image using R Programming

Try this: url2 ...READ MORE

answered Nov 2, 2018 in Data Analytics by Maverick
• 10,040 points
28 views
0 votes
1 answer

Cleaning data using R

Try something like this: text1='"id","gender","age","category1","category2","category3","category4","category5","category6","category7","category8","category9","category10" 1,"Male",22,"movies","music","travel","cloths","grocery",,,,, 2,"Male",28,"travel","books","movies",,,,,,, 3,"Female",27,"rent","fuel","grocery","cloths",,,,,, 4,"Female",22,"rent","grocery","travel","movies","cloths",,,,, 5,"Female",22,"rent","online-shopping","utiliy",,,,,,,' d1 <- read.table(text=text1, sep=",", ...READ MORE

answered Nov 13, 2018 in Data Analytics by Maverick
• 10,040 points
30 views