The size of the cache outside the environment? If so, why?

DISCLAIMER: I assume that “cache” and “environment” are the right words, although I am new to programming, so I may have misunderstood the terminology.

Recently, I tried to cope with the fast package time for R, and I understand that it has behavior that I do not see in the documentation, and also caused my problems with its work.

TL DR - if I use fast time to convert to POSIXct from a parent to a child, then use it in another way to calculate from an intact parent to a child of 2, a child of two will always have the result of a child of two, even if they should be completely different in the calculation.

Long version -

I have a long list of dates and times as characters to convert to POSIX (see this question )

And an example of a dataset and a working file can be found here .

When I read the sample file, I need to create one DateTime column and then convert it to POSIXct.

First I read:

setwd("~/GitHub/fasttimeError")

example <- fread("datesAndTimes.csv")
# read example file of dates and times

Then I insert:

example[ , DateTime := paste(ConsumptionDate, variable)]
# paste dates with times to make DateTime single column for POSIX conversion

Then I try to convert:

library(fasttime)
# load library for fastPOSIXct

test1 <- example[ , DateTime := fastPOSIXct(x = DateTime)]
# this will read the data as starting in 2006

test2 <- example[ , DateTime := fastPOSIXct(sub('(\\d*)/(\\d*)/(\\d*) (.*)', '\\3-\\1-\\2 \\4', DateTime))]
# this should produce an identical file to test 1

Darn, no process worked correctly. Both of them have been creating a data set since 2006.

But for some reason, if I clean up the entire working environment (in RStudio) and re-run the same code, but SKIP is the line that creates test1, then my tagged object is test2perfectly converted.

Why?

0
source share

All Articles