I want to extract the name from the following input, which has the form as shown in brackets
# Example of the input in brackets('name":"Tale") name<- c('name":"Tale"','name":"List"')
I want to extract the names between quotation marks as shown below. Any suggestions?
name Tale List
Convert the vector to a single column data.frame, and then just use gsubto remove name":and "from the row.
data.frame
gsub
name":
"
Example:
transform(data.frame(name), name = gsub("name\":|\"", "", name)) ## name ## 1 Tale ## 2 List
We could use stri_extract_last_words
stri_extract_last_words
library(stringi) library(data.table) setDT(list(name=stri_extract_last_words(name)))[] # name #1: Tale #2: List
Source: https://habr.com/ru/post/1617539/More articles:How to get multiple processes to read the same documents - mongodbMYSQL trigger that externally runs a PHP script - phpContinuing the Cron job - phpdplyr frame_data errors with "Columns are not the same" - rПоведение команды Bad 'ls' в пользовательской простой оболочке - cHow to get the type of array elements? - arraysAlt attribute for ASCII art in HTML? - htmlPython - paste to list - pythonReact / Redux: mapStateToProps does not display state in requisites - javascriptInsert a new record if it does not exist and is not updated if it exists, laravel eloquent - laravelAll Articles