Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find function 'fread' in R 3.4 while reading a big dataset

Tags:

r

rstudio

fread

I have installed package "microbenchmark" and then run: library(microbenchmark).

Now, I am trying to read a csv file, but getting the error: "fread" function not found.

setwd("C:/Data Analytics/R Assignments")
library(microbenchmark)
data <- fread("BigDiamonds.csv") 

Error in
fread("BigDiamonds.csv") : could not find function "fread"

I have been using R 3.4. Could that be the issue?

like image 224
Ranjan Kumar Avatar asked May 29 '17 03:05

Ranjan Kumar


People also ask

Which package is fread in?

The data. table package comes with a function called fread which is a very efficient and speedy function for reading data from files. It is similar to read. table but faster and more convenient.

Can fread read CSV?

The benefit of reading the csv file with fread function is that there will be a variable added to the original csv file which contains the id as integers starting from 1 to the length of column values.

What does fread do in C?

C Programming/stdio. h/fread fread is a function that reads buffered binary input from a file. It is included from the stdio. h header file in the standard C library. The fread function copies nmemb items of data of size size from the named input stream into an array pointed to by ptr .


1 Answers

Try this. It worked for me

install.packages("data.table")
library("data.table")
data <- fread("BigDiamonds.csv")
like image 198
Himanshu Poddar Avatar answered Sep 17 '22 11:09

Himanshu Poddar