Skip to main content
Chemistry LibreTexts

5.2.5: How to Incorporate Data Files in Your Code Blocks- For R

  • Page ID
  • There are a number of ways data files and can be incorporated into code blocks. However, ensure that you have already followed the steps in the introduction to the CKEditor Binder Plugin Tutorial here.

    Method 1: Using read.csv

    the url for the file can be saved to a variable or be added in all at once as shown below.

    x <- read.csv(url(""), sep = '\t', head = FALSE)

    Keep in mind that larger data files will take longer to load.

    Method 2: Using wget or curl through download.file

    Another option to load in a data file is using wget or curl through the download.file function. An example code block is shown below, replace your url with the one in the example. For more information about the download.file function visit this link.

    url <- ""
    z <- tempfile()
    file <- read.csv(z, sep = '\t')