Challenge 2: Find Mean and Median
Understand how to process numerical data in R by reading inputs from a file, calculating the mean and median values, and exporting these results to an output file. This lesson helps you practice file handling and basic statistical functions essential for data analysis in R.
We'll cover the following...
We'll cover the following...
Problem Statement
Write a code that takes a list of numbers as input from data.txt file, finds the mean and median of those numbers, and outputs them on the output/outData.txt file.
Input
A file data.txt containing a list of numbers.
Output
A file output/outData.txt containing the mean and median of the input numbers.
Sample Input
data.txt
3
8
1
Sample Output
output/outData.txt
4
3
Test Yourself
Write your code in the given area. If you get stuck, you can look at the solution.
Let’s look at the solution review of this challenge in the next lesson.