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
56 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,490 points
58 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
4,372 views
+1 vote
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
11,550 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
5,127 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
825 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
415 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 176 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
269 views
+1 vote
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,490 points
405 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,950 points
92 views