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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:28:18+00:00 2026-06-13T22:28:18+00:00

I am creating a survey. There are 31 possible questions, I would like each

  • 0

I am creating a survey. There are 31 possible questions, I would like each respondent to answer a subset of 3. I would like them to be administered in a random order. Participants should not answer the same questions twice

I have created a table matrix with a participant index, and a column for the question indices for the 1st, 2nd and 3rd questions.

Using the code below, index 31 is under-represented in my sample.

I think I am using the sample function incorrectly. I was hoping someone could please help me?

SgPassCode <- data.frame(PassCode=rep(0,10000), QIndex1=rep(0,10000),
  QIndex2=rep(0,10000), QIndex3=rep(0,10000))

set.seed(123)
for (n in 1:10000){
  temp <- sample(31,3,FALSE)
  SgPassCode[n,1] <- n 
  SgPassCode[n,-1] <- temp
}

d <- c(SgPassCode[,2],SgPassCode[,3],SgPassCode[,4])
hist(d)
  • 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-13T22:28:20+00:00Added an answer on June 13, 2026 at 10:28 pm

    The issue is with hist and the way it picks its bins, not sample. Proof is the output of table:

    table(d)
    #    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16 
    # 1003  967  938  958  989  969  988  956  983  990  921 1001  982 1016 1013  959 
    #   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31 
    #  907  918  918  991  931  945  998 1017 1029  980  959  886  947  987  954
    

    If you want hist to “work”, hist(d, breaks = 0:31) (and certainly a lot of other things) will work.

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

Sidebar

Related Questions

I'm creating a survey with 10 questions. All questions have 5 possible answers with
I am creating an online survey tool. As an administrator, i would like to
I am creating a custom Survey package which has questions module , answers module
I am creating a survey form that needs to have each question and set
Creating a browser based single-page browser based RIA. Would like to make use of
I'm creating a survey in which users can upload about 6 pictures. What would
I am creating a survey page that has a list of questions and answers
creating a small web application to be deployed on Heroku, where we would like
I'm creating a survey question that has multiple answers. There is a button to
The situation is as following: I am creating a survey where there are X

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.