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 in Data Analytics by anonymous
22 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 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 in Data Analytics by Cherukuri
• 32,260 points
20 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
1,434 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
2,097 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
2,057 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
128 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
184 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
91 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
115 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 in Data Analytics by anonymous
• 32,260 points
168 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
• 46,040 points
43 views