Generating Codebook metadata

Hello,
I have a script with different dataframes, and I want to generate a codebook metadata that can be exported into excel. How is that possible?
I tried with no luck the following command:

write.csv(codebook, "C:Data//codebook.csv)

Any help? Knowing that I just began using R

  1. You're missing a closing quotation mark at the end of the file path.
  2. You need a forward slash between C: and Data
  3. You want only one slash between Data and codebook.csv.

Try this:

write.csv(codebook, "C:/Data/codebook.csv")

It still doesn't work, I get this error

Error in is.data.frame(x) : object 'codebook' not found

Is there any package to download, any command to define what codebook is?
Thanks in advance

Hi Nadine, and welcome!

You may want to start with this tutorial for the codebook package

https://cran.r-project.org/web/packages/codebook/vignettes/codebook_tutorial.html

Codebooks are not automatically generated, so you will need to use this package to build one.

Once you have built a codebook object, it will show up in your Environment tab in Rstudio.

Hi Nadine,
As nwerth illustrates, path names are tricky.
You will make your path life easier if you use Projects and the
here package.

Details at

Link to how-to

Thank you for your reply,
I did and downloaded the packages . I am able to generate the codebook using Addsin, but can't save it because the buttons (COPY/CSV/EXCEL/PDF/PRINT) do not show

There are no buttons to speak of in the codebook package. If you have created a codebook object (codebook_data) in your environment pane, you can write it to an external file named codebook.xls with

library(rio)
export(codebook_data, "codebook.xls")

or

library(writexl)
write_xlsx(codebook_data, "codebook.xlsx")

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