Articles

Affichage des articles du avril, 2021

Density of beta distribution

The density of beta distribution in R is obtained by: dbeta(x, shape1, shape2, ncp = 0, log = FALSE) Arguments x      vector of quantiles shape1, shape2      non-negative parameters of the Beta distribution. In package HelpersMG, I propose the  dbeta_new(x, mu = NULL, v = NULL, shape1, shape2, ncp = 0, log = FALSE) with mu being the mean and variance being v To obtain a uniform distribution with mu and v, use: mu=0.5 and v=1/12 or shape1=1 and shape2=1

POSIXct or POSIXlt

POSIXct are easier to work with as data (e.g. a column in a dataframe). POSIXlt is easier to work with as dates & times, and has a bigger range. To remember which one is doing what: lt is for list. 'ct' is great for representing date/time holistically (2021-04-26 13:21:27) and is numeric under the hood in seconds since the big bang (just kidding), kind of like julian seconds. [note that "Julian seconds" is misleading. It should be rather ordinal seconds] 'lt' is a list of 7 elements that often require manipulation (e.g. lt$mon = month of the year starting with Jan = 0) but it's great for extracting values like day of the year, day of the week, etc. w/o having to do it yourself - saves a heap of error-fraught coding. One draw back is the handling of daylight savings shifts. In March, an hour gets lost (jumps from 0159 to 0300) and in October you get an hour twice, so if you're using code that requires 1 hour steps, you get hiccups twice/year, so tha

R stuck during S3 registration check

This worked for me to apparently fix my system: Start with a newly rebooted system. Uninstall XQuartz by dragging it to the trash. Look in /Library/LaunchAgents/ for filenames related to xquartz.  Delete them. Look in /Library/LaunchDaemons/ for similar files.  Delete them. Reboot the system again, and install XQuartz again. Relogin, and things seem fine. ______ Sometimes, just reinstalling XQuartz is sufficient. https://www.xquartz.org