Re: [R] Customise Plot tick label on time series plot using date series
Às 05:11 de 13/01/2023, roslinazairimah zakaria escreveu: Hi, I would like to customise my date series on the plot. I tried this: dt_ts <- ts(dt) autoplot(dt_ts[,2]) + ylab("Charge counts") + xlab("Daily") but the label is not the date series. Tqvm for any help given. dput(dt) structure(list(time = c("1/1/2014", "2/1/2014", "3/1/2014", "4/1/2014", "5/1/2014", "6/1/2014", "7/1/2014", "8/1/2014", "9/1/2014", "10/1/2014", "11/1/2014", "12/1/2014", "13/1/2014", "14/1/2014", "15/1/2014", "16/1/2014", "17/1/2014", "18/1/2014", "19/1/2014", "20/1/2014", "21/1/2014", "22/1/2014", "23/1/2014", "24/1/2014", "25/1/2014", "26/1/2014", "27/1/2014", "28/1/2014", "29/1/2014", "30/1/2014", "31/1/2014", "1/2/2014", "2/2/2014", "3/2/2014", "4/2/2014", "5/2/2014", "6/2/2014", "7/2/2014", "8/2/2014", "9/2/2014", "10/2/2014", "11/2/2014", "12/2/2014", "13/2/2014", "14/2/2014", "15/2/2014", "16/2/2014", "17/2/2014", "18/2/2014", "19/2/2014", "20/2/2014", "21/2/2014", "22/2/2014", "23/2/2014", "24/2/2014", "25/2/2014", "26/2/2014", "27/2/2014", "28/2/2014", "1/3/2014", "2/3/2014", "3/3/2014", "4/3/2014", "5/3/2014", "6/3/2014", "7/3/2014", "8/3/2014", "9/3/2014", "10/3/2014", "11/3/2014", "12/3/2014", "13/3/2014", "14/3/2014", "15/3/2014", "16/3/2014", "17/3/2014", "18/3/2014", "19/3/2014", "20/3/2014", "21/3/2014", "22/3/2014", "23/3/2014", "24/3/2014", "25/3/2014", "26/3/2014", "27/3/2014", "28/3/2014", "29/3/2014", "30/3/2014", "31/3/2014", "1/4/2014", "2/4/2014", "3/4/2014", "4/4/2014", "5/4/2014", "6/4/2014", "7/4/2014", "8/4/2014", "9/4/2014", "10/4/2014", "11/4/2014", "12/4/2014", "13/4/2014", "14/4/2014", "15/4/2014", "16/4/2014", "17/4/2014", "18/4/2014", "19/4/2014", "20/4/2014", "21/4/2014", "22/4/2014", "23/4/2014", "24/4/2014", "25/4/2014", "26/4/2014", "27/4/2014", "28/4/2014", "29/4/2014", "30/4/2014", "1/5/2014", "2/5/2014", "3/5/2014", "4/5/2014", "5/5/2014", "6/5/2014", "7/5/2014", "8/5/2014", "9/5/2014", "10/5/2014", "11/5/2014", "12/5/2014", "13/5/2014", "14/5/2014", "15/5/2014", "16/5/2014", "17/5/2014", "18/5/2014", "19/5/2014", "20/5/2014", "21/5/2014", "22/5/2014", "23/5/2014", "24/5/2014", "25/5/2014", "26/5/2014", "27/5/2014", "28/5/2014", "29/5/2014", "30/5/2014", "31/5/2014", "1/6/2014", "2/6/2014", "3/6/2014", "4/6/2014", "5/6/2014", "6/6/2014", "7/6/2014", "8/6/2014", "9/6/2014", "10/6/2014", "11/6/2014", "12/6/2014", "13/6/2014", "14/6/2014", "15/6/2014", "16/6/2014", "17/6/2014", "18/6/2014", "19/6/2014", "20/6/2014", "21/6/2014", "22/6/2014", "23/6/2014", "24/6/2014", "25/6/2014", "26/6/2014", "27/6/2014", "28/6/2014", "29/6/2014", "30/6/2014", "1/7/2014", "2/7/2014", "3/7/2014", "4/7/2014", "5/7/2014", "6/7/2014", "7/7/2014", "8/7/2014", "9/7/2014", "10/7/2014", "11/7/2014", "12/7/2014", "13/7/2014", "14/7/2014", "15/7/2014", "16/7/2014", "17/7/2014", "18/7/2014", "19/7/2014", "20/7/2014", "21/7/2014", "22/7/2014", "23/7/2014", "24/7/2014", "25/7/2014", "26/7/2014", "27/7/2014", "28/7/2014", "29/7/2014", "30/7/2014", "31/7/2014", "1/8/2014", "2/8/2014", "3/8/2014", "4/8/2014", "5/8/2014", "6/8/2014", "7/8/2014", "8/8/2014", "9/8/2014", "10/8/2014", "11/8/2014", "12/8/2014", "13/8/2014", "14/8/2014", "15/8/2014", "16/8/2014", "17/8/2014", "18/8/2014", "19/8/2014", "20/8/2014", "21/8/2014", "22/8/2014", "23/8/2014", "24/8/2014", "25/8/2014", "26/8/2014", "27/8/2014", "28/8/2014", "29/8/2014", "30/8/2014", "31/8/2014", "1/9/2014", "2/9/2014", "3/9/2014", "4/9/2014", "5/9/2014", "6/9/2014", "7/9/2014", "8/9/2014", "9/9/2014", "10/9/2014", "11/9/2014", "12/9/2014", "13/9/2014", "14/9/2014", "15/9/2014", "16/9/2014", "17/9/2014", "18/9/2014", "19/9/2014", "20/9/2014", "21/9/2014", "22/9/2014", "23/9/2014", "24/9/2014", "25/9/2014", "26/9/2014", "27/9/2014", "28/9/2014", "29/9/2014", "30/9/2014", "1/10/2014", "2/10/2014", "3/10/2014", "4/10/2014", "5/10/2014", "6/10/2014", "7/10/2014", "8/10/2014", "9/10/2014", "10/10/2014", "11/10/2014", "12/10/2014", "13/10/2014", "14/10/2014", "15/10/2014", "16/10/2014", "17/10/2014", "18/10/2014", "19/10/2014", "20/10/2014", "21/10/2014", "22/10/2014", "23/10/2014", "24/10/2014", "25/10/2014", "26/10/2014", "27/10/2014", "28/10/2014", "29/10/2014", "30/10/2014", "31/10/2014", "1/11/2014", "2/11/2014", "3/11/2014", "4/11/2014", "5/11/2014", "6/11/2014", "7/11/2014", "8/11/2014", "9/11/2014", "10/11/2014", "11/11/2014", "12/11/2014", "13/11/2014", "14/11/2014", "15/11/2014", "16/11/2014", "17/11/2014", "18/11/2014", "19/11/2014", "20/11/2014", "21/11/2014", "22/11/2014", "23/11/2014", "24/11/2014", "25/11/2014", "26/11/2014", "27/11/2014", "28/11/2014", "29/11/2014", "30/11/2014", "1/12/2014", "2/12/2014", "3/12/2014", "4/12/2014", "5/12/2014", "6/12/2014", "7/12/2014", "8/12/2014", "9/12/2014", "10/12/2014", "11/12/2014", "12/12/2014", "13/12/2014", "14/12/2014", "15/12/2014"), cnt_charge_events = c(2L, 3L, 4L, 3L, 5L, 6L, 3L, 5L, 4L, 4L, 6L, 5L, 3L, 3L, 3L, 4L, 7L, 5L, 5L, 5L, 5L, 5L, 4L, 5L, 5L, 6L, 8L, 7L, 4L, 4L, 5L, 4L, 9L, 7L, 7L, 5L, 6L, 10L, 8L, 7L
[R] Customise Plot tick label on time series plot using date series
Hi, I would like to customise my date series on the plot. I tried this: dt_ts <- ts(dt) autoplot(dt_ts[,2]) + ylab("Charge counts") + xlab("Daily") but the label is not the date series. Tqvm for any help given. > dput(dt) structure(list(time = c("1/1/2014", "2/1/2014", "3/1/2014", "4/1/2014", "5/1/2014", "6/1/2014", "7/1/2014", "8/1/2014", "9/1/2014", "10/1/2014", "11/1/2014", "12/1/2014", "13/1/2014", "14/1/2014", "15/1/2014", "16/1/2014", "17/1/2014", "18/1/2014", "19/1/2014", "20/1/2014", "21/1/2014", "22/1/2014", "23/1/2014", "24/1/2014", "25/1/2014", "26/1/2014", "27/1/2014", "28/1/2014", "29/1/2014", "30/1/2014", "31/1/2014", "1/2/2014", "2/2/2014", "3/2/2014", "4/2/2014", "5/2/2014", "6/2/2014", "7/2/2014", "8/2/2014", "9/2/2014", "10/2/2014", "11/2/2014", "12/2/2014", "13/2/2014", "14/2/2014", "15/2/2014", "16/2/2014", "17/2/2014", "18/2/2014", "19/2/2014", "20/2/2014", "21/2/2014", "22/2/2014", "23/2/2014", "24/2/2014", "25/2/2014", "26/2/2014", "27/2/2014", "28/2/2014", "1/3/2014", "2/3/2014", "3/3/2014", "4/3/2014", "5/3/2014", "6/3/2014", "7/3/2014", "8/3/2014", "9/3/2014", "10/3/2014", "11/3/2014", "12/3/2014", "13/3/2014", "14/3/2014", "15/3/2014", "16/3/2014", "17/3/2014", "18/3/2014", "19/3/2014", "20/3/2014", "21/3/2014", "22/3/2014", "23/3/2014", "24/3/2014", "25/3/2014", "26/3/2014", "27/3/2014", "28/3/2014", "29/3/2014", "30/3/2014", "31/3/2014", "1/4/2014", "2/4/2014", "3/4/2014", "4/4/2014", "5/4/2014", "6/4/2014", "7/4/2014", "8/4/2014", "9/4/2014", "10/4/2014", "11/4/2014", "12/4/2014", "13/4/2014", "14/4/2014", "15/4/2014", "16/4/2014", "17/4/2014", "18/4/2014", "19/4/2014", "20/4/2014", "21/4/2014", "22/4/2014", "23/4/2014", "24/4/2014", "25/4/2014", "26/4/2014", "27/4/2014", "28/4/2014", "29/4/2014", "30/4/2014", "1/5/2014", "2/5/2014", "3/5/2014", "4/5/2014", "5/5/2014", "6/5/2014", "7/5/2014", "8/5/2014", "9/5/2014", "10/5/2014", "11/5/2014", "12/5/2014", "13/5/2014", "14/5/2014", "15/5/2014", "16/5/2014", "17/5/2014", "18/5/2014", "19/5/2014", "20/5/2014", "21/5/2014", "22/5/2014", "23/5/2014", "24/5/2014", "25/5/2014", "26/5/2014", "27/5/2014", "28/5/2014", "29/5/2014", "30/5/2014", "31/5/2014", "1/6/2014", "2/6/2014", "3/6/2014", "4/6/2014", "5/6/2014", "6/6/2014", "7/6/2014", "8/6/2014", "9/6/2014", "10/6/2014", "11/6/2014", "12/6/2014", "13/6/2014", "14/6/2014", "15/6/2014", "16/6/2014", "17/6/2014", "18/6/2014", "19/6/2014", "20/6/2014", "21/6/2014", "22/6/2014", "23/6/2014", "24/6/2014", "25/6/2014", "26/6/2014", "27/6/2014", "28/6/2014", "29/6/2014", "30/6/2014", "1/7/2014", "2/7/2014", "3/7/2014", "4/7/2014", "5/7/2014", "6/7/2014", "7/7/2014", "8/7/2014", "9/7/2014", "10/7/2014", "11/7/2014", "12/7/2014", "13/7/2014", "14/7/2014", "15/7/2014", "16/7/2014", "17/7/2014", "18/7/2014", "19/7/2014", "20/7/2014", "21/7/2014", "22/7/2014", "23/7/2014", "24/7/2014", "25/7/2014", "26/7/2014", "27/7/2014", "28/7/2014", "29/7/2014", "30/7/2014", "31/7/2014", "1/8/2014", "2/8/2014", "3/8/2014", "4/8/2014", "5/8/2014", "6/8/2014", "7/8/2014", "8/8/2014", "9/8/2014", "10/8/2014", "11/8/2014", "12/8/2014", "13/8/2014", "14/8/2014", "15/8/2014", "16/8/2014", "17/8/2014", "18/8/2014", "19/8/2014", "20/8/2014", "21/8/2014", "22/8/2014", "23/8/2014", "24/8/2014", "25/8/2014", "26/8/2014", "27/8/2014", "28/8/2014", "29/8/2014", "30/8/2014", "31/8/2014", "1/9/2014", "2/9/2014", "3/9/2014", "4/9/2014", "5/9/2014", "6/9/2014", "7/9/2014", "8/9/2014", "9/9/2014", "10/9/2014", "11/9/2014", "12/9/2014", "13/9/2014", "14/9/2014", "15/9/2014", "16/9/2014", "17/9/2014", "18/9/2014", "19/9/2014", "20/9/2014", "21/9/2014", "22/9/2014", "23/9/2014", "24/9/2014", "25/9/2014", "26/9/2014", "27/9/2014", "28/9/2014", "29/9/2014", "30/9/2014", "1/10/2014", "2/10/2014", "3/10/2014", "4/10/2014", "5/10/2014", "6/10/2014", "7/10/2014", "8/10/2014", "9/10/2014", "10/10/2014", "11/10/2014", "12/10/2014", "13/10/2014", "14/10/2014", "15/10/2014", "16/10/2014", "17/10/2014", "18/10/2014", "19/10/2014", "20/10/2014", "21/10/2014", "22/10/2014", "23/10/2014", "24/10/2014", "25/10/2014", "26/10/2014", "27/10/2014", "28/10/2014", "29/10/2014", "30/10/2014", "31/10/2014", "1/11/2014", "2/11/2014", "3/11/2014", "4/11/2014", "5/11/2014", "6/11/2014", "7/11/2014", "8/11/2014", "9/11/2014", "10/11/2014", "11/11/2014", "12/11/2014", "13/11/2014", "14/11/2014", "15/11/2014", "16/11/2014", "17/11/2014", "18/11/2014", "19/11/2014", "20/11/2014", "21/11/2014", "22/11/2014", "23/11/2014", "24/11/2014", "25/11/2014", "26/11/2014", "27/11/2014", "28/11/2014", "29/11/2014", "30/11/2014", "1/12/2014", "2/12/2014", "3/12/2014", "4/12/2014", "5/12/2014", "6/12/2014", "7/12/2014", "8/12/2014", "9/12/2014", "10/12/2014", "11/12/2014", "12/12/2014", "13/12/2014", "14/12/2014", "15/12/2014"), cnt_charge_events = c(2L, 3L, 4L, 3L, 5L, 6L, 3L, 5L, 4L, 4L, 6L, 5L, 3L, 3L, 3L, 4L, 7L, 5L, 5L, 5L, 5L, 5L, 4L, 5L, 5L, 6L, 8L, 7L, 4L, 4L, 5L, 4L, 9L, 7L, 7L, 5L, 6L, 10L, 8L, 7L, 10L, 8L, 8L, 10L, 12L, 8L, 10L, 13L, 11L, 9L, 14L, 9L, 11L
Re: [R] return value of {....}
Dear Akshay, The best response was given by Andrew. "{...}" is not a closure. This is unusual for someone used to C-type languages. But I will try to explain some of the rationale. In the case that "{...}" was a closure, then external variables would need to be explicitly declared before the closure (in order to reuse those values): intermediate = c() { intermediate = ...; result = someFUN(intermediate); } 1.) Interactive Sessions This is cumbersome in interactive sessions. For example: you often compute the mean or the variance as intermediary results, and will need them later on as well. They could have been computed outside the "closure", but writing code in interactive sessions may not always be straightforward. 2.) Missing arguments f = function(x, y) { if(missing(y)) { # assuming x = matrix y = x[,2]; x = x[,1]; } } It would be much more cumbersome to define/use a temporary tempY. I hope this gives a better perspective why this is indeed a useful feature - even if it is counterintuitive. Sincerely, Leonard __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] New CRAN package announcement: azlogr
I am excited to announce that `azlogr` is published on CRAN! This package enables logging in 'R' by extending the functionality of 'logger' package. There is an option to add additional custom meta-data while logging, which can sometimes be helpful. Logging messages are displayed on console and optionally they are sent to 'Azure Log Analytics' workspace in real-time. The package comes with a vignette, How to use azlogr, that (hopefully) provides a good introduction to using the functions for easy logging. Example usage below: # Azure Log Analytics workspace id and shared key are fetched # from environment variables. Sys.setenv(AZ_LOG_ID = "") Sys.setenv(AZ_LOG_KEY = "") library(azlogr) # Optionally, add additional meta-data, `country` and `id`, to be collected # while logging, on top of the default fields - 'level', 'time', 'msg'. set_log_config( log_fields = c("level", "time", "msg"), additional_fields = list(country = "in", id = 123) ) # Use logger_* functions with appropriate logging level to log. # If POST is successful, then it will be available in custom log table on # Azure Log Analytics, by default table name will be `log_from_r`_CL (_CL is # added by Azure for any custom log table) logger_info("log info sent to Azure") #> {"level":"INFO","time":"2023-01-11 13:15:04","msg":"log info sent to Azure","country":"in","id":123} # If the POST request is unsuccessful due to Azure credential issue, then log # message is displayed on console and a warning is generated with error details. logger_info("log info sent to Azure") #> {"level":"INFO","time":"2023-01-11 13:15:04","msg":"log info sent to Azure","country":"in","id":123} #> Warning message: #> In logger_level(logger::INFO, ...) : #> Some error happened while sending POST request to 'Azure Log Analytics' workspace. #> Error message: Error in curl::curl_fetch_memory(url, handle = handle) : #> Could not resolve host: abcd.ods.opinsights.azure.com Many thanks to the author of 'logger' package, and to the CRAN team for a speedy onboarding! RegardsVivek Atal [[alternative HTML version deleted]] ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Background for word
Às 06:15 de 12/01/2023, Steven T. Yen escreveu: Dear, I am having a lucky day. I am programming in RStudio and when I type "black" (quotation signs included, the word turn into a word with black ground. Couldn't get rid of the backgroundcopying to Word, Excel, text editor and paste back to Rstudio, the word is still in black background? Help! dv.group<-c("black","othrrace"); cat.ref<-"white" __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hello, I had the same problem and asked the RStudio Community about it. The answer solved the problem. https://community.rstudio.com/t/after-updating-rstudio-color-names-are-highlighted/155600 Hope this helps, Rui Barradas __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.