Why is R not scanning the data

Viewed 34

I try to scan a data in R. My Code:

scan("D:\\Projekt1\\Lauf.dat",sep=",")

The content of my data:

10.2, 11.4, 10.5, 9.8, 9.9, 9.9, 10.3, 10.8, 10.2, 11.5, 10.0, 11.4, 11.2, 10.1, 10.5, 12.0, 11.4, 10.2, 10.1, 12.1

Expected Output:

[1] 10.2 11.4 10.5 9.8 9.9 9.9 10.3 10.8 10.2 11.5 10.0 11.4 11.2 10.1 10.5

[16] 12.0 11.4 10.2 10.1 12.1

But I got this error:

Warning in file(file, "r") : cannot open file '': Invalid argument

Error in file(file, "r") (main.R#1): cannot open the connection Show stack trace

What did I wrong? I hope you can help me.

BR Marco

1 Answers

Try replacing your code with the following:

setwd("D:\\Projekt1") 
scan("Lauf.dat",sep=",")

edit-1:

setwd("D:/Projekt1") #used forward slash

Related