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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:48:20+00:00 2026-06-11T05:48:20+00:00

This is admittedly a very simple question that I just can’t find an answer

  • 0

This is admittedly a very simple question that I just can’t find an answer to.

In R, I have a file that has 2 columns: 1 of categorical data names, and the second a count column (count for each of the categories). With a small dataset, I would use ‘reshape’ and the function ‘untable’ to make 1 column and do analysis that way. The question is, how to handle this with a large data set?

In this case, my data is humungous and that just isn’t going to work.

My question is, how do I tell R to use something like the following as distribution data:

Cat Count
A   5
B   7
C   1

That is, I give it a histogram as an input and have R figure out that it means there are 5 of A, 7 of B and 1 of C when calculating other information about the data.

The desired input rather than output would be for R to understand that the data would be the same as follows,

A
A
A
A
A
B
B
B
B
B
B
B
C

In reasonable size data, I can do this on my own, but what do you do when the data is very large?

Edit

The total sum of all the counts is 262,916,849.

In terms of what it would be used for:

This is new data, trying to understand the correlation between this new data and other pieces of data. Need to work on linear regressions and mixed models.

  • 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-11T05:48:22+00:00Added an answer on June 11, 2026 at 5:48 am

    I think what you’re asking is to reshape a data frame of categories and counts into a single vector of observations, where categories are repeated. Here’s one way:

    dat <- data.frame(Cat=LETTERS[1:3],Count=c(5,7,1))
    #  Cat Count
    #1   A     5
    #2   B     7
    #3   C     1
    rep.int(dat$Cat,times=dat$Count)
    # [1] A A A A A B B B B B B B C
    #Levels: A B C
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has been asked, but I can't find more than one
This is admittedly a rather loose question. My current understanding of singletons is that
This should be a simple one: I have an observableArray object called To in
I am very new to apache and django, so execuse me if this question
I'm writing a simple App Engine app. I have a simple page that allows
So this is a really strange problem. I have a Java app that acts
I am going to do my best to explain this, though admittedly I have
I've got (an admittedly strange) try/catch block that checks if a File exists. If
This is very odd I'm reading some (admittedly very large: ~2GB each) binary files
I'm not entirely sure how to post this question, but here goes... I have

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.