Q3 - To Run A Basic Word Count MapReduce
Q3 - To Run A Basic Word Count MapReduce
computing framework like Apache Hadoop. However, since you're asking for a basic
example, I'll provide a simple Word Count program in R, which won't be distributed
but will give you an idea of how the MapReduce paradigm works.
Firstly, you need to have R installed on your system. If you haven't installed it,
you can download and install it from the official R website: [R
Project](https://www.r-project.org/).
```R
# Word Count MapReduce program in R
# Map step
mapped_data <- unlist(lapply(text, map))
# Reduce step
result <- tapply(mapped_data, names(mapped_data), reduce)
This is a basic example, and it assumes you have a file named `input.txt` in the
same directory with the text you want to analyze.
The word count result will be printed, and an output file (`output.txt`) will be
created with the word count information.
Please note that this example is for educational purposes and doesn't leverage the
parallel processing capabilities of a true MapReduce system. In a real distributed
environment, such as Apache Hadoop, the Map and Reduce steps would be executed
across multiple nodes to handle large-scale data.