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

  • Home
  • SEARCH
  • 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 8627595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:19:13+00:00 2026-06-12T08:19:13+00:00

I have a data set that I’d like to organize into a list but

  • 0

I have a data set that I’d like to organize into a list but am unsure of the most efficient way to do so. It’s a list of sales people and products sold:

  rowId       repNum       prodNum
   001         12006        335506883
   002         12008        152348345
   003         12055        993047386
   004         12006        294726636
   005         12069        110847537
   006         12006        335506883
   007         12006        152348345
   ...           ...           ...

I’d like to create a list where each element contains a vector of items that rep has sold, my initial idea was to use tapply but that needs a function to net by. Any other suggestions?

  • 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-12T08:19:14+00:00Added an answer on June 12, 2026 at 8:19 am

    If your data.frame is called dataset,

    split(dataset, dataset$repNum)
    

    will create a list with a component for each repNum


    > split(dataset, dataset$repNum)
    $`12006`
      rowId repNum   prodNum
    1     1  12006 335506883
    4     4  12006 294726636
    6     6  12006 335506883
    7     7  12006 152348345
    
    $`12008`
      rowId repNum   prodNum
    2     2  12008 152348345
    
    $`12055`
      rowId repNum   prodNum
    3     3  12055 993047386
    
    $`12069`
      rowId repNum   prodNum
    5     5  12069 110847537
    

    As pointed out by mrdwab, you can get “vector[s] of items that rep has sold” by splitting the prodNum like this:

    > split(dataset$prodNum, dataset$repNum)
    $`12006`
    [1] 335506883 294726636 335506883 152348345
    
    $`12008`
    [1] 152348345
    
    $`12055`
    [1] 993047386
    
    $`12069`
    [1] 110847537
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very large data set that I'd like to craft into a
I have a data set that that I would like to call in a
I have a set of data that is structured like this: ItemA.GroupA ItemB.GroupA ItemC.GroupB
I have a data set that looks like this: head(data) country fixef 1 as.factor(country.x)Albania
I have a data set that I import into a SQL table every night.
I have a data set that looks like the following. EMPLID PHONE_TYPE PHONE ------
I have a data set that looks like this: This1 GH This2 GH This3
I have a data set that should contain 14 columns, but when I read
I have a data set that looks like the below (the input). IR# CR#
I have a data set that looks something like this: ID | ItemName |

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.