can not knit rmd , error: object (data)not found.

creating an article in rmarkdown. doing text before graphic . Knitting (without graphic)to either pdf or word ,no problem. Inserting plots. running each plot code in the rmarkdown file works fine.
When I try to knit to output I get the message below.
dfpop is a dataframe in global r environment.
Tried "the yellow pages" (other topics here/ stack overflow, Google) without result. Am not a data scientist .
All help appreciated.thank you

dfpop
#> Error in eval(expr, envir, enclos): object 'dfpop' not found

Created on 2021-05-13 by the reprex package (v2.0.0)

How are you bringing dfpop in? I.e. what's your code in the rmarkdown doc for doing that?

Hi,

You need to put the code for import your data in an chunk.

Maybe this post could give you some clues.

Hope it helps.

Greetings.

Hello and thank you for answering.
it's exactly the point I'm not sure how or if I have done that. tried load(file)but the file could not be accessed ?
dfpop is an object I created by assigning a data frame to dfpop ,it´s in the general environment of R.

hello and thank you for answering:
I get:

DFST1
#> Error in eval(expr, envir, enclos): object 'DFST1' not found

Created on 2021-05-13 by the reprex package (v2.0.0)
and this is the code:

 library(readxl)
 DFST1 <- read_excel("~/Documents/Dokument – Pontuss iMac/Projektarbete/XLSX/DFST1.xlsx", 
    range = "B2:AJ101", na = "NA")
 View(DFST1)   
 reprex(DFST1)

DFST1 is the name of the excel
greetings

Perhaps you are using a normal r script to read excel and prepare objects then going to your markdown and expecting those objects to be there to be knittable. That would be an incorrect assumption. Rmd should be self contained. I.e. move your read excel code into the rmarkdown also. You can hide the chunk from being rendered out, but it needs to be there.

1 Like
 library(readxl)
DFST1 <- read_excel("~/Desktop/DFST1.xlsx", 
    range = "B2:AJ101", na = "NA")
View(DFST1)

get the following message:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Quitting from lines 27-31 (Tryout1.Rmd)
Error in View(DFST1) : X11 dataentry cannot be loaded
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> View
Execution halted.
don´t know what I am doing wrong

thank your your comment

Hi,
I'm not completely sure but I think that you get this error because you can't use de View()function inside a R Markdown document. Then, remove the line View(DFST1) from your code.
You're welcome. Hope it helps.
Greetings.

thank you jlugarrancho it did the trick. :smile:
thank you very much everybody.

kind regards

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.