0

Those who have done R kindly help me complete this project

You need to create a function that takes two parameters and returns the sum of all numbers between the two parameters inclusive. The given code takes two numbers from input and passes them to a function called rangeSum(). Task Define the rangeSum() function, so that the code works as expected. Sample Input 4 9 Sample Output [1] 39 Explanation For the inputs 4 and 9, the returned value should be 39.

25th Feb 2023, 3:15 AM
PHILEMON MAKUBO NYAMAGAINI
PHILEMON MAKUBO NYAMAGAINI - avatar
2 odpowiedzi
+ 8
PHILEMON MAKUBO NYAMAGAINI Please kindly show us what you have attempted.. This is an end of module project which is immediately after the 2 quiz .. I would suggest reviewing the material prior to the quiz.
25th Feb 2023, 3:26 AM
BroFar
BroFar - avatar
0
BroFar Justice here is what I tried... rangeSum<-function(a,b){ rangeSum<-0 for(i in a:b){ rangeSum<-rangeSum+i } return(rangeSum) } rangeSum(42,64) but I got only test case 1 correct. the rest are marked wrong I don't know why
15th Mar 2023, 12:46 PM
PHILEMON MAKUBO NYAMAGAINI
PHILEMON MAKUBO NYAMAGAINI - avatar