getwd()
## [1] "D:/Girish Personal/R Analytics/Learning/Learning"
dir(path = "D:/Girish Personal/R Analytics/Learning/")
## [1] "BigDiamonds.csv" "BigDiamonds.csv.zip" "Learning"
list.files("D:/Girish Personal/R Analytics/Learning/",pattern = "csv")
## [1] "BigDiamonds.csv" "BigDiamonds.csv.zip"
mufirstfile=read.csv("D:/Girish Personal/R Analytics/Learning/BigDiamonds.csv")
memory.size()
## [1] 124.61
object.size(mufirstfile)
## 59873760 bytes
#install.packages("data.table")
library(data.table)
newfile=fread("D:/Girish Personal/R Analytics/Learning/BigDiamonds.csv")
##
Read 30.1% of 598024 rows
Read 50.2% of 598024 rows
Read 70.2% of 598024 rows
Read 90.3% of 598024 rows
Read 598024 rows and 13 (of 13) columns from 0.049 GB file in 00:00:06
str(mufirstfile)
## 'data.frame': 598024 obs. of 13 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ carat : num 0.25 0.23 0.34 0.21 0.31 0.2 0.2 0.22 0.23 0.2 ...
## $ cut : Factor w/ 3 levels "Good","Ideal",..: 3 1 1 3 3 1 1 3 3 1 ...
## $ color : Factor w/ 9 levels "D","E","F","G",..: 8 4 7 1 8 4 4 1 8 3 ...
## $ clarity : Factor w/ 9 levels "I1","I2","IF",..: 1 1 2 1 1 5 5 1 5 4 ...
## $ table : num 59 61 58 60 59 60 63 61 57.5 65 ...
## $ depth : num 63.7 58.1 58.7 60.6 62.2 64.4 62.6 59.2 63.6 54.9 ...
## $ cert : Factor w/ 9 levels "AGS","EGL","EGL Intl.",..: 6 6 6 6 2 6 6 6 8 6 ...
## $ measurements: Factor w/ 241453 levels ""," 3.99 x 3.95 x 2.44",..: 19960 21917 48457 15701 37341 14661 14400 19642 17115 16177 ...
## $ price : int NA NA NA NA NA NA NA NA NA NA ...
## $ x : num 3.96 4 4.56 3.8 4.35 3.74 3.72 3.95 3.87 3.83 ...
## $ y : num 3.95 4.05 4.53 3.82 4.26 3.67 3.65 3.97 3.9 4 ...
## $ z : num 2.52 2.3 2.67 2.31 2.68 2.38 2.31 2.34 2.47 2.14 ...
tables()
## NAME NROW NCOL MB
## [1,] newfile 598,024 13 75
## COLS
## [1,] V1,carat,cut,color,clarity,table,depth,cert,measurements,price,x,y,z
## KEY
## [1,]
## Total: 75MB
object.size(newfile)
## 78044224 bytes