2016-09-14 4 views
0

Ich möchte in eine SAS-Datendatei (sas7bdat Format) in R lesen. Ich habe versucht, mit sas7bdat Paket, aber endete Fehler bekommen.Importieren Sie SAS-Datendatei in R

Code:

x <- read.sas7bdat("C:\Users\petas\Desktop\airline.sas7bdat") 

ERROR:

'\U' used without hex digits in character string starting ""C:\U"

Kann mir jemand helfen mit diesem? Danke im Voraus. mit

+0

Versuchen Sie mit 'library (port); read_sas (" C: .... ")' – akrun

Antwort

1

Try Slashes:

x <- read.sas7bdat("C:/Users/petas/Desktop/airline.sas7bdat") 
1

Beispiel der Veröffentlichung durch die Verwendung haven Bibliothek

install.packages("haven") 
library(haven) 

url <- "C:\\Users\\petas\\Desktop\\airline.sas7bdat" 

x <- read_sas(url) 

If you use windows than you need to use instead "\" use "\\" or Unix/linux style "/" . Easiest will be to use forward slashes so will be compatible in the future with the path of any OS, in your case Error:'\U' used without hex digits in character string starting ""C:\U" is due the use of single backslashes instead double backslashes.

Hoffe, es hilft.

Verwandte Themen