Rearrange columns while fetching from datasource

0 votes
Hi, I want to rearrange the columns from the datasource to the last column, so that my new calculation also comes together. How to do this?
Jul 29, 2019 in Data Analytics by anonymous
37 views

1 answer to this question.

0 votes
You cannot reorder the columns like below.

suppose df is a data frame object with 5 columns,

Then reorder columns as

df <- df[, c(5, 4, 1, 2, 3)]
answered Nov 4, 2019 by rajeev

Related Questions In Data Analytics

0 votes
1 answer

How to set data type of columns while reading from source?

@ch, Add colClasses attribute to read the statement ...READ MORE

answered Oct 28, 2019 in Data Analytics by Cherukuri
• 32,460 points
36 views
0 votes
1 answer

How to extract specific columns from a DataFrame ?

Yes there are so many ways: df[,c(V2,V4)] and another ...READ MORE

answered Apr 11, 2018 in Data Analytics by DeepCoder786
• 1,720 points
3,519 views
0 votes
1 answer

How to convert dataframe columns from factors to characters?

To replace all the variables to character ...READ MORE

answered Apr 13, 2018 in Data Analytics by BHARANI
• 410 points
8,176 views
0 votes
1 answer

Extracting numeric columns from a data.frame - R

You can use the select_if() function from ...READ MORE

answered May 4, 2018 in Data Analytics by Bharani
• 4,560 points
4,236 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
516 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
318 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
131 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
201 views
0 votes
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 32,460 points
294 views
0 votes
1 answer

"Error in if" while trying to execute simple code in R

This caused non-logical data or missing values passed ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 51,850 points
68 views