Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Using Dplyr /SQLite to perform un-nest values in one column and create multiple rows?

$
0
0

I currently have a Rsqlite db set up on disk with the following table:

id_no | website_link 
1     | google.com msn.com gmail.com 
2     | stackoverflow.com reddit.com 
3     | msn.com 

Two columns are: id_no = gives you id number website_link = gives you the links visited for that id number

Each value within the website_link column is separated by a single tabular space "". I would like to un nest the values to essentially create the following table

id_no | website_link 
1     | google.com
1     | msn.com 
1     | gmail.com
2     | stackoverflow.com
2     | reddit.com
3     | msn.com

The only thing is that I am using dbplyr to communicate with the Rsqlite db i created and so only Dplyr syntax works with the data cleaning (or SQL).

I cannot seem to use the tidytext pacakges unnest_tokens() function which would help me unnest the data to each row. It seems to throw an error when using functions different from dplyr!

Is there a way I can do this in either SQL that would work with SQlite or in Dplyr?


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>