0

I have some trouble with a basic opening of file in R. I have a big text file (> 1 GB) that I want to open with RStudio. First I set the file in the working directory and I load the readr package. Then I use the command

my_data <- read_tsv("Geocode.txt")

However that it seems that a bug follows from this command. (I have the "STOP" button in red without any explanation).

Thank you in advance for any help.

Prradep
  • 5,506
  • 5
  • 43
  • 84
user700974
  • 103
  • 1
  • 3
  • Another options is to use `vroom::vroom()` other than `data.table::fread()` mentioned below. Also, I recommend using absolute filepaths instead of relying on your working directory. – Andrew Jan 15 '20 at 15:22

1 Answers1

1

The STOP button indicate that RStudio is running your command, it allows you to stop it in case you are not patient enough or if it is taking too much time.

For heavy files, you should use data.table package and the function fread instead (https://www.rdocumentation.org/packages/data.table/versions/1.12.8/topics/fread):

install.packages("data.table")
library(data.table)
my_data <- fread("Geocode.txt")

As pointed by @Andrew, fread will open your text file as a data.table which is slightly different from dataframe. However, most of command used on dataframe worked also on data.table.

You can learn more on data.table in this post What is the practical difference between data.frame and data.table in R and also here: http://datatable.r-forge.r-project.org/datatable-intro.pdf

dc37
  • 15,840
  • 4
  • 15
  • 32
  • You're right. I have edited y answer. Even if the format of the file will be both data.table and data.frame. – dc37 Jan 15 '20 at 15:26