How to upload data to Chunk?

Asked

Viewed 505 times

1

I am venturing into Rmarkdown, I found a very interesting tool. I happen to be in trouble, I think it is basic of beginner, when complicating the Rmarkdown with knitr it gives the unknown object error:

   Quitting from lines 13-16 (doc.Rmd) 
   Error in inherits(x, "list") : objeto 'tab.genova' não encontrado
   Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> kable -> inherits
  Execução interrompida

I researched about, I saw that I had to import my data using the function read.csv() or source which is usually a problem that beginners usually bump into.

I tried these commands and I’m not succeeding, I believe it’s a mistake I’m making and not realizing.

The integrity of the codes present in the Hunks, they are operating normally, because when I give run current chunk the chart and table are plotted normally and without errors.

```{r TabGenova, echo=FALSE}
library(knitr)
kable(tab.genova)

```

1 answer

5


Use the rmarkdown to create a report implies to merge the textual part of the analysis with the codes in R. Therefore, it is necessary to explicitly load each package or file needed to perform the analysis. Therefore, do the following:

  1. Copy the file .csv with your data to the same file directory .Rmd

  2. Inside Rstudio, go to the menu Session > Set Working Directory > To Source File Location

  3. Add the following Chunk to your code, somewhere before the first analysis to be performed:

(text placed because of a bug in the OS)

```{r LeituraDeDados, echo=FALSE}
tab.genova <- read.csv(file="ArquivoComOsDados.csv")
head(tab.genova) # para conferir as seis primeiras linhas e ver se deu certo
```
  1. If the above item command gives problem, you may need to add the argument sep=";" or sep="\t" at the read.csv to tell which is the correct column separator. Discover this by opening ArquivoComOsDados.csv in some text editor.
  • 1

    @Macrus Nunes once again saving the homeland kkk Thank you very much friend, it worked right what you instructed me. That part of the Session I didn’t know, I was doing everything wrong, by the tutorials I realized that this part goes well or did not speak and in my case there I had to add the sep=";" in the read.csv.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.