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 6319113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:44:52+00:00 2026-05-24T15:44:52+00:00

I have a large dataframe (~ 600K rows) with a string-value column (link) doc_id,link

  • 0

I have a large dataframe (~ 600K rows) with a string-value column (link)

doc_id,link
1,http://example.com
1,http://example.com
2,http://test1.net
2,http://test2.net
2,http://test5.net
3,http://test1.net
3,http://example.com
4,http://test5.net

and I would like to count the number of times a certain string value occurs in the frame. The result should look like this:

link, count
http://example.com, 3
http://test1.net, 2
http://test2.net, 1
http://test5.net, 2

Is there an efficient way to do this in R? Converting the frame into a matrix doesn’t work because of the frame size. Currently I am using the plyr package, but this is too slow.

  • 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-05-24T15:44:54+00:00Added an answer on May 24, 2026 at 3:44 pm

    The table function counts occurrences – and it’s very fast compared to ddply. So, something like this perhaps:

    # some sample data
    set.seed(42)
    df <- data.frame(doc_id=1:10, link=sample(letters[1:3], 10, replace=TRUE))
    
    cnt <- as.data.frame(table(df$link))
    # Assign appropriate names (optional)
    names(cnt) <- c("link", "count")
    cnt
    

    Which gives the following output:

      link count
    1    a     2
    2    b     3
    3    c     5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large dataset, over 1.5 million rows, from 600k unique subjects, so
I have a large dataframe with classification information. Here is an example: > d
I have large string which I split by newlines. How can I remove all
I have large MySQL tables with hundreds of thousands of rows. I need to
I have a dataframe like x where the column genes is a factor. I
I have a input dataframe like this (the real one is very large, so
I have a dataframe made up of 400'000 rows and about 50 columns. As
I have large data sets (10 Hz data, so 864k points per 24 Hours)
I have large batches of XHTML files that are manually updated. During the review
I'm developing a website in PHP and I have large JS files that I

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.