mjhendrickson / Learning-R

Project for learning R
MIT License
18 stars 3 forks source link

Error using summarize() after session refresh #7

Closed mjhendrickson closed 6 years ago

mjhendrickson commented 6 years ago

HxMx %>% summarize( mean = mean(start_time_DI, na.rm = TRUE), med = median(start_time_DI, na.rm = TRUE), iqr = IQR(start_time_DI, na.rm = TRUE), mad = mad(start_time_DI, na.rm = TRUE), min = min(start_time_DI, na.rm = TRUE), max = max(start_time_DI, na.rm = TRUE), n = n() )

Results in Error in summarise_impl(.data, dots) : Evaluation error: need numeric data.

mjhendrickson commented 6 years ago

Not an issue upon initial build. Only results in error when starting new session and loading full data file from .csv via: write_csv(HxMx, "HxMx.csv") Restart R / start new session, then HxMx = read.csv("HxMx.csv")

mjhendrickson commented 6 years ago

HxMx = read.csv("HxMx.csv") is bringing data in as a different type than intially imported and created.

mjhendrickson commented 6 years ago

Using readr instead of base import resolves the issue and pulls data into RStudio as expected. Changed HxMx = read.csv("HxMx.csv") to HxMx <- read_csv("HxMx.csv") in 3.Exploratory Data Analysis.R