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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:27:33+00:00 2026-05-27T03:27:33+00:00

I am struggling to find the appropriate function that would return a specified number

  • 0

I am struggling to find the appropriate function that would return a specified number of rows picked up randomly without replacement from a data frame in R language? Can anyone help me out?

  • 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-27T03:27:34+00:00Added an answer on May 27, 2026 at 3:27 am

    First make some data:

    > df = data.frame(matrix(rnorm(20), nrow=10))
    > df
               X1         X2
    1   0.7091409 -1.4061361
    2  -1.1334614 -0.1973846
    3   2.3343391 -0.4385071
    4  -0.9040278 -0.6593677
    5   0.4180331 -1.2592415
    6   0.7572246 -0.5463655
    7  -0.8996483  0.4231117
    8  -1.0356774 -0.1640883
    9  -0.3983045  0.7157506
    10 -0.9060305  2.3234110
    

    Then select some rows at random:

    > df[sample(nrow(df), 3), ]
               X1         X2
    9  -0.3983045  0.7157506
    2  -1.1334614 -0.1973846
    10 -0.9060305  2.3234110
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am struggling to find a working query in SQLite, that will return my
I'm struggling to find a decent walkthrough for this issue, and was hoping that
I am struggling to find a plugin which would allow me to use Java
been struggling to find a way to configure Tomcat 7.0.11 so that my web
I am struggling to find a way to create the Forms functionality that I
I'm struggling to find a Perl GetOptions reference that explains this behavior. If I
I've been struggling to find a framework/IDE/GUI designer that suits my current needs. I'm
I've been struggling to find a nice algorithm to change a number (could be
I'm struggling to find a simple example that builds and deploys a message driven
Im struggling to find good material about developing web applications in Ruby without using

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.