Hi there....
I have tried the hms() and I got the results. I have a few doubts here
1)Did you choose hms() from lubridate?
2)What is "x" here?
The output result in a few rows is like this 80:45:00 and in some other outputs if the original time is 946 the output result was 94:60:00.(working as per the code)..something is wrong here
Are R base and Rstudio the same or are they both different?
The hms() function if from the hms package. You can see that my code starts with library(hms).
x is just the argument of the TimeConvert function that I wrote. Running TimeConvert(DF$schedtime) is the same as running TimeConvert(x = DF$schedtime)
I could have used a more informative name for the argument, like this
I wrote the TimeConvert function using a bad assumption. Here is a better version that uses interger division and the modulo function to calculate the hour and minutes.
TimeConvert <- function(x) {
hms(seconds = rep(0, length(x)),
minutes = x %% 100,
hours = x %/% 100)
}
R and RStudio are separate software. R is the programming language that does the data handling, calculations, plotting, etc. Base R is what you get when you run R without using any additional packages. RStudio is the software that presents the graphical user interface and all the helpers that provide things like the four panes displaying information, autocomplete when you start to type a function, and shortcut keys for inserting certain symbols. You can run R without RStudio, but it is less convenient.