How to select rows in a range from dataframe?

0 votes
How to select rows in a range from dataframe?
Aug 29, 2019 in Data Analytics by ratna
3,684 views

1 answer to this question.

0 votes

Hi,

There are different functions to select or extract rows from the data frame using dplyr functions.

1. Filter( )

filter(condition1, . . .)

2. Sample_frac( ) - returns fraction part from the dataframe.

sample_frac(table,fraction,replace = TRUE)

3. sample_n( ) - returns n rows from dataframe.

sample_n(table,n,replace = TRUE)

4. slice( ) - select range of rows using position.

slicer(tbl,m:n)

5. top_n( ) -  returns top n rows.

top_n(tbl,n)
answered Aug 30, 2019 by anonymous
• 32,490 points

Related Questions In Data Analytics

0 votes
7 answers
0 votes
1 answer

How to sample n random rows per group in a dataframe?

You can assign a random ID to ...READ MORE

answered Jul 2, 2018 in Data Analytics by Sahiti
• 6,320 points
1,959 views
+1 vote
2 answers
0 votes
1 answer

How to extract specific columns from a dataframe in R?

Hi@akhtar, You can use the select method to ...READ MORE

answered Aug 7 in Data Analytics by MD
• 56,020 points
79 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
834 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
418 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 9 by Gitika 177 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,720 points
270 views
0 votes
2 answers

How to remove rows with missing values (NAs) in a data frame?

Hi, The below code returns rows without ...READ MORE

answered Aug 20, 2019 in Data Analytics by anonymous
• 32,490 points
11,327 views
0 votes
4 answers

How to remove NA values from a Vector in R?

You can try na.omit() or na.exclude() too. ...READ MORE

answered Jul 31, 2019 in Data Analytics by anonymous
• 32,490 points
48,027 views