where to enter code

hi apologies, after entering the code on R, no error appeared but also no output appeared.


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

![Screen Shot 2021-05-12 at 2.23.54 PM|572x170](upload://ma1nbBhZfSv61PK1vy79NzORSrX.png)

apologies this was the code entered:


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

Then just run soil. That should be your file. But it is strange that it is not running in the RMarkdown file.

is it the same code or another code? thanks.

library(readxl)
soil <- read_excel("Desktop/soil.xlsx") # just reading it in to a new object
soil # running the saved object

That should show your file (if there wasn't an error). Not sure about why it is not running in markdown.

what code did u enter? thanks.

The code from the previous post. Did that work?

i deleted the chunk and wish to start it over again. may i request the specific code you entered? thank you!

I don't have your file, so I haven't entered anything. Not sure about where your error is, but it is probably related to where your file is. It might need something like: "C:/Desktop/soil.xlsx" as "Desktop/soil.xlsx" just assumes that there is a folder (up from where you currently are) that is called Desktop. Better yet, use R projects:

https://r4ds.had.co.nz/workflow-projects.html

In terms of RMarkdown, look at the info on code chunks:

https://rmarkdown.rstudio.com/lesson-3.html

ok will work on this. thank you.

hi, i did trial and error. i removed "Desktop" and just entered "soil.xlsx" and it worked.
thanks again!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.