?read.fwf may be a good bet for this circumstance.
Set the file path:
temp <- "\pathto\file.txt"
Then set the width of the variables in the file as shown below.
Then specify the column names.
cols <- c("X","Y")
Finally, import the data into a new variable in your session:
dataset <- read.fwf(temp,widths,header=FALSE,col.names=cols)
source share