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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:55:48+00:00 2026-06-18T11:55:48+00:00

I have a data frame that looks like this: ‘data.frame’: 1090 obs. of 8

  • 0

I have a data frame that looks like this:

'data.frame':   1090 obs. of  8 variables:
 $ id            : chr  "INC000000209241" "INC000000218488" "INC000000218982" "INC000000225646" ...
 $ service.type  : chr  "Incident" "Incident" "Incident" "Incident" ...
 $ priority      : chr  "Critical" "Critical" "Critical" "Critical" ...

I order the data as follows:

data <- data[order(data$priority),]

I have been changing priority to factors etc but regardless what I try, when I try running the below:

s = strata(data,c("priority"),size=c(0,0,1,5))

I always get the following error:

Error in data.frame(..., check.names = FALSE) : 
  arguments imply differing number of rows: 0, 1

I tried debugging the function to see whether I could tell why this error is raised (but I couldn’t make sense of the code). The error was raised at this stage of executing the strata() function:

debug: r = cbind(r, i)

Thank you very much for all your help!

  • 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-18T11:55:49+00:00Added an answer on June 18, 2026 at 11:55 am

    The problem lies in your trying to set the sample size from some groups equal to zero. Instead, subset your original data before sampling.

    Here, we reproduce your problem.

    library(sampling)
    data(swissmunicipalities)
    length(table(swissmunicipalities$REG)) # We have seven strata
    # [1] 7
    
    # Let's take two from each group
    strata(swissmunicipalities, 
           stratanames = c("REG"), 
           size = rep(2, 7), 
           method="srswor")
    #      REG ID_unit        Prob Stratum
    # 93     4      93 0.011695906       1
    # 145    4     145 0.011695906       1
    # 2574   1    2574 0.003395586       2
    # 2631   1    2631 0.003395586       2
    # 826    3     826 0.006230530       3
    # 1614   3    1614 0.006230530       3
    # 583    2     583 0.002190581       4
    # 1017   2    1017 0.002190581       4
    # 1297   5    1297 0.004246285       5
    # 2535   5    2535 0.004246285       5
    # 342    6     342 0.010752688       6
    # 347    6     347 0.010752688       6
    # 651    7     651 0.008163265       7
    # 2471   7    2471 0.008163265       7
    
    # Let's try to drop the first two groups. Oops...
    strata(swissmunicipalities, 
           stratanames = c("REG"), 
           size = c(0, 0, 2, 2, 2, 2, 2), 
           method="srswor")
    # Error in data.frame(..., check.names = FALSE) : 
    #   arguments imply differing number of rows: 0, 1
    

    Let’s subset and try again.

    swiss2 <- swissmunicipalities[!swissmunicipalities$REG %in% c(1, 2), ]
    table(swiss2$REG)
    strata(swiss2, 
           stratanames = c("REG"), 
           size = c(2, 2, 2, 2, 2), 
           method="srswor")
    #      REG ID_unit        Prob Stratum
    # 58     4      58 0.011695906       1
    # 115    4     115 0.011695906       1
    # 432    3     432 0.006230530       2
    # 986    3     986 0.006230530       2
    # 1007   5    1007 0.004246285       3
    # 1150   5    1150 0.004246285       3
    # 190    6     190 0.010752688       4
    # 497    6     497 0.010752688       4
    # 1049   7    1049 0.008163265       5
    # 1327   7    1327 0.008163265       5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data frame that looks like this: Chr start stop ref alt
I have a data.frame that looks like this: > head(ff.df) .id pio caremgmt prev
I have a data.frame in R that looks like this: score rms template aln_id
I have a data frame in R that looks like this: > TimeOffset, Source,
I have a data.frame that looks like this > head(df) Memory Memory Memory Memory
I'm in a situation like this: I have a data.frame that looks like the
I have a data frame that looks like this: _________________id ________________text______ 1 | 7821
I have a data frame that looks like this: a<-c('a', 'b', 'c', 'd', 'e')
I have a data frame that looks like this: user1,product1,0 user1,product2,2 user1,product3,1 user1,product4,2 user2,product3,0
I have a directed dyadic data frame that looks like this. ccode.a ccode.b year

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.