How to code for the sum of imported data set in rstudio

0 votes
so have put this code line in hopping to gain the sum

df <- mutate(df, MAS_UK = (MAS_UK_1+MAS_UK_2+MAS_UK_3+MAS_UK_4+MAS_UK_5+MAS_UK_6+MAS_UK_7+MAS_UK_8+MAS_UK_9+MAS_UK_10+MAS_UK_11+MAS_UK_12+MAS_UK_13+MAS_UK_14+MAS_UK_15+MAS_UK_16+MAS_UK_17+MAS_UK_18+MAS_UK_19+MAS_UK_20+MAS_UK_21+MAS_UK_22+MAS_UK_23)/23)

is this corrects?
Dec 9, 2020 in Data Analytics by Lizzy
• 120 points
646 views

1 answer to this question.

0 votes

@Lizzy,

You can have a look here regarding your query: https://www.edureka.co/community/1210/how-to-sum-a-variable-by-group-in-r

answered Dec 9, 2020 by Gitika
• 65,910 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

How to find out the sum/mean for multiple variables per group in R?

You can use the reshape2 package for ...READ MORE

answered Apr 12, 2018 in Data Analytics by DataKing99
• 8,240 points
3,332 views
0 votes
1 answer

How to set the width of navlistPanel in Shiny? - R

The widths are the widths of the ...READ MORE

answered Jun 13, 2020 in Data Analytics by anonymous
2,095 views
+1 vote
2 answers

How to count the number of elements with the values in a vector?

Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
4,527 views
0 votes
2 answers

How to subset rows containing NA in a chosen column of a data frame?

You can give this a try. subset(dataframe, is.na(dataframe$col2)) ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
9,750 views
0 votes
1 answer

How to forecast season and trend of data using STL and ARIMA in R?

You can use the forecast.stl function for the ...READ MORE

answered May 19, 2018 in Data Analytics by DataKing99
• 8,240 points
1,920 views
0 votes
1 answer

How to get the output of number of elements to reach a cumulative sum?

You can use the sapply function, to loop ...READ MORE

answered May 29, 2018 in Data Analytics by Sahiti
• 6,370 points
539 views
0 votes
1 answer

How to write a custom function which will replace all the missing values in a vector with the mean of values in R?

Consider this vector: a<-c(1,2,3,NA,4,5,NA,NA) Write the function to impute ...READ MORE

answered Jul 4, 2018 in Data Analytics by CodingByHeart77
• 3,740 points
4,190 views
+1 vote
3 answers

How to change the value of a variable using R programming in a data frame?

Try this: df$symbol <- as.character(df$symbol) df$symbol[df$sym ...READ MORE

answered Jan 11, 2019 in Data Analytics by Tyrion anex
• 8,700 points
35,140 views
0 votes
1 answer

How to combine a list of data frames into one data frame?

Use bind_rows() from the dplyr package: bind_rows(list_of_dataframes, .id ...READ MORE

answered Dec 17, 2020 in Data Analytics by Gitika
• 65,910 points
886 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP