Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8449787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:48:19+00:00 2026-06-10T10:48:19+00:00

I am trying to find out how often a specific user has tweeted to/mentioned

  • 0

I am trying to find out how often a specific user has tweeted to/mentioned another user. Through the twitteR-package I can retrieve the tweets for a given user, however if a tweet mentions several users only the first is mentioned in the replyToUID-field. So the first column of my data frame contains the tweets as for example:

“@user1 @user2 have you read what @user3 wrote?”

and I would like to extract the usernames to a list like this

  • user1
  • user2
  • user3

with users from the next tweet being added below. If someone knows how to do (the extraction, I can deal with loops) it or point me in the right direction it would be much apprechiated.

Optionally, for the real helpful, if you have an idea how to compound the list that in the end (after n tweets have been processed), instead of

  • user1
  • user2
  • user3
  • user1
  • user3
  • user4

the list (or then table) reads like this (counting how often a certain user has been mentioned)

  • user1, 2
  • user2, 1
  • user3, 2
  • user4, 1

it would be even more apprechiated.

Thank you,
Elias

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:48:20+00:00Added an answer on June 10, 2026 at 10:48 am

    I’m not sure what the rules are for a valid twitter user name, but assuming only alphanumeric characters are allowed, you can do it with a simple regular expression:

    x <- "@user1 @user2 have you read what @user3 wrote?"
    
    users <- function(x){
      xx <- strsplit(x, " ")
      lapply(xx, function(xx)xx[grepl("@[[:alnum:]]", xx)])
    }
    
    users(x)
    [[1]]
    [1] "@user1" "@user2" "@user3"
    

    In addition, this solution also assumes that all words are split with spaces, i.e. it won’t work for user names followed by punctuation marks. You’ll have to extend this answer to cope with that scenario.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to find out what permissions user '_www' has on my OS X server.
I'm trying find out where/when exactly request.user becomes an AnonymousUser. I've been searching through
Trying to find out how can we attach a component to a deployed application
Trying to find out if it's possible to use SQLAlchemy on Heroku. Thanks.
I trying to find out the visibility of the Excel and do some activities
I am trying to find out how to write an SQL statement that will
i m trying to find out how to convert timestamp date and time (
I am trying to find out a way to set a time tag to
I am trying to find out if an instance of an application (not vb.net)
I'm trying to find out how to change the icon of a JStree node

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.