BaşlayınÜcretsiz başlayın

Absolute vs relative

Absolute paths contain too much information on your particular set-up, e.g. your user name. This makes it hard to share code - you are unique after all! The evil that are absolute paths can be defeated using the might of relative paths.

In this exercise, we assume that you are in the directory survival/.

Bu egzersiz, kursun bir parçasıdır

Defensive R Programming

Kursa Göz Atın

Egzersiz talimatları

  • Rewrite the absolute paths - /home/repl/survival/input/ - as relative paths.

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# The load.R file
library("readr")
library("readxl")

# Print the current working directory
getwd()

# Change to relative paths
battles <- read_csv("/home/repl/survival/input/battles.csv")
foes <- read_xlsx("/home/repl/survival/input/foes.xlsx")
Kodu Düzenle ve Çalıştır