Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (50.2k points)

I want to scan a data in R. 

My Code:

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

The data is as follows:

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

The output should look like this:

[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? 

1 Answer

0 votes
by (107k points)

You can try to scan using setwd() in R programming, to set your location and then try to scan your code:

setwd("D:\Projekt1") 

scan("Lauf.dat",sep=",")

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...