Question
Need assistance solving computer problem.

Create File (inventory.csv) Snickers,8 Milkyway,5 Reeses,3 Butterfinger,4 Create File (prices.csv): Snickers,1.35 Milkyway,2.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the code in R language that will read two csv files and multiply their values to give the result. Pls. follow the comments to understand the code.

R Code-

# Reading csv files
inventory <- read.csv("inventory.csv", header = FALSE)
prices <- read.csv("prices.csv", header = FALSE)
inventory # displaying the values
prices
# Copying the value of the first data frame (inventory) to the new variable total
total <- inventory
# Multiplying the values V2 of total and prices
total$V2 <- total$V2 * as.numeric(as.character(prices$V2))
total

Code screenshot-

# Reading csv files inventory <-read.csv (inventory.csv, header = FALSE) prices <-read.csv(prices.csv, header = FALSE)

Output-

V1 V2 1 Snickers 10.8 Milkway 10.0 Reeses 4.5 4 Butterfinger 12.6 2

Add a comment
Know the answer?
Add Answer to:
Need assistance solving computer problem. Create File (inventory.csv) Snickers,8 Milkyway,5 Reeses,3 Butterfinger,4 Create File (prices.csv): Snickers,1.35...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT