Load Excel file into RMarkdown

hi, i am doing an exercise for school and i am stuck at this part (photo below). anyhow, i still tried following the link (https://www.datacamp.com/community/tutorials/r-tutorial-read-excel-into-r) and this was the result (photo below). i am aware there is a big gap i have to fill in, may i pls be guided to it? thank you!!

Hi, Purple:

I suggest you to use the import dataset menu. You can click in the upper left menu File > Import Dataset > From Excel and select the file to import it. Then you can copy the code that appears in the R console with the code required for import the data in xlsx and then copy it in a R Markdown code chunk.

Hope it helps.

Greetings.

hi thank you for the reply. I tried the first step "File-Import-From Excel" then a tab appeared asking me to i need to install readxl,so i did. and this was the result (photo below). do i also need to to the step below as mentioned above? just to confirm the date imported matches accurately to the excel data, just want to ask if i did the step correctly and if i need to do the step below mentioned. thank you again!

Hi Purple,

Exactly, if import correctly, you must copy in a code chunk in your R Markdown file the code:

library(readxl)
Babies  <-  read_excel("Desktop/Babies.xlsx")

You're welcome.

Greetings.

thank you for your response. i have followed that step but regret an error occurred on my end. may i pls be guided which step i should redo? pls see photo below. thank you again!

Maybe, are you moved or removed the file Babies.xlsx from Desktop?
You're welcome.
Greetings.

hi thank you for the response, i misplaced the file thanks for the correction. i am trying to get the mean of the weight from the data file and i followed this step from the exercise but an error occurred. i have tried 3 different variations of the file name but still an error occurred. may i pls be guided to it? thank you!

Since you were able to read it in correctly as Babies, you need to make sure the column name is right. The column from the screenshot is WEIGHT, not WEIGHTS.

mean(Babies$WEIGHT)

Sometimes, I like to use the colnames() function and copy and paste the column name to make sure i didn't accidentally misspell it.

colnames(Babies)

Hope this helps!

1 Like

thank you for the response!

i tried the corrected formula and it worked thank you again. to confirm, it is this highlighted box right? thanks.

what i mean is, the answer (mean) appears on that side. after checking from excel, the computed value is accurate. thanks

This is a different question, we like to keep things tidy around here so please ask it on a new topic providing a relevant REPRoducible EXample (reprex) for your issue.

Also, please have a look at our homework policy, homework inspired questions are welcome but they should not include verbatim instructions from your course.

Hi thank you for the response and clarification. Rest assured, my queries are not part of any homework, assessment or requirement which would be graded or submitted. anyhow, i will now close this issue for it is not related to the topic anymore. thank you again!