Re: [R] What is the HEX code for "transparent" color?
You would set the alpha of an existing color and give it a new name and then refer to it by name rather than using HEX codes. On June 6, 2024 11:08:06 AM EDT, Greg Snow <538...@gmail.com> wrote: >You need a "#" at the beginning of the string to specify that it is a >hex code for the color. Try "#". > >On Thu, Jun 6, 2024 at 9:07 AM Yosu Yurramendi > wrote: >> >> What is the HEX code for "transparent" color? >> I've tried "" "FF00" "", but they don't work. >> Thanks >> >> [[alternative HTML version deleted]] >> >> __ >> 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. > > > >-- >Gregory (Greg) L. Snow Ph.D. >538...@gmail.com > >__ >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. -- Robert Knight tel 270-306-1658 fax (270) 288-0474 r...@rk.fyi [[alternative HTML version deleted]] __ 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] What is the HEX code for "transparent" color?
On 2024-06-06 4:37 a.m., Yosu Yurramendi wrote: What is the HEX code for "transparent" color? I've tried "" "FF00" "", but they don't work. If the other answers don't solve your problem, you should give us some context. Not all graphics functions in R can handle transparency, so please show us some reproducible code for what you are trying. Duncan Murdoch __________ 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] What is the HEX code for "transparent" color?
You would give an existing color a new name and modify the new name's alpha. Then refer to the color by the new name instead of using HEX. On Thu, Jun 6, 2024, 11:07 AM Yosu Yurramendi wrote: > What is the HEX code for "transparent" color? > I've tried "" "FF00" "", but they don't work. > Thanks > > [[alternative HTML version deleted]] > > __ > 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. > [[alternative HTML version deleted]] __ 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] What is the HEX code for "transparent" color?
You need a "#" at the beginning of the string to specify that it is a hex code for the color. Try "#". On Thu, Jun 6, 2024 at 9:07 AM Yosu Yurramendi wrote: > > What is the HEX code for "transparent" color? > I've tried "" "FF00" "", but they don't work. > Thanks > > [[alternative HTML version deleted]] > > __ > 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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com __ 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] What is the HEX code for "transparent" color?
What is the HEX code for "transparent" color? I've tried "" "FF00" "", but they don't work. Thanks [[alternative HTML version deleted]] __________ 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] R Shiny Help - Trouble passing user input columns to emmeans after ANOVA analysis
В Wed, 5 Jun 2024 19:07:19 -0500 I B пишет: > However, I am getting the following error: *"Argument is of length > zero."* > if (selected_graph() == cols$column2 | selected_model() == "Main > effects model") { The error must be coming from here. At least one of selected_graph(), cols$column2, selected_model() is a zero-length object (maybe NULL) at this point, which makes the result of the whole expression zero-length too. if (...) only accepts logical scalars, hence the error. -- Best regards, Ivan __________ 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] R Shiny Help - Trouble passing user input columns to emmeans after ANOVA analysis
Wrong list. Shiny is software from an external provider, POSIT (formerly RStudio) and not part of R, itself. They have a community support site at: https://forum.posit.co/?_gl=1*bh848i*_ga*MTY2NjcwNzQ4LjE3MTYyMzkzODQ.*_ga_2C0WZ1JHG0*MTcxNzY4NTExNi4yLjAuMTcxNzY4NTExNi4wLjAuMA .. Cheers, Bert On Thu, Jun 6, 2024 at 12:09 AM I B wrote: > Hello everybody, > > I have experience coding with R, but am brand new to R Shiny. I am trying > to produce an application that will allow users to upload their own > dataset, select columns they want an ANOVA analysis run on, and generate > graphs that will allow users to view their results. However, I am getting > the following error: *"Argument is of length zero."* > > Being new to Shiny, I am having trouble passing the user input column to an > emmeans argument in order to do a post hoc analysis, and using that > information to produce a graph. Can somebody help me with this? *The code > for my dataset and application are provided below; copying and pasting > directly into R should generate the reproducible example.* > > In my application, the following columns should be selected after uploading > the dataset: > >- Select response variable: "ndvi" >- Select first independent variable: "genotype" >- Select second independent variable: "rate" >- Select random variable: "rep" > > For this example, the final two drop-down selections should be: > >- "Which variable would you like to graph? "genotype" >- "Which ANOVA model do you want to graph? "Main effects model" > > Any help would be great. Thank you so much! > > Sincerely, > Isaac Barnhart, PhD > > > *Here is my dataset:* > > data <- data.frame(rep = > c(1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3), >genotype = > > c('a','a','a','a','b','b','b','b','c','c','c','c','a','a','a','a','b','b','b','b','c','c','c','c','a','a','a','a','b','b','b','b','c','c','c','c'), >rate = > > c('1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x'), >ndvi = > > c(0.584947811,0.642112121,0.654116902,0.785068313,0.79665163,0.674549249,0.958911611,0.547077528,0.613315552,0.768646411,0.97107949,0.680942649,0.520576242,0.723920266,0.868779972,0.834257732,0.554506685,0.520458208,0.617282262,0.80128067,0.875192693,0.572153151,0.850305042,0.500760522,0.796305833,0.643719779,0.590512435,0.522884966,0.905197544,0.663792758,0.690415735,0.975449466,0.621379163,0.734904647,0.812023395,0.928144532)) > > > *Here is my code:* > > library(shiny) > library(ggplot2) > library(tidyverse) > library(emmeans) > library(DHARMa) > library(lme4) > > ui <- fluidPage( > fileInput("file1", "Choose .csv or .xlsx file", > accept = c("text/csv", >"text/comma-separated-values", >".csv", >".xlsx")), > textOutput("data_info"), > verbatimTextOutput("data_head"), > uiOutput("column_selector_1"), > uiOutput("column_selector_2"), > uiOutput("column_selector_3"), > uiOutput("column_selector_4"), > textOutput("dist_info"), > plotOutput("dist"), > textOutput("str_info"), > verbatimTextOutput("selected_columns"), > textOutput("two_way_anova"), > verbatimTextOutput("model_summary"), > textOutput("main_effects"), > verbatimTextOutput("model_summary_ME"), > textOutput("mod_diagnostic"), > plotOutput("diagnostic_plot"), > uiOutput("graph"), > uiOutput("model_selection"), > plotOutput("graph_plot") > ) > > server <- function(input, output, session) { > # Open file > req(data <- reactive({ > infile <- input$file1 > if (is.null(infile)) { > return(NULL) > } > read.csv(infile$datapath, header = TRUE) > })) > > # Preview data > output$data_info <- renderText({ > req(data()) > "Preview of the data uploaded:" > }) > > output$data_head <- renderPrint({ > req(data()) > head(data(), 20) > }) > > # Select response variable > output$column_selector_1 <- renderUI({ > req(data()) > selectInput("column1","Select response variable", choices = > names(data())) > }) >
Re: [R] Bug report for package foreign anf functon write.foreign
I haven’t used this function in a long time, but it sounds like the issue is the format names for the formats catalog, not the variable names. You might try the haven package as it can create SAS datasets directly, although there are limitations (I think). > On Jun 6, 2024, at 4:45 AM, Julien JOLY wrote: > > [Vous ne recevez pas souvent de courriers de julien.j...@inserm.fr. D?couvrez > pourquoi ceci est important ? https://aka.ms/LearnAboutSenderIdentification ] > > Dear all, > > First of all, I thank you for the creation of the package. > > I write this message concerning the write.foreign() function from the foreign > package and a bug that I discovered. > When we want to save our dataset as a .sas file, the limit of variable names > character is 8 by default. In SAS this limit is 32 character and an argument > in the function, validvarname, can theorically switch the default from 8 to > 32 by selecting validvarname = "V7". > > However, it did not work and show the error "Cannot uniquely abbreviate > format names to conform to eight-character limit and not ending in a digit" > that show the limit is still 8 characters. > > By looking at the script at > https://github.com/cran/foreign/blob/master/R/writeForeignSAS.R , I realized > that the line 39, in the function make.SAS.formats, can be the reason of the > nonfunctioning argument : > "if(any(nchar(x) > 8L) || any(duplicated(x)))" which is correct if the length > of the variable has a limit of 8, but it does not take in consideration when > the limit is at 32 defined by validvarnames = "V7". > > A solution can be to add the argument validvarname in the definition of the > function and add these few lines : > validvarname <- match.arg(validvarname) > nmax <- if(validvarname == "V7") 32L else 8L > if(any(nchar(x) > nmax) || any(duplicated(x))) > > > I hope I send the message to the good place and that it will help you improve > the package. > > Kind regards, > > > > Julien Joly > > Biostatisticien et Data manager > > > > > >[[alternative HTML version deleted]] > > __ > 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. -- Kevin E. Thorpe Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416-946-8083 __ 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] Bug report for package foreign anf functon write.foreign
Dear all, First of all, I thank you for the creation of the package. I write this message concerning the write.foreign() function from the foreign package and a bug that I discovered. When we want to save our dataset as a .sas file, the limit of variable names character is 8 by default. In SAS this limit is 32 character and an argument in the function, validvarname, can theorically switch the default from 8 to 32 by selecting validvarname = "V7". However, it did not work and show the error "Cannot uniquely abbreviate format names to conform to eight-character limit and not ending in a digit" that show the limit is still 8 characters. By looking at the script at https://github.com/cran/foreign/blob/master/R/writeForeignSAS.R , I realized that the line 39, in the function make.SAS.formats, can be the reason of the nonfunctioning argument : "if(any(nchar(x) > 8L) || any(duplicated(x)))" which is correct if the length of the variable has a limit of 8, but it does not take in consideration when the limit is at 32 defined by validvarnames = "V7". A solution can be to add the argument validvarname in the definition of the function and add these few lines : validvarname <- match.arg(validvarname) nmax <- if(validvarname == "V7") 32L else 8L if(any(nchar(x) > nmax) || any(duplicated(x))) I hope I send the message to the good place and that it will help you improve the package. Kind regards, Julien Joly Biostatisticien et Data manager [[alternative HTML version deleted]] __ 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 Shiny Help - Trouble passing user input columns to emmeans after ANOVA analysis
Hello everybody, I have experience coding with R, but am brand new to R Shiny. I am trying to produce an application that will allow users to upload their own dataset, select columns they want an ANOVA analysis run on, and generate graphs that will allow users to view their results. However, I am getting the following error: *"Argument is of length zero."* Being new to Shiny, I am having trouble passing the user input column to an emmeans argument in order to do a post hoc analysis, and using that information to produce a graph. Can somebody help me with this? *The code for my dataset and application are provided below; copying and pasting directly into R should generate the reproducible example.* In my application, the following columns should be selected after uploading the dataset: - Select response variable: "ndvi" - Select first independent variable: "genotype" - Select second independent variable: "rate" - Select random variable: "rep" For this example, the final two drop-down selections should be: - "Which variable would you like to graph? "genotype" - "Which ANOVA model do you want to graph? "Main effects model" Any help would be great. Thank you so much! Sincerely, Isaac Barnhart, PhD *Here is my dataset:* data <- data.frame(rep = c(1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3), genotype = c('a','a','a','a','b','b','b','b','c','c','c','c','a','a','a','a','b','b','b','b','c','c','c','c','a','a','a','a','b','b','b','b','c','c','c','c'), rate = c('1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x','1x','2x','4x','8x'), ndvi = c(0.584947811,0.642112121,0.654116902,0.785068313,0.79665163,0.674549249,0.958911611,0.547077528,0.613315552,0.768646411,0.97107949,0.680942649,0.520576242,0.723920266,0.868779972,0.834257732,0.554506685,0.520458208,0.617282262,0.80128067,0.875192693,0.572153151,0.850305042,0.500760522,0.796305833,0.643719779,0.590512435,0.522884966,0.905197544,0.663792758,0.690415735,0.975449466,0.621379163,0.734904647,0.812023395,0.928144532)) *Here is my code:* library(shiny) library(ggplot2) library(tidyverse) library(emmeans) library(DHARMa) library(lme4) ui <- fluidPage( fileInput("file1", "Choose .csv or .xlsx file", accept = c("text/csv", "text/comma-separated-values", ".csv", ".xlsx")), textOutput("data_info"), verbatimTextOutput("data_head"), uiOutput("column_selector_1"), uiOutput("column_selector_2"), uiOutput("column_selector_3"), uiOutput("column_selector_4"), textOutput("dist_info"), plotOutput("dist"), textOutput("str_info"), verbatimTextOutput("selected_columns"), textOutput("two_way_anova"), verbatimTextOutput("model_summary"), textOutput("main_effects"), verbatimTextOutput("model_summary_ME"), textOutput("mod_diagnostic"), plotOutput("diagnostic_plot"), uiOutput("graph"), uiOutput("model_selection"), plotOutput("graph_plot") ) server <- function(input, output, session) { # Open file req(data <- reactive({ infile <- input$file1 if (is.null(infile)) { return(NULL) } read.csv(infile$datapath, header = TRUE) })) # Preview data output$data_info <- renderText({ req(data()) "Preview of the data uploaded:" }) output$data_head <- renderPrint({ req(data()) head(data(), 20) }) # Select response variable output$column_selector_1 <- renderUI({ req(data()) selectInput("column1","Select response variable", choices = names(data())) }) # Select first independent variable output$column_selector_2 <- renderUI({ req(data()) selectInput("column2", "Select first independent variable", choices = names(data())) }) # Select second independent variable output$column_selector_3 <- renderUI({ req(data()) selectInput("column3", "Select second independent variable", choices = names(data())) }) # Select random variable output$column_selector_4 <- renderUI({ req(data()) selectInput("column4", "Select random variable", choices = names(data())) }) # Assigning user inputs to correct variables selected_columns <- reactive({ req(data(), input$column1, input$column2, input$column3, input$column4) list( dependent = data()[[input$column1]], independent1 = as.factor(data
Re: [R] nc file
The link suggested by Ben is over 7 years old, so using the CRAN Task View: https://cran.r-project.org/web/views/Spatial.html, which is up-to-date, and https://rspatial.org/index.html, because the terra package has largely replaced the raster package. Please consider following up on the R-sig-geo mailing list: https://stat.ethz.ch/mailman/listinfo/r-sig-geo. Hope this helps, Roger -- Roger Bivand Emeritus Professor Norwegian School of Economics Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway roger.biv...@nhh.no __ 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] nc file
This question is unfortunately too vague for us to help you. A little bit of web-searching turned up this tutorial: maybe that will help? https://rpubs.com/boyerag/297592 On 2024-06-04 6:49 a.m., Farzad Ghooshi wrote: Hello I am a PhD student in ecology. The subject of my thesis is climate change and agricultural systems modeling. One of the software used in this research is R. As you know, nc files show climate variables by year in general for the whole world. With what command line can I isolate an nc file climate variable for a specific location? [[alternative HTML version deleted]] __ 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-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] nc file
Hello I am a PhD student in ecology. The subject of my thesis is climate change and agricultural systems modeling. One of the software used in this research is R. As you know, nc files show climate variables by year in general for the whole world. With what command line can I isolate an nc file climate variable for a specific location? [[alternative HTML version deleted]] __ 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] Tools to modify highlighted areas in pdf documents?
Dear Ivan, Thank you very much for the hint. I have started to test it. - it offers more colours and types of highlighting than MS Edge; - it seems to have better word-boundary detection than MS Edge (but I haven't tested all the cases yet); There are some nit-picks: - I wish it had a better default color-pallet; - the vertical positioning continues to be sometimes sub-optimal: editing manually the coordinates may be still useful; Returning to R: 1. Some of the pdf-packages could implement some of the annotation-functionality as well. 2. It would be useful to be able to export the annotations and import/merge them in another document. I have spotted errors in various articles; such a functionality would be handy, if a new version of those articles gets published. Sincerely, Leonard From: Ivan Krylov Sent: Sunday, June 2, 2024 8:02 PM To: Leo Mada via R-help Cc: Leo Mada Subject: Re: [R] Tools to modify highlighted areas in pdf documents? � Sat, 1 Jun 2024 16:16:23 + Leo Mada via R-help �: > When highlighting pdf-documents with Microsoft Edge, the bounding box > is sometimes misplaced, and quite ugly so. It also lacks the ability > to draw lines or arrows. > > On the other hand, I did not get used to Acrobat Reader: it usually > involves much more effort to add specific highlights. Lines can be > drawn, but are NOT straight! Sorry for answering a different question, but have you considered using a different PDF viewer + annotation application? Okular <https://eu01.z.antigena.com/l/iZmB5crNT773HTSUSt2S6McW6mdP5phHyzgXromFHINsN6Uo6BMnSdZK0kmSK~aLduXw-YpIAWy-DV9bac-5U3grBsLdYxuX7aMmbxQjKSLGCqTyJG54WQ2W7oaR2NEPTWiFotbkB4_eQTzHI3L-cAgOgsS4exJ4ie4BHLt > is free and available on Windows (including from outside Microsoft store). Its annotation features include all kinds of highlights, arrows and lines, both straight and arbitrarily-shaped, quickly available from the "annotations" panel. -- Best regards, Ivan [[alternative HTML version deleted]] ______ 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] QGA 1.0 is released
Dear R users, I am pleased to announce that QGA 1.0 is now available on CRAN. QGA implements the Quantum Genetic Algorithm, as proposed by Han and Kim in 2000, and is an R implementation derived from the Python one by Lahoz-Beltra in 2016. Under this approach, each solution is represented as a sequence of (qu)bits. Simulating the quantum paradigm, these qubits are in a superposition state: when measuring them, they collapse in a 0 or 1 state. After measurement, the solution's fitness is calculated as in usual genetic algorithms. The evolution at each iteration is oriented by the application of two quantum gates to the amplitudes of the qubits: (1) a rotation gate (always); (2) a Pauli-X gate (optionally). The rotation is based on the theta angle values: higher values allow a quicker evolution, and lower values avoid local maxima. The Pauli-X gate is equivalent to the classical mutation operator and determines the swap between alfa and beta amplitudes of a given qubit. The package has been developed in such a way as to permit a complete separation between the 'engine', and the particular problem subject to combinatorial optimization. This is evident in the available examples, that come with the package, illustrating the application of QGA to different problems: knapsack, traveler salesman, and clustering. Thank you, kind regards, Giulio Barcaroli [[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] R code for overlapping variables -- count
One could make dummy variables if the existing variables are otherwise. If Female is a variable that includes other options (no-response, non-binary, ...) then recode it using dummy.female and the others would be similarly named. -Original Message- From: R-help On Behalf Of peter dalgaard Sent: Monday, June 3, 2024 5:02 AM To: Shadee Ashtari Cc: r-help@r-project.org Subject: Re: [R] R code for overlapping variables -- count [External Email] If they are binary (0/1 dummies), can't you just "&" them as in table(Female & USA & MidIncome) (or sum() if you don't care about the number of 0s) -pd > On 2 Jun 2024, at 00:31 , Shadee Ashtari wrote: > > Hi! > > I am trying to find the code for how to get counts for intersectional > variables. For example, I have three unique categorical variables -- > "Female," "USA," and "MidIncome" -- and I'm trying to see how many > people I have at the intersection of the three. > > Thank you so much, > Shadee > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat/ > .ethz.ch%2Fmailman%2Flistinfo%2Fr-help=05%7C02%7Ctebert%40ufl.edu > %7C66abf8af810348ed21b408dc83abdfd6%7C0d4da0f84a314d76ace60a62331e1b84 > %7C0%7C0%7C638530021430818928%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw > MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C= > a2oUZzOdXDHnzPA3Oo98DIp%2BFIqpg5o1fT0fcE%2BvkQI%3D=0 > PLEASE do read the posting guide > http://www.r/ > -project.org%2Fposting-guide.html=05%7C02%7Ctebert%40ufl.edu%7C66 > abf8af810348ed21b408dc83abdfd6%7C0d4da0f84a314d76ace60a62331e1b84%7C0% > 7C0%7C638530021430825783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL > CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C=L2I%2 > BxXV3kHZUwflUx0%2BGrakGbbOV6AWV7dul7%2FyuIBU%3D=0 > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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-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] R code for overlapping variables -- count
If they are binary (0/1 dummies), can't you just "&" them as in table(Female & USA & MidIncome) (or sum() if you don't care about the number of 0s) -pd > On 2 Jun 2024, at 00:31 , Shadee Ashtari wrote: > > Hi! > > I am trying to find the code for how to get counts for intersectional > variables. For example, I have three unique categorical variables -- > "Female," "USA," and "MidIncome" -- and I'm trying to see how many people I > have at the intersection of the three. > > Thank you so much, > Shadee > > [[alternative HTML version deleted]] > > __ > 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com ______ 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] R code for overlapping variables -- count
Às 18:40 de 02/06/2024, Rui Barradas escreveu: Às 18:34 de 02/06/2024, Leo Mada via R-help escreveu: Dear Shadee, If you have a data.frame with the following columns: n = 100; # population size x = data.frame( Sex = sample(c("M","F"), n, T), Country = sample(c("AA", "BB", "US"), n, T), Income = as.factor(sample(1:3, n, T)) ) # Dummy variable ONE = rep(1, nrow(x)) r = aggregate(ONE ~ Sex + Income + Country, length, data = x) r = r[, c("Country", "Income", "Sex")] print(r) It is possible to write more simple code, if you need only the particular combination of variables (which you specified in your mail). But this is the more general approach. Note: you may want to use "sum" instead of "length", e.g. if you have a column specifying the number of individuals in that category. Hope this helps, Leonard [[alternative HTML version deleted]] __ 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, The following is simpler. r2 <- xtabs(~ ., x) |> as.data.frame() r2[-4L] # or r2[names(r2) != "Freq"] Hope this helps, Rui Barradas Hello, This is the same solution but the code to keep only the columns in the original data set is better. And it's a MRE. n <- 100; # population size x <- data.frame( Sex = sample(c("M","F"), n, T), Country = sample(c("AA", "BB", "US"), n, T), Income = as.factor(sample(1:3, n, T)) ) r2 <- xtabs(~ ., x) |> as.data.frame() # no need for constants, find the columns # to keep from the data r2[names(r2) %in% names(x)] Hope this helps, Rui Barradas -- Este e-mail foi analisado pelo software antivírus AVG para verificar a presença de vírus. www.avg.com __ 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] R code for overlapping variables -- count
Correcting a small glitch - see new code. From: Leo Mada Sent: Sunday, June 2, 2024 8:34 PM To: Shadee Ashtari Cc: r-help@r-project.org Subject: [R] R code for overlapping variables -- count Dear Shadee, If you have a data.frame with the following columns: n = 100; # population size x = data.frame( Sex = sample(c("M","F"), n, T), Country = sample(c("AA", "BB", "US"), n, T), Income = as.factor(sample(1:3, n, T)) ) # Dummy variable ONE = rep(1, nrow(x)) # corrected r = aggregate(ONE ~ Sex + Income + Country, length, data = x) r = r[, c("Country", "Income", "Sex", "ONE")] names(r)[4] = "Count" print(r) It is possible to write more simple code, if you need only the particular combination of variables (which you specified in your mail). But this is the more general approach. Note: you may want to use "sum" instead of "length", e.g. if you have a column specifying the number of individuals in that category. Hope this helps, Leonard [[alternative HTML version deleted]] ______ 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] R code for overlapping variables -- count
Às 18:34 de 02/06/2024, Leo Mada via R-help escreveu: Dear Shadee, If you have a data.frame with the following columns: n = 100; # population size x = data.frame( Sex = sample(c("M","F"), n, T), Country = sample(c("AA", "BB", "US"), n, T), Income = as.factor(sample(1:3, n, T)) ) # Dummy variable ONE = rep(1, nrow(x)) r = aggregate(ONE ~ Sex + Income + Country, length, data = x) r = r[, c("Country", "Income", "Sex")] print(r) It is possible to write more simple code, if you need only the particular combination of variables (which you specified in your mail). But this is the more general approach. Note: you may want to use "sum" instead of "length", e.g. if you have a column specifying the number of individuals in that category. Hope this helps, Leonard [[alternative HTML version deleted]] __ 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, The following is simpler. r2 <- xtabs(~ ., x) |> as.data.frame() r2[-4L] # or r2[names(r2) != "Freq"] Hope this helps, Rui Barradas -- Este e-mail foi analisado pelo software antivírus AVG para verificar a presença de vírus. www.avg.com ______ 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 code for overlapping variables -- count
Dear Shadee, If you have a data.frame with the following columns: n = 100; # population size x = data.frame( Sex = sample(c("M","F"), n, T), Country = sample(c("AA", "BB", "US"), n, T), Income = as.factor(sample(1:3, n, T)) ) # Dummy variable ONE = rep(1, nrow(x)) r = aggregate(ONE ~ Sex + Income + Country, length, data = x) r = r[, c("Country", "Income", "Sex")] print(r) It is possible to write more simple code, if you need only the particular combination of variables (which you specified in your mail). But this is the more general approach. Note: you may want to use "sum" instead of "length", e.g. if you have a column specifying the number of individuals in that category. Hope this helps, Leonard [[alternative HTML version deleted]] __ 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] Tools to modify highlighted areas in pdf documents?
В Sat, 1 Jun 2024 16:16:23 + Leo Mada via R-help пишет: > When highlighting pdf-documents with Microsoft Edge, the bounding box > is sometimes misplaced, and quite ugly so. It also lacks the ability > to draw lines or arrows. > > On the other hand, I did not get used to Acrobat Reader: it usually > involves much more effort to add specific highlights. Lines can be > drawn, but are NOT straight! Sorry for answering a different question, but have you considered using a different PDF viewer + annotation application? Okular <https://okular.kde.org/> is free and available on Windows (including from outside Microsoft store). Its annotation features include all kinds of highlights, arrows and lines, both straight and arbitrarily-shaped, quickly available from the "annotations" panel. -- Best regards, Ivan ______ 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] R code for overlapping variables -- count
On 2024-06-01 6:31 p.m., Shadee Ashtari wrote: Hi! I am trying to find the code for how to get counts for intersectional variables. For example, I have three unique categorical variables -- "Female," "USA," and "MidIncome" -- and I'm trying to see how many people I have at the intersection of the three. It depends on how those are stored. Could you put together a little dataframe containing sample data, run `dput()` on it, and post the result here? Duncan Murdoch ______ 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 code for overlapping variables -- count
Hi! I am trying to find the code for how to get counts for intersectional variables. For example, I have three unique categorical variables -- "Female," "USA," and "MidIncome" -- and I'm trying to see how many people I have at the intersection of the three. Thank you so much, Shadee [[alternative HTML version deleted]] ______ 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] Tools to modify highlighted areas in pdf documents?
Dear Bert, Thank you very much for the response. I was aware of pdftools - but did not recall any such functionality. I have checked again (both pdftools, qpdf and the 3rd one): unfortunately, they do not implement such functionality. There might be other packages, which I missed. However, the functionality is feasible. I will add a few more details - maybe someone picks up the task. It is possible to edit manually the pdf-file, though it is quite cumbersome to find the right annotation. 1. One needs to edit the values both in the \QuadPoints and the \Rect in the \AP object. 2. Modifying the color is trickier: \C() encodes the color and \CA the alpha channel (= 1): but neither Acrobat, nor MIcrosoft Edge update the color. The value of the color encoded in the stream is used instead. It is possible to "trick" Edge: modify the \C color and set "\ca 1" (in the stream block) to a lower value (e.g. "\ca 0.99"). MS Edge will then accept the modified color (but Acrobat ignores it). Changing the value in the stream is the actual solution. Note: non-rectangular shapes can be specified as well. I hope that some of the referenced packages pick up this task. Sincerely, Leonard From: Bert Gunter Sent: Saturday, June 1, 2024 9:23 PM To: Leo Mada Cc: r-help@r-project.org Subject: Re: [R] Tools to modify highlighted areas in pdf documents? Search! on rseek.org<http://rseek.org>, the query "modify pdf documents in R" brought up the staplr package. A quick web search with the same query brought up the pdftools package. These were cursory efforts, so you may well find more. You will have to determine whether and to what degree any meet your needs. -- Bert On Sat, Jun 1, 2024 at 9:16 AM Leo Mada via R-help mailto:r-help@r-project.org>> wrote: Dear R-Users, Are there any packages that enable the modifications of highlighted areas / annotations in pdf documents? It seems feasible - I have explored some R code (see below). However, I would rather avoid to reinvent the wheel. The problem: When highlighting pdf-documents with Microsoft Edge, the bounding box is sometimes misplaced, and quite ugly so. It also lacks the ability to draw lines or arrows. On the other hand, I did not get used to Acrobat Reader: it usually involves much more effort to add specific highlights. Lines can be drawn, but are NOT straight! Are there tools to change the size/position of highlights? Or to add highlights and underline words? Changing position/size manually by editing the data in the pdf-document is possible. Changing the color is more trickier (somehow possible in Microsoft Edger; though the direct approach to rewrite the actual stream is better). Maybe there are some tools to do it? Some R code is below. Sincerely, Leonard # library(zip) con = file("_some_pdf_.pdf", "rb") NL = 0 # - very dirty hack; # - assumes Annotations are in the last fragment/chunk; while(TRUE) { tmp = readBin(con, "raw", 1024*128 + 515); if(length(tmp) == 0) break; x = tmp; # isNL = (x == 10) | (x == 13); isNL = (x == 13); isNL = isNL & (x[which(isNL) + 1] == 10); NL = NL + sum(isNL); } close(con) idP = which(isNL) idS = 935; # will vary with pdf and Annotations and ...; nLast = 4; # usually 2 chunks idx = idP[seq(idS, length.out = nLast)] # Check: Right position? # tmp = x[seq(idx[1] + 2, idx[1 + 2] - 1)] # intToUtf8(tmp) tmp = inflate(x[seq(idx[1] + 2, idx[nLast] - 1)]) intToUtf8(tmp$output) # Output of inflate: an Example # "/GS gs .56078434 .87058824 .97647059 rg\n # 337.298 183.836 m 364.322 183.836 l 364.322 171.83 l 337.298 171.83 l h f\n" # Note: /BBox[ 337.298 171.83 364.322 183.836] The raw pdf data: 1948 0 obj <>/C[ 0.560784 0.870588 0.976471]/CA 1/F 4/PDFIUM_HasGeneratedAP true/QuadPoints[ 337.298 186 364.322 186 337.298 174.6 364.322 174.6]/Rect[ 337.298 174.6 364.322 186]/Subtype/Highlight/Type/Annot>> endobj 1949 0 obj <>>>>>/Subtype/Form/Type/XObject>>stream xœE˱ €0 Àž)~ “ä Û™€ Ø P@ ûKˆ"Оtó²¢ß jÉC© ðT#ŠBš›zª WŸH—Ò 9(Aà š Kùäøų _ iÀŽmz dR ² endstream endobj [[alternative HTML version deleted]] __ R-help@r-project.org<mailto: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. [[alternative HTML version deleted]] __ 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] Tools to modify highlighted areas in pdf documents?
Search! on rseek.org, the query "modify pdf documents in R" brought up the staplr package. A quick web search with the same query brought up the pdftools package. These were cursory efforts, so you may well find more. You will have to determine whether and to what degree any meet your needs. -- Bert On Sat, Jun 1, 2024 at 9:16 AM Leo Mada via R-help wrote: > Dear R-Users, > > Are there any packages that enable the modifications of highlighted areas > / annotations in pdf documents? > > It seems feasible - I have explored some R code (see below). However, I > would rather avoid to reinvent the wheel. > > The problem: > When highlighting pdf-documents with Microsoft Edge, the bounding box is > sometimes misplaced, and quite ugly so. It also lacks the ability to draw > lines or arrows. > > On the other hand, I did not get used to Acrobat Reader: it usually > involves much more effort to add specific highlights. Lines can be drawn, > but are NOT straight! > > Are there tools to change the size/position of highlights? > Or to add highlights and underline words? > Changing position/size manually by editing the data in the pdf-document > is possible. Changing the color is more trickier (somehow possible in > Microsoft Edger; though the direct approach to rewrite the actual stream is > better). Maybe there are some tools to do it? > > Some R code is below. > > Sincerely, > > Leonard > # > > library(zip) > > con = file("_some_pdf_.pdf", "rb") > > NL = 0 > # - very dirty hack; > # - assumes Annotations are in the last fragment/chunk; > while(TRUE) { > tmp = readBin(con, "raw", 1024*128 + 515); > if(length(tmp) == 0) break; > x = tmp; > # isNL = (x == 10) | (x == 13); > isNL = (x == 13); > isNL = isNL & (x[which(isNL) + 1] == 10); > NL = NL + sum(isNL); > } > > close(con) > > idP = which(isNL) > > idS = 935; # will vary with pdf and Annotations and ...; > nLast = 4; # usually 2 chunks > idx = idP[seq(idS, length.out = nLast)] > > # Check: Right position? > # tmp = x[seq(idx[1] + 2, idx[1 + 2] - 1)] > # intToUtf8(tmp) > > tmp = inflate(x[seq(idx[1] + 2, idx[nLast] - 1)]) > intToUtf8(tmp$output) > > # Output of inflate: an Example > # "/GS gs .56078434 .87058824 .97647059 rg\n > # 337.298 183.836 m 364.322 183.836 l 364.322 171.83 l 337.298 171.83 l h > f\n" > > # Note: /BBox[ 337.298 171.83 364.322 183.836] > > The raw pdf data: > > 1948 0 obj > <>/C[ 0.560784 0.870588 0.976471]/CA 1/F > 4/PDFIUM_HasGeneratedAP true/QuadPoints[ 337.298 186 364.322 186 337.298 > 174.6 364.322 174.6]/Rect[ 337.298 174.6 364.322 > 186]/Subtype/Highlight/Type/Annot>> > endobj > 1949 0 obj > < 1/Length 86/Matrix[ 1 0 0 1 0 0]/Resources< false/BM/Multiply/CA 1/Type/ExtGState/ca > 1>>>>>>/Subtype/Form/Type/XObject>>stream > xœE˱ > €0 Àž)~ “ä Û™€ Ø P@ ûKˆ"Оtó²¢ß jÉC© ðT#ŠBš›zª > WŸH—Ò 9(Aà š > Kùäøų _ iÀŽmz dR ² > endstream > endobj > > > [[alternative HTML version deleted]] > > __________ > 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. > [[alternative HTML version deleted]] __ 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] Tools to modify highlighted areas in pdf documents?
Dear R-Users, Are there any packages that enable the modifications of highlighted areas / annotations in pdf documents? It seems feasible - I have explored some R code (see below). However, I would rather avoid to reinvent the wheel. The problem: When highlighting pdf-documents with Microsoft Edge, the bounding box is sometimes misplaced, and quite ugly so. It also lacks the ability to draw lines or arrows. On the other hand, I did not get used to Acrobat Reader: it usually involves much more effort to add specific highlights. Lines can be drawn, but are NOT straight! Are there tools to change the size/position of highlights? Or to add highlights and underline words? Changing position/size manually by editing the data in the pdf-document is possible. Changing the color is more trickier (somehow possible in Microsoft Edger; though the direct approach to rewrite the actual stream is better). Maybe there are some tools to do it? Some R code is below. Sincerely, Leonard # library(zip) con = file("_some_pdf_.pdf", "rb") NL = 0 # - very dirty hack; # - assumes Annotations are in the last fragment/chunk; while(TRUE) { tmp = readBin(con, "raw", 1024*128 + 515); if(length(tmp) == 0) break; x = tmp; # isNL = (x == 10) | (x == 13); isNL = (x == 13); isNL = isNL & (x[which(isNL) + 1] == 10); NL = NL + sum(isNL); } close(con) idP = which(isNL) idS = 935; # will vary with pdf and Annotations and ...; nLast = 4; # usually 2 chunks idx = idP[seq(idS, length.out = nLast)] # Check: Right position? # tmp = x[seq(idx[1] + 2, idx[1 + 2] - 1)] # intToUtf8(tmp) tmp = inflate(x[seq(idx[1] + 2, idx[nLast] - 1)]) intToUtf8(tmp$output) # Output of inflate: an Example # "/GS gs .56078434 .87058824 .97647059 rg\n # 337.298 183.836 m 364.322 183.836 l 364.322 171.83 l 337.298 171.83 l h f\n" # Note: /BBox[ 337.298 171.83 364.322 183.836] The raw pdf data: 1948 0 obj <>/C[ 0.560784 0.870588 0.976471]/CA 1/F 4/PDFIUM_HasGeneratedAP true/QuadPoints[ 337.298 186 364.322 186 337.298 174.6 364.322 174.6]/Rect[ 337.298 174.6 364.322 186]/Subtype/Highlight/Type/Annot>> endobj 1949 0 obj <>>>>>/Subtype/Form/Type/XObject>>stream xœE˱ €0 Àž)~“äÛ™€ØP@ûKˆ"Оtó²¢ßjÉC©ðT#ŠBš›zª WŸH—Ò9(Aà š Kùäøų_iÀŽmz dR² endstream endobj [[alternative HTML version deleted]] __ 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] [Rd] R 4.4.1 scheduled for June 14
Full schedule is available on developer.r-project.org (pending update from SVN). -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ r-de...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel ___ r-annou...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ 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] add only the 1st of May with POSIXct
Às 07:01 de 29/05/2024, Stefano Sofia escreveu: Thank you Rui for your code. I basically understood all your suggestions. I am using an old version of R (version 3.6.3, installed in a server I am not allowed to control), and the new pipe operator does not work. I tried to run your code without the "|>" operator, but I get an error when I use apply. Could you please expand your code without the pipe operator? Thank you again for your help Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@regione.marche.it ---Oo-oO Da: Rui Barradas Inviato: martedì 28 maggio 2024 18:19 A: Stefano Sofia; r-help@R-project.org Oggetto: Re: [R] add only the 1st of May with POSIXct [Non ricevi spesso messaggi di posta elettronica da ruipbarra...@sapo.pt. Per informazioni sull'importanza di questo fatto, visita https://aka.ms/LearnAboutSenderIdentification.] Às 16:23 de 28/05/2024, Stefano Sofia escreveu: Dear R-list users, From an initial and a final date I create a sequence of days using POSIXct. If this interval covers all or only in part the months from May to October, I need to get rid of the days from the 2nd of May to the 31st of October: a <- as.POSIXct("2002-11-01", format = "%Y-%m-%d", tz="Etc/GMT-1") b <- as.POSIXct("2004-06-01", format = "%Y-%m-%d", tz="Etc/GMT-1") mydf <- data.frame(data_POSIX=seq(as.POSIXct(paste(format(a, "%Y-%m-%d"), "09:00:00", sep=""), format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1"), as.POSIXct(paste(format(b, "%Y-%m-%d"), "09:00:00", sep=""), format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1"), by="1 day")) If I execute as.data.frame(mydf[format(mydf$data_POSIX,"%m") %in% c("11", "12", "01", "02", "03", "04"), ]) the interval will be from 2002-11-01 09:00:00 to 2003-04-30 09:00:00 and from 2003-11-01 09:00:00 to 2004-04-30 09:00:00 but I need also 2003-05-01 09:00:00 and 2004-05-01 09:00:00 How can I solve this problem? Thank you for your attention and your help Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@regione.marche.it ---Oo-oO AVVISO IMPORTANTE: Questo messaggio di posta elettronica pu� contenere informazioni confidenziali, pertanto � destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si � il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si � ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell'art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessit� ed urgenza, la risposta al presente messaggio di posta elettronica pu� essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help=05%7C02%7Cstefano.sofia%40regione.marche.it%7C0d812d3223344a1508d408dc7f31f657%7C295eaa1431a14b09bfe65a338b679f60%7C0%7C0%7C638525100275684754%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C6%7C%7C%7C=ac0Hx9auMSeXgsllDaaimZDFBpSLZ%2B3OeOGQoVvcjxQ%3D=0 PLEASE do read the posting guide https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html=05%7C02%7Cstefano.sofia%40regione.marche.it%7C0d812d3223344a1508d408dc7f31f657%7C295eaa1431a14b09bfe65a338b679f60%7C0%7C0%7C638525100275684754%7CUnknown%7CTWFpbGZs
Re: [R] add only the 1st of May with POSIXct
On Tue, 28 May 2024, Stefano Sofia writes: > Dear R-list users, > > From an initial and a final date I create a sequence of days using POSIXct. > > If this interval covers all or only in part the months from May to October, I > need to get rid of the days from the 2nd of May to the 31st of October: > > > a <- as.POSIXct("2002-11-01", format = "%Y-%m-%d", tz="Etc/GMT-1") > > b <- as.POSIXct("2004-06-01", format = "%Y-%m-%d", tz="Etc/GMT-1") > > mydf <- data.frame(data_POSIX=seq(as.POSIXct(paste(format(a, "%Y-%m-%d"), > "09:00:00", sep=""), format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1"), > as.POSIXct(paste(format(b, "%Y-%m-%d"), "09:00:00", sep=""), format="%Y-%m-%d > %H:%M:%S", tz="Etc/GMT-1"), by="1 day")) > > > If I execute > > as.data.frame(mydf[format(mydf$data_POSIX,"%m") %in% c("11", "12", "01", > "02", "03", "04"), ]) > > the interval will be > > from 2002-11-01 09:00:00 to 2003-04-30 09:00:00 > > and from 2003-11-01 09:00:00 to 2004-04-30 09:00:00 > > > but I need also 2003-05-01 09:00:00 and 2004-05-01 09:00:00 > > > How can I solve this problem? > > > Thank you for your attention and your help > > Stefano > I think this could be simplified a bit: a <- as.POSIXct("2002-11-01 09", format = "%Y-%m-%d %H", tz="Etc/GMT-1") b <- as.POSIXct("2004-06-01 09", format = "%Y-%m-%d %H", tz="Etc/GMT-1") Create your sequence: S <- seq(a, b , by = "1 day") month.day <- format(S, "%m-%d") Now subset S for those days that you want: S[month.day <= "05-01" | month.day > "10-31"] -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net __ 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] add only the 1st of May with POSIXct
Thank you Rui for your code. I basically understood all your suggestions. I am using an old version of R (version 3.6.3, installed in a server I am not allowed to control), and the new pipe operator does not work. I tried to run your code without the "|>" operator, but I get an error when I use apply. Could you please expand your code without the pipe operator? Thank you again for your help Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@regione.marche.it ---Oo-oO Da: Rui Barradas Inviato: martedì 28 maggio 2024 18:19 A: Stefano Sofia; r-help@R-project.org Oggetto: Re: [R] add only the 1st of May with POSIXct [Non ricevi spesso messaggi di posta elettronica da ruipbarra...@sapo.pt. Per informazioni sull'importanza di questo fatto, visita https://aka.ms/LearnAboutSenderIdentification.] Às 16:23 de 28/05/2024, Stefano Sofia escreveu: > Dear R-list users, > > From an initial and a final date I create a sequence of days using POSIXct. > > If this interval covers all or only in part the months from May to October, I > need to get rid of the days from the 2nd of May to the 31st of October: > > > a <- as.POSIXct("2002-11-01", format = "%Y-%m-%d", tz="Etc/GMT-1") > > b <- as.POSIXct("2004-06-01", format = "%Y-%m-%d", tz="Etc/GMT-1") > > mydf <- data.frame(data_POSIX=seq(as.POSIXct(paste(format(a, "%Y-%m-%d"), > "09:00:00", sep=""), format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1"), > as.POSIXct(paste(format(b, "%Y-%m-%d"), "09:00:00", sep=""), format="%Y-%m-%d > %H:%M:%S", tz="Etc/GMT-1"), by="1 day")) > > > If I execute > > as.data.frame(mydf[format(mydf$data_POSIX,"%m") %in% c("11", "12", "01", > "02", "03", "04"), ]) > > the interval will be > > from 2002-11-01 09:00:00 to 2003-04-30 09:00:00 > > and from 2003-11-01 09:00:00 to 2004-04-30 09:00:00 > > > but I need also 2003-05-01 09:00:00 and 2004-05-01 09:00:00 > > > How can I solve this problem? > > > Thank you for your attention and your help > > Stefano > > > > (oo) > --oOO--( )--OOo-- > Stefano Sofia PhD > Civil Protection - Marche Region - Italy > Meteo Section > Snow Section > Via del Colle Ameno 5 > 60126 Torrette di Ancona, Ancona (AN) > Uff: +39 071 806 7743 > E-mail: stefano.so...@regione.marche.it > ---Oo-oO > > > > AVVISO IMPORTANTE: Questo messaggio di posta elettronica pu� contenere > informazioni confidenziali, pertanto � destinato solo a persone autorizzate > alla ricezione. I messaggi di posta elettronica per i client di Regione > Marche possono contenere informazioni confidenziali e con privilegi legali. > Se non si � il destinatario specificato, non leggere, copiare, inoltrare o > archiviare questo messaggio. Se si � ricevuto questo messaggio per errore, > inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio > computer. Ai sensi dell'art. 6 della DGR n. 1394/2008 si segnala che, in caso > di necessit� ed urgenza, la risposta al presente messaggio di posta > elettronica pu� essere visionata da persone estranee al destinatario. > IMPORTANT NOTICE: This e-mail message is intended to be received only by > persons entitled to receive the confidential information it may contain. > E-mail messages to clients of Regione Marche may contain information that is > confidential and legally privileged. Please do not read, copy, forward, or > store this message unless you are an intended recipient of it. If you have > received this message in error, please forward it to the sender and delete it > completely from your computer system. > > [[alternative HTML version deleted]] > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help=05%7C02%7Cstefano.sofia%40regione.marche.it%7C0d812d3223344a1508d408dc7f31f657%7C295eaa1431a14b09bfe65a338b679f60%7C0%7C0%7C638525100275684754%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C6%7C%7C%7C=ac0Hx9auMSeXgsllDaaimZDFBpSLZ%2B3
Re: [R] add only the 1st of May with POSIXct
Às 16:23 de 28/05/2024, Stefano Sofia escreveu: Dear R-list users, From an initial and a final date I create a sequence of days using POSIXct. If this interval covers all or only in part the months from May to October, I need to get rid of the days from the 2nd of May to the 31st of October: a <- as.POSIXct("2002-11-01", format = "%Y-%m-%d", tz="Etc/GMT-1") b <- as.POSIXct("2004-06-01", format = "%Y-%m-%d", tz="Etc/GMT-1") mydf <- data.frame(data_POSIX=seq(as.POSIXct(paste(format(a, "%Y-%m-%d"), "09:00:00", sep=""), format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1"), as.POSIXct(paste(format(b, "%Y-%m-%d"), "09:00:00", sep=""), format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1"), by="1 day")) If I execute as.data.frame(mydf[format(mydf$data_POSIX,"%m") %in% c("11", "12", "01", "02", "03", "04"), ]) the interval will be from 2002-11-01 09:00:00 to 2003-04-30 09:00:00 and from 2003-11-01 09:00:00 to 2004-04-30 09:00:00 but I need also 2003-05-01 09:00:00 and 2004-05-01 09:00:00 How can I solve this problem? Thank you for your attention and your help Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@regione.marche.it ---Oo-oO AVVISO IMPORTANTE: Questo messaggio di posta elettronica pu� contenere informazioni confidenziali, pertanto � destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si � il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si � ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell'art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessit� ed urgenza, la risposta al presente messaggio di posta elettronica pu� essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. [[alternative HTML version deleted]] __ 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, First of all, 'a' and 'b' are already objects of class "POSIXct", you don't need to repeat the code creating them when creating mydf. As for the question, see the code below. a <- as.POSIXct("2002-11-01", format = "%Y-%m-%d", tz="Etc/GMT-1") b <- as.POSIXct("2004-06-01", format = "%Y-%m-%d", tz="Etc/GMT-1") mydf <- data.frame(data_POSIX = seq(a, b, by = "1 day")) # get the years from the data years <- format(c(a, b), "%Y") |> as.integer() # this creates a sequence with all the years years <- Reduce(`:`, years) # coerce to "Date" from <- ISOdate(years, 5L, 2L, tz = "Etc/GMT-1") to <- ISOdate(years, 10L, 30L, tz = "Etc/GMT-1") # this logical index keeps only the dates between May, 2nd and Nov 1st. keep <- data.frame(from, to) |> apply(1L, \(x) x[1L] <= mydf$data_POSIX & mydf$data_POSIX <= x[2L]) |> rowSums() > 0L mydf[keep, , drop = FALSE] Hope this helps, Rui Barradas -- Este e-mail foi analisado pelo software antivírus AVG para verificar a presença de vírus. www.avg.com __ 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] add only the 1st of May with POSIXct
Dear R-list users, >From an initial and a final date I create a sequence of days using POSIXct. If this interval covers all or only in part the months from May to October, I need to get rid of the days from the 2nd of May to the 31st of October: a <- as.POSIXct("2002-11-01", format = "%Y-%m-%d", tz="Etc/GMT-1") b <- as.POSIXct("2004-06-01", format = "%Y-%m-%d", tz="Etc/GMT-1") mydf <- data.frame(data_POSIX=seq(as.POSIXct(paste(format(a, "%Y-%m-%d"), "09:00:00", sep=""), format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1"), as.POSIXct(paste(format(b, "%Y-%m-%d"), "09:00:00", sep=""), format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1"), by="1 day")) If I execute as.data.frame(mydf[format(mydf$data_POSIX,"%m") %in% c("11", "12", "01", "02", "03", "04"), ]) the interval will be from 2002-11-01 09:00:00 to 2003-04-30 09:00:00 and from 2003-11-01 09:00:00 to 2004-04-30 09:00:00 but I need also 2003-05-01 09:00:00 and 2004-05-01 09:00:00 How can I solve this problem? Thank you for your attention and your help Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@regione.marche.it ---Oo-oO AVVISO IMPORTANTE: Questo messaggio di posta elettronica pu� contenere informazioni confidenziali, pertanto � destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si � il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si � ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell'art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessit� ed urgenza, la risposta al presente messaggio di posta elettronica pu� essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. [[alternative HTML version deleted]] __ 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] Can someone please have a look at my query on stackoverflow ?
Dear Uwe and others, Here is my query: I am looking for a function which can:- take a seasonal ARMA model and return :- the spectrum of the seasonal ARMA model. I have seen: library(astsa) ?arma.spec However it's a bit clumsy to use arma.spec when my model has seasonal ar / ma terms. For example (from the help page of arma.spec) we have that, we may compute the spectrum of a seasonal AR model like this: Notice: How we have a seasonal AR term of order one, which is being fed to arma.spec by converting the seasonal lag to a non-seasonal lag: arma.spec(ar=c(rep(0,11),.4), ma=.5, col=5, lwd=3, frequency=12) I will illustrate my difficulty as follows: > plot(AirPassengers) > auto.arima(log(AirPassengers)) Series: log(AirPassengers) ARIMA(0,1,1)(0,1,1)[12] Coefficients: ma1 sma1 -0.4018 -0.5569 s.e. 0.0896 0.0731 sigma^2 = 0.001371: log likelihood = 244.7 AIC=-483.4 AICc=-483.21 BIC=-474.77 I do not know how to programmatically feed the above model to arma.spec. I have tried: auto.arima(log(AirPassengers))$coef arma.spec(auto.arima(log(AirPassengers))$coef,frequency=12) I manually convert the seasonal MA to non-seasonal MA model and give it to arma.spec and I get a different picture. arma.spec(ma=c(-.4,rep(0,10),-.55)) Hence I conclude that arma.spec does not understand seasonal models. Query : How can I conveniently plot the spectrum of a seasonal ARMA process ? Note : I wonder if there is a library which converts seasonal model to non-seasonal model which perhaps can then be used with arma.spec. Many thanks, Ashim On Tue, May 28, 2024 at 12:28 PM Uwe Ligges wrote: > > > > On 28.05.2024 06:41, Ashim Kapoor wrote: > > Dear Sir, > > > > OK. I will migrate this query to stats.stackexchange.com. > > In any case, if you ask on the list, the question should be on the list. > Personally, I do read mails, but rather not websites. > > Best, > Uwe Ligges > > > > > > > > Best, > > Ashim > > > > > > On Mon, May 27, 2024 at 8:28 PM David Winsemius > > wrote: > >> > >> If I had seen that post before it got a bounty, I would have voted to > >> migrate it to https://stats.stackexchange.com since it is a request for > >> advice on methods as well as an implicit request for a package > >> recommendation. > >> > >> — > >> David > >> Sent from my iPhone > >> > >>> On May 27, 2024, at 5:40 AM, Ashim Kapoor wrote: > >>> > >>> Dear experts, > >>> > >>> I am having difficulty with computing spectrum of seasonal ARMA models. > >>> > >>> My query is posted here : > >>> > >>> https://stackoverflow.com/questions/78526800/computing-the-spectrum-of-a-seasonal-model-in-r > >>> > >>> Will be grateful if someone has a look at it and responds. > >>> > >>> Many thanks, > >>> Ashim. > >>> > >>> [[alternative HTML version deleted]] > >>> > >>> __ > >>> 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-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-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] Can someone please have a look at my query on stackoverflow ?
On 28.05.2024 06:41, Ashim Kapoor wrote: Dear Sir, OK. I will migrate this query to stats.stackexchange.com. In any case, if you ask on the list, the question should be on the list. Personally, I do read mails, but rather not websites. Best, Uwe Ligges Best, Ashim On Mon, May 27, 2024 at 8:28 PM David Winsemius wrote: If I had seen that post before it got a bounty, I would have voted to migrate it to https://stats.stackexchange.com since it is a request for advice on methods as well as an implicit request for a package recommendation. — David Sent from my iPhone On May 27, 2024, at 5:40 AM, Ashim Kapoor wrote: Dear experts, I am having difficulty with computing spectrum of seasonal ARMA models. My query is posted here : https://stackoverflow.com/questions/78526800/computing-the-spectrum-of-a-seasonal-model-in-r Will be grateful if someone has a look at it and responds. Many thanks, Ashim. [[alternative HTML version deleted]] __ 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-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-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] Can someone please have a look at my query on stackoverflow ?
Dear Sir, OK. I will migrate this query to stats.stackexchange.com. Best, Ashim On Mon, May 27, 2024 at 8:28 PM David Winsemius wrote: > > If I had seen that post before it got a bounty, I would have voted to migrate > it to https://stats.stackexchange.com since it is a request for advice on > methods as well as an implicit request for a package recommendation. > > — > David > Sent from my iPhone > > > On May 27, 2024, at 5:40 AM, Ashim Kapoor wrote: > > > > Dear experts, > > > > I am having difficulty with computing spectrum of seasonal ARMA models. > > > > My query is posted here : > > > > https://stackoverflow.com/questions/78526800/computing-the-spectrum-of-a-seasonal-model-in-r > > > > Will be grateful if someone has a look at it and responds. > > > > Many thanks, > > Ashim. > > > >[[alternative HTML version deleted]] > > > > __ > > 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-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] Issues with R's forecast function
Dear Sarah, I installed the latest R version available (4.4.0), installed the forecast package and related packages from scratch and the issue was resolved. Kind regards, Paul El lun, 27 may 2024 a las 13:51, Sarah Goslee () escribió: > Hi Paul, > > Looking at this, you aren't running the most recent version of forecast. > > If I were having a problem of this sort, I'd update R (if you can), > run update.packages() and then try again with a minimal set of > packages. As one of the other responses suggested, you probably have > mismatched versions of packages with dependencies. > > Sarah > > On Mon, May 27, 2024 at 2:48 PM Paul Bernal > wrote: > > > > Dear Sarah, > > > > Here is the sessionInfo() output, I forgot to include it in my reply. > > > > sessionInfo() > > R version 4.3.2 (2023-10-31 ucrt) > > Platform: x86_64-w64-mingw32/x64 (64-bit) > > Running under: Windows 11 x64 (build 22631) > > > > Matrix products: default > > > > > > locale: > > [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United > States.utf8 > > [3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C > > [5] LC_TIME=English_United States.utf8 > > > > time zone: America/Bogota > > tzcode source: internal > > > > attached base packages: > > [1] parallel grid stats4stats graphics grDevices utils >datasets methods base > > > > other attached packages: > > [1] mvgam_1.1.1insight_0.19.7 > marginaleffects_0.20.1 brms_2.21.0 > > [5] mgcv_1.9-0 nlme_3.1-163 gbm_2.1.9 > yardstick_1.3.1 > > [9] workflowsets_1.1.0 workflows_1.1.4tune_1.2.1 > rsample_1.2.1 > > [13] recipes_1.0.10 parsnip_1.2.1 modeldata_1.3.0 > infer_1.0.7 > > [17] dials_1.2.1scales_1.3.0 broom_1.0.5 > tidymodels_1.2.0 > > [21] ggthemes_5.1.0 janitor_2.2.0 tictoc_1.2.1 > Ckmeans.1d.dp_4.3.5 > > [25] magrittr_2.0.3 data.table_1.14.10 reticulate_1.34.0 > tensorflow_2.15.0 > > [29] keras_2.13.0 matlabr_1.5.2 R.matlab_3.7.0 > distrMod_2.9.1 > > [33] RandVar_1.2.3 distrEx_2.9.2 distr_2.9.3 > sfsmisc_1.1-17 > > [37] startupmsg_0.9.6.1 qcc_2.7pdp_0.8.1 > doParallel_1.0.17 > > [41] iterators_1.0.14 foreach_1.5.2 tsintermittent_1.10 > ivreg_0.6-2 > > [45] vars_1.6-0 urca_1.3-3 strucchange_1.5-3 > Amelia_1.8.1 > > [49] Rcpp_1.0.12VIM_6.2.2 colorspace_2.1-0 > mi_1.1 > > [53] Hmisc_5.1-1missForest_1.5 mice_3.16.0 > gghighlight_0.4.1 > > [57] caret_6.0-94 lattice_0.21-9 xgboost_1.7.7.1 > smooth_4.0.0 > > [61] e1071_1.7-14 greybox_2.0.0 rio_1.0.1 > fitdistrplus_1.1-11 > > [65] AER_1.2-12 survival_3.5-7 sandwich_3.1-0 > lmtest_0.9-40 > > [69] zoo_1.8-12 car_3.1-2 carData_3.0-5 > forcats_1.0.0 > > [73] stringr_1.5.1 purrr_1.0.2readr_2.1.5 > tidyr_1.3.1 > > [77] tibble_3.2.1 tidyverse_2.0.0dplyr_1.1.4 > Metrics_0.1.4 > > [81] corrgram_1.14 corrplot_0.92 readxl_1.4.3 > glmnet_4.1-8 > > [85] Matrix_1.6-1.1 MASS_7.3-60.0.1actuar_3.3-4 > neuralnet_1.44.2 > > [89] nnfor_0.9.9generics_0.1.3 ggplot2_3.5.1 > lubridate_1.9.3 > > [93] tseries_0.10-55forecast_8.21.1 > > > > loaded via a namespace (and not attached): > > [1] matrixStats_1.3.0DiceDesign_1.10 httr_1.4.7 > RColorBrewer_1.1-3 tools_4.3.2 > > [6] doRNG_1.8.6 backports_1.4.1 utf8_1.2.4 > R6_2.5.1 jomo_2.7-6 > > [11] withr_3.0.0 sp_2.1-3 Brobdingnag_1.2-9 > gridExtra_2.3cli_3.6.2 > > [16] labeling_0.4.3 tsutils_0.9.4mvtnorm_1.2-4 > robustbase_0.99-2randomForest_4.7-1.1 > > [21] proxy_0.4-27 QuickJSR_1.1.3 StanHeaders_2.32.7 > foreign_0.8-85 R.utils_2.12.3 > > [26] parallelly_1.36.0scoringRules_1.1.1 itertools_0.1-3 > TTR_0.24.4 rstudioapi_0.16.0 > > [31] shape_1.4.6 distributional_0.4.0 inline_0.3.19 > loo_2.7.0fansi_1.0.6 > > [36] abind_1.4-5 R.methodsS3_1.8.2lifecycle_1.0.4 > multcomp_1.4-25 whisker_0.4.1 > > [41] snakecase_0.11.1 crayon_1.5.2 mitml_0.4-5 > zeallot_0.1.0pillar_1.9.0 > > [46] knitr_1.45 boot_1.3-28.1estimability_
Re: [R] Issues with R's forecast function
Hi Sarah, I ran update.packages, reloaded the forecast package, but kept on getting the same errors. I am going to install the latest R version (4.4.0), as I was using version 4.3.2 and reinstall the package. Cheers, Paul El lun, 27 may 2024 a las 13:51, Sarah Goslee () escribió: > Hi Paul, > > Looking at this, you aren't running the most recent version of forecast. > > If I were having a problem of this sort, I'd update R (if you can), > run update.packages() and then try again with a minimal set of > packages. As one of the other responses suggested, you probably have > mismatched versions of packages with dependencies. > > Sarah > > On Mon, May 27, 2024 at 2:48 PM Paul Bernal > wrote: > > > > Dear Sarah, > > > > Here is the sessionInfo() output, I forgot to include it in my reply. > > > > sessionInfo() > > R version 4.3.2 (2023-10-31 ucrt) > > Platform: x86_64-w64-mingw32/x64 (64-bit) > > Running under: Windows 11 x64 (build 22631) > > > > Matrix products: default > > > > > > locale: > > [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United > States.utf8 > > [3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C > > [5] LC_TIME=English_United States.utf8 > > > > time zone: America/Bogota > > tzcode source: internal > > > > attached base packages: > > [1] parallel grid stats4stats graphics grDevices utils >datasets methods base > > > > other attached packages: > > [1] mvgam_1.1.1insight_0.19.7 > marginaleffects_0.20.1 brms_2.21.0 > > [5] mgcv_1.9-0 nlme_3.1-163 gbm_2.1.9 > yardstick_1.3.1 > > [9] workflowsets_1.1.0 workflows_1.1.4tune_1.2.1 > rsample_1.2.1 > > [13] recipes_1.0.10 parsnip_1.2.1 modeldata_1.3.0 > infer_1.0.7 > > [17] dials_1.2.1scales_1.3.0 broom_1.0.5 > tidymodels_1.2.0 > > [21] ggthemes_5.1.0 janitor_2.2.0 tictoc_1.2.1 > Ckmeans.1d.dp_4.3.5 > > [25] magrittr_2.0.3 data.table_1.14.10 reticulate_1.34.0 > tensorflow_2.15.0 > > [29] keras_2.13.0 matlabr_1.5.2 R.matlab_3.7.0 > distrMod_2.9.1 > > [33] RandVar_1.2.3 distrEx_2.9.2 distr_2.9.3 > sfsmisc_1.1-17 > > [37] startupmsg_0.9.6.1 qcc_2.7pdp_0.8.1 > doParallel_1.0.17 > > [41] iterators_1.0.14 foreach_1.5.2 tsintermittent_1.10 > ivreg_0.6-2 > > [45] vars_1.6-0 urca_1.3-3 strucchange_1.5-3 > Amelia_1.8.1 > > [49] Rcpp_1.0.12VIM_6.2.2 colorspace_2.1-0 > mi_1.1 > > [53] Hmisc_5.1-1missForest_1.5 mice_3.16.0 > gghighlight_0.4.1 > > [57] caret_6.0-94 lattice_0.21-9 xgboost_1.7.7.1 > smooth_4.0.0 > > [61] e1071_1.7-14 greybox_2.0.0 rio_1.0.1 > fitdistrplus_1.1-11 > > [65] AER_1.2-12 survival_3.5-7 sandwich_3.1-0 > lmtest_0.9-40 > > [69] zoo_1.8-12 car_3.1-2 carData_3.0-5 > forcats_1.0.0 > > [73] stringr_1.5.1 purrr_1.0.2readr_2.1.5 > tidyr_1.3.1 > > [77] tibble_3.2.1 tidyverse_2.0.0dplyr_1.1.4 > Metrics_0.1.4 > > [81] corrgram_1.14 corrplot_0.92 readxl_1.4.3 > glmnet_4.1-8 > > [85] Matrix_1.6-1.1 MASS_7.3-60.0.1actuar_3.3-4 > neuralnet_1.44.2 > > [89] nnfor_0.9.9generics_0.1.3 ggplot2_3.5.1 > lubridate_1.9.3 > > [93] tseries_0.10-55forecast_8.21.1 > > > > loaded via a namespace (and not attached): > > [1] matrixStats_1.3.0DiceDesign_1.10 httr_1.4.7 > RColorBrewer_1.1-3 tools_4.3.2 > > [6] doRNG_1.8.6 backports_1.4.1 utf8_1.2.4 > R6_2.5.1 jomo_2.7-6 > > [11] withr_3.0.0 sp_2.1-3 Brobdingnag_1.2-9 > gridExtra_2.3cli_3.6.2 > > [16] labeling_0.4.3 tsutils_0.9.4mvtnorm_1.2-4 > robustbase_0.99-2randomForest_4.7-1.1 > > [21] proxy_0.4-27 QuickJSR_1.1.3 StanHeaders_2.32.7 > foreign_0.8-85 R.utils_2.12.3 > > [26] parallelly_1.36.0scoringRules_1.1.1 itertools_0.1-3 > TTR_0.24.4 rstudioapi_0.16.0 > > [31] shape_1.4.6 distributional_0.4.0 inline_0.3.19 > loo_2.7.0fansi_1.0.6 > > [36] abind_1.4-5 R.methodsS3_1.8.2lifecycle_1.0.4 > multcomp_1.4-25 whisker_0.4.1 > > [41] snakecase_0.11.1 crayon_1.5.2 mitml_0.4-5 > zeallot_0.1.0pillar_1.9.0 > > [46] k
Re: [R] Issues with R's forecast function
Hi Paul, Looking at this, you aren't running the most recent version of forecast. If I were having a problem of this sort, I'd update R (if you can), run update.packages() and then try again with a minimal set of packages. As one of the other responses suggested, you probably have mismatched versions of packages with dependencies. Sarah On Mon, May 27, 2024 at 2:48 PM Paul Bernal wrote: > > Dear Sarah, > > Here is the sessionInfo() output, I forgot to include it in my reply. > > sessionInfo() > R version 4.3.2 (2023-10-31 ucrt) > Platform: x86_64-w64-mingw32/x64 (64-bit) > Running under: Windows 11 x64 (build 22631) > > Matrix products: default > > > locale: > [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 > [3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C > [5] LC_TIME=English_United States.utf8 > > time zone: America/Bogota > tzcode source: internal > > attached base packages: > [1] parallel grid stats4stats graphics grDevices utils > datasets methods base > > other attached packages: > [1] mvgam_1.1.1insight_0.19.7 marginaleffects_0.20.1 > brms_2.21.0 > [5] mgcv_1.9-0 nlme_3.1-163 gbm_2.1.9 > yardstick_1.3.1 > [9] workflowsets_1.1.0 workflows_1.1.4tune_1.2.1 > rsample_1.2.1 > [13] recipes_1.0.10 parsnip_1.2.1 modeldata_1.3.0 > infer_1.0.7 > [17] dials_1.2.1scales_1.3.0 broom_1.0.5 > tidymodels_1.2.0 > [21] ggthemes_5.1.0 janitor_2.2.0 tictoc_1.2.1 > Ckmeans.1d.dp_4.3.5 > [25] magrittr_2.0.3 data.table_1.14.10 reticulate_1.34.0 > tensorflow_2.15.0 > [29] keras_2.13.0 matlabr_1.5.2 R.matlab_3.7.0 > distrMod_2.9.1 > [33] RandVar_1.2.3 distrEx_2.9.2 distr_2.9.3 > sfsmisc_1.1-17 > [37] startupmsg_0.9.6.1 qcc_2.7pdp_0.8.1 > doParallel_1.0.17 > [41] iterators_1.0.14 foreach_1.5.2 tsintermittent_1.10 > ivreg_0.6-2 > [45] vars_1.6-0 urca_1.3-3 strucchange_1.5-3 > Amelia_1.8.1 > [49] Rcpp_1.0.12VIM_6.2.2 colorspace_2.1-0 > mi_1.1 > [53] Hmisc_5.1-1missForest_1.5 mice_3.16.0 > gghighlight_0.4.1 > [57] caret_6.0-94 lattice_0.21-9 xgboost_1.7.7.1 > smooth_4.0.0 > [61] e1071_1.7-14 greybox_2.0.0 rio_1.0.1 > fitdistrplus_1.1-11 > [65] AER_1.2-12 survival_3.5-7 sandwich_3.1-0 > lmtest_0.9-40 > [69] zoo_1.8-12 car_3.1-2 carData_3.0-5 > forcats_1.0.0 > [73] stringr_1.5.1 purrr_1.0.2readr_2.1.5 > tidyr_1.3.1 > [77] tibble_3.2.1 tidyverse_2.0.0dplyr_1.1.4 > Metrics_0.1.4 > [81] corrgram_1.14 corrplot_0.92 readxl_1.4.3 > glmnet_4.1-8 > [85] Matrix_1.6-1.1 MASS_7.3-60.0.1actuar_3.3-4 > neuralnet_1.44.2 > [89] nnfor_0.9.9generics_0.1.3 ggplot2_3.5.1 > lubridate_1.9.3 > [93] tseries_0.10-55forecast_8.21.1 > > loaded via a namespace (and not attached): > [1] matrixStats_1.3.0DiceDesign_1.10 httr_1.4.7 > RColorBrewer_1.1-3 tools_4.3.2 > [6] doRNG_1.8.6 backports_1.4.1 utf8_1.2.4 R6_2.5.1 > jomo_2.7-6 > [11] withr_3.0.0 sp_2.1-3 Brobdingnag_1.2-9 > gridExtra_2.3cli_3.6.2 > [16] labeling_0.4.3 tsutils_0.9.4mvtnorm_1.2-4 > robustbase_0.99-2randomForest_4.7-1.1 > [21] proxy_0.4-27 QuickJSR_1.1.3 StanHeaders_2.32.7 > foreign_0.8-85 R.utils_2.12.3 > [26] parallelly_1.36.0scoringRules_1.1.1 itertools_0.1-3 > TTR_0.24.4 rstudioapi_0.16.0 > [31] shape_1.4.6 distributional_0.4.0 inline_0.3.19 > loo_2.7.0fansi_1.0.6 > [36] abind_1.4-5 R.methodsS3_1.8.2lifecycle_1.0.4 > multcomp_1.4-25 whisker_0.4.1 > [41] snakecase_0.11.1 crayon_1.5.2 mitml_0.4-5 > zeallot_0.1.0pillar_1.9.0 > [46] knitr_1.45 boot_1.3-28.1estimability_1.4.1 > future.apply_1.11.1 codetools_0.2-19 > [51] pan_1.9 glue_1.7.0 vcd_1.4-12 > vctrs_0.6.5 png_0.1-8 > [56] Rdpack_2.6 cellranger_1.1.0 gtable_0.3.4 > gower_1.0.1 xfun_0.41 > [61] rbibutils_2.2.16 prodlim_2023.08.28 MAPA_2.0.6
Re: [R] Issues with R's forecast function
Dear Sarah, Here is the sessionInfo() output, I forgot to include it in my reply. sessionInfo() R version 4.3.2 (2023-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22631) Matrix products: default locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 [3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C [5] LC_TIME=English_United States.utf8 time zone: America/Bogota tzcode source: internal attached base packages: [1] parallel grid stats4stats graphics grDevices utils datasets methods base other attached packages: [1] mvgam_1.1.1insight_0.19.7 marginaleffects_0.20.1 brms_2.21.0 [5] mgcv_1.9-0 nlme_3.1-163 gbm_2.1.9 yardstick_1.3.1 [9] workflowsets_1.1.0 workflows_1.1.4tune_1.2.1 rsample_1.2.1 [13] recipes_1.0.10 parsnip_1.2.1 modeldata_1.3.0 infer_1.0.7 [17] dials_1.2.1scales_1.3.0 broom_1.0.5 tidymodels_1.2.0 [21] ggthemes_5.1.0 janitor_2.2.0 tictoc_1.2.1 Ckmeans.1d.dp_4.3.5 [25] magrittr_2.0.3 data.table_1.14.10 reticulate_1.34.0 tensorflow_2.15.0 [29] keras_2.13.0 matlabr_1.5.2 R.matlab_3.7.0 distrMod_2.9.1 [33] RandVar_1.2.3 distrEx_2.9.2 distr_2.9.3 sfsmisc_1.1-17 [37] startupmsg_0.9.6.1 qcc_2.7pdp_0.8.1 doParallel_1.0.17 [41] iterators_1.0.14 foreach_1.5.2 tsintermittent_1.10 ivreg_0.6-2 [45] vars_1.6-0 urca_1.3-3 strucchange_1.5-3 Amelia_1.8.1 [49] Rcpp_1.0.12VIM_6.2.2 colorspace_2.1-0 mi_1.1 [53] Hmisc_5.1-1missForest_1.5 mice_3.16.0 gghighlight_0.4.1 [57] caret_6.0-94 lattice_0.21-9 xgboost_1.7.7.1 smooth_4.0.0 [61] e1071_1.7-14 greybox_2.0.0 rio_1.0.1 fitdistrplus_1.1-11 [65] AER_1.2-12 survival_3.5-7 sandwich_3.1-0 lmtest_0.9-40 [69] zoo_1.8-12 car_3.1-2 carData_3.0-5 forcats_1.0.0 [73] stringr_1.5.1 purrr_1.0.2readr_2.1.5 tidyr_1.3.1 [77] tibble_3.2.1 tidyverse_2.0.0dplyr_1.1.4 Metrics_0.1.4 [81] corrgram_1.14 corrplot_0.92 readxl_1.4.3 glmnet_4.1-8 [85] Matrix_1.6-1.1 MASS_7.3-60.0.1actuar_3.3-4 neuralnet_1.44.2 [89] nnfor_0.9.9generics_0.1.3 ggplot2_3.5.1 lubridate_1.9.3 [93] tseries_0.10-55forecast_8.21.1 loaded via a namespace (and not attached): [1] matrixStats_1.3.0DiceDesign_1.10 httr_1.4.7 RColorBrewer_1.1-3 tools_4.3.2 [6] doRNG_1.8.6 backports_1.4.1 utf8_1.2.4 R6_2.5.1 jomo_2.7-6 [11] withr_3.0.0 sp_2.1-3 Brobdingnag_1.2-9 gridExtra_2.3cli_3.6.2 [16] labeling_0.4.3 tsutils_0.9.4mvtnorm_1.2-4 robustbase_0.99-2randomForest_4.7-1.1 [21] proxy_0.4-27 QuickJSR_1.1.3 StanHeaders_2.32.7 foreign_0.8-85 R.utils_2.12.3 [26] parallelly_1.36.0scoringRules_1.1.1 itertools_0.1-3 TTR_0.24.4 rstudioapi_0.16.0 [31] shape_1.4.6 distributional_0.4.0 inline_0.3.19 loo_2.7.0fansi_1.0.6 [36] abind_1.4-5 R.methodsS3_1.8.2lifecycle_1.0.4 multcomp_1.4-25 whisker_0.4.1 [41] snakecase_0.11.1 crayon_1.5.2 mitml_0.4-5 zeallot_0.1.0pillar_1.9.0 [46] knitr_1.45 boot_1.3-28.1estimability_1.4.1 future.apply_1.11.1 codetools_0.2-19 [51] pan_1.9 glue_1.7.0 vcd_1.4-12 vctrs_0.6.5 png_0.1-8 [56] Rdpack_2.6 cellranger_1.1.0 gtable_0.3.4 gower_1.0.1 xfun_0.41 [61] rbibutils_2.2.16 prodlim_2023.08.28 MAPA_2.0.6 pracma_2.4.4 uroot_2.1-3 [66] coda_0.19-4.1timeDate_4032.109hardhat_1.3.1 lava_1.7.3 statmod_1.5.0 [71] TH.data_1.1-2ipred_0.9-14 xts_0.13.1 rstan_2.32.6 tensorA_0.36.2.1 [76] rpart_4.1.21 nnet_7.3-19 tidyselect_1.2.0 emmeans_1.10.0 compiler_4.3.2 [81] curl_5.2.0 ahead_0.10.0 htmlTable_2.4.2 posterior_1.5.0 checkmate_2.3.1 [86] DEoptimR_1.1-3 fracdiff_1.5-2 quadprog_1.5-8 tfruns_1.5.1 digest_0.6.34 [91] minqa_1.2.6 rmarkdown_2.25 htmltools_0.5.7 pkgconfig_2.0.3 base64enc_0.1-3 [96] lme4_1.1-35.1lhs_1.1.6fastmap_1.1.1 rlang_1.1.3 htmlwidgets_1.6.4 [101] quantmod_0.4.26 farver_2.1.1 jsonlite_1.8.8 ModelMetrics_1.2.2.2 R.oo_1.26.0 [106] Formula_1.2-5bayesplot_1.11.1 texreg_1.39.3 GPfit_1.0-8 munsell_0.5.0 [111] furrr_0.3.1 stringi_1.8.3pROC_1.18.5 pkgbuild_1.4.3 plyr_1.8.9 [116] expint_0.1-8 listenv_0.9.1splines_4.3.2 hms_1.1.3ranger_0.16.0 [121] rngtools_1.5.2 reshape2_1.4.4 rstantools_2.4.0 evaluate_0.23
Re: [R] Issues with R's forecast function
Thanks for the kind feedback. I will go ahead and update the packages and see what happens. I will keep you posted. Cheers, Paul El lun, 27 may 2024 a las 13:51, Sarah Goslee () escribió: > Hi Paul, > > Looking at this, you aren't running the most recent version of forecast. > > If I were having a problem of this sort, I'd update R (if you can), > run update.packages() and then try again with a minimal set of > packages. As one of the other responses suggested, you probably have > mismatched versions of packages with dependencies. > > Sarah > > On Mon, May 27, 2024 at 2:48 PM Paul Bernal > wrote: > > > > Dear Sarah, > > > > Here is the sessionInfo() output, I forgot to include it in my reply. > > > > sessionInfo() > > R version 4.3.2 (2023-10-31 ucrt) > > Platform: x86_64-w64-mingw32/x64 (64-bit) > > Running under: Windows 11 x64 (build 22631) > > > > Matrix products: default > > > > > > locale: > > [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United > States.utf8 > > [3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C > > [5] LC_TIME=English_United States.utf8 > > > > time zone: America/Bogota > > tzcode source: internal > > > > attached base packages: > > [1] parallel grid stats4stats graphics grDevices utils >datasets methods base > > > > other attached packages: > > [1] mvgam_1.1.1insight_0.19.7 > marginaleffects_0.20.1 brms_2.21.0 > > [5] mgcv_1.9-0 nlme_3.1-163 gbm_2.1.9 > yardstick_1.3.1 > > [9] workflowsets_1.1.0 workflows_1.1.4tune_1.2.1 > rsample_1.2.1 > > [13] recipes_1.0.10 parsnip_1.2.1 modeldata_1.3.0 > infer_1.0.7 > > [17] dials_1.2.1scales_1.3.0 broom_1.0.5 > tidymodels_1.2.0 > > [21] ggthemes_5.1.0 janitor_2.2.0 tictoc_1.2.1 > Ckmeans.1d.dp_4.3.5 > > [25] magrittr_2.0.3 data.table_1.14.10 reticulate_1.34.0 > tensorflow_2.15.0 > > [29] keras_2.13.0 matlabr_1.5.2 R.matlab_3.7.0 > distrMod_2.9.1 > > [33] RandVar_1.2.3 distrEx_2.9.2 distr_2.9.3 > sfsmisc_1.1-17 > > [37] startupmsg_0.9.6.1 qcc_2.7pdp_0.8.1 > doParallel_1.0.17 > > [41] iterators_1.0.14 foreach_1.5.2 tsintermittent_1.10 > ivreg_0.6-2 > > [45] vars_1.6-0 urca_1.3-3 strucchange_1.5-3 > Amelia_1.8.1 > > [49] Rcpp_1.0.12VIM_6.2.2 colorspace_2.1-0 > mi_1.1 > > [53] Hmisc_5.1-1missForest_1.5 mice_3.16.0 > gghighlight_0.4.1 > > [57] caret_6.0-94 lattice_0.21-9 xgboost_1.7.7.1 > smooth_4.0.0 > > [61] e1071_1.7-14 greybox_2.0.0 rio_1.0.1 > fitdistrplus_1.1-11 > > [65] AER_1.2-12 survival_3.5-7 sandwich_3.1-0 > lmtest_0.9-40 > > [69] zoo_1.8-12 car_3.1-2 carData_3.0-5 > forcats_1.0.0 > > [73] stringr_1.5.1 purrr_1.0.2readr_2.1.5 > tidyr_1.3.1 > > [77] tibble_3.2.1 tidyverse_2.0.0dplyr_1.1.4 > Metrics_0.1.4 > > [81] corrgram_1.14 corrplot_0.92 readxl_1.4.3 > glmnet_4.1-8 > > [85] Matrix_1.6-1.1 MASS_7.3-60.0.1actuar_3.3-4 > neuralnet_1.44.2 > > [89] nnfor_0.9.9generics_0.1.3 ggplot2_3.5.1 > lubridate_1.9.3 > > [93] tseries_0.10-55forecast_8.21.1 > > > > loaded via a namespace (and not attached): > > [1] matrixStats_1.3.0DiceDesign_1.10 httr_1.4.7 > RColorBrewer_1.1-3 tools_4.3.2 > > [6] doRNG_1.8.6 backports_1.4.1 utf8_1.2.4 > R6_2.5.1 jomo_2.7-6 > > [11] withr_3.0.0 sp_2.1-3 Brobdingnag_1.2-9 > gridExtra_2.3cli_3.6.2 > > [16] labeling_0.4.3 tsutils_0.9.4mvtnorm_1.2-4 > robustbase_0.99-2randomForest_4.7-1.1 > > [21] proxy_0.4-27 QuickJSR_1.1.3 StanHeaders_2.32.7 > foreign_0.8-85 R.utils_2.12.3 > > [26] parallelly_1.36.0scoringRules_1.1.1 itertools_0.1-3 > TTR_0.24.4 rstudioapi_0.16.0 > > [31] shape_1.4.6 distributional_0.4.0 inline_0.3.19 > loo_2.7.0fansi_1.0.6 > > [36] abind_1.4-5 R.methodsS3_1.8.2lifecycle_1.0.4 > multcomp_1.4-25 whisker_0.4.1 > > [41] snakecase_0.11.1 crayon_1.5.2 mitml_0.4-5 > zeallot_0.1.0pillar_1.9.0 > > [46] knitr_1.45 boot_1.3-28.1estimability_1.4.1 > future.apply_1.11.1 codetools_0.2-19
Re: [R] Issues with R's forecast function
Dear Sarah, Thank you for kindly reaching back. I did load the package, which makes this issue really odd. I ran the same model about a week ago and everything was working to perfection. Best regards, Paul El lun, 27 may 2024 a las 12:15, Sarah Goslee () escribió: > Hi Paul, > > It looks like you're using the forecast package, right? Have you loaded it? > > What is the output of sessionInfo() ? > > It looks to me like you either haven't loaded the needed packages, or > there's some kind of conflict. Your examples don't give me errors when > I run them, so we need more information. > > Sarah > > > > On Mon, May 27, 2024 at 12:25 PM Paul Bernal > wrote: > > > > Dear all, > > > > I am currently using R 4.3.2 and the data I am working with is the > > following: > > > > ts_ingresos_reservas= ts(ingresos_reservaciones$RESERVACIONES, start > = > > c(1996,11), end = c(2024,4), frequency = 12) > > > > structure(c(11421.54, 388965.46, 254774.78, 228066.02, 254330.44, > > 272561.38, 377802.1, 322810.02, 490996.48, 581998.3, 557009.96, > > 619568.56, 578893.9, 938765.36, 566374.38, 582678.46, 931035.04, > > 855661.3, 839760.22, 745521.4, 816424.96, 899616.64, 921462.88, > > 942825, 1145845.74, 1260554.36, 1003983.5, 855516.22, 1273913.68, > > 1204626.54, 1034135.18, 904641.14, 1003094.3, 1073084.74, 928515.64, > > 854864.4, 928927.48, 1076922.34, 1031265.04, 1043755.7, 1238565.12, > > 1343609.54, 1405817.92, 1243192.86, 1235505.44, 1280514.56, 1314029.08, > > 1562841.28, 1405662.96, 1315083.12, 1363980.02, 1126195.72, 1542338.98, > > 1577437.94, 1474855.98, 1287170.56, 1404118.3, 1528979.66, 1286690.34, > > 1544495.16, 1527018.22, 1462908.72, 1682739.76, 1439027.72, 1531060.44, > > 1793606.88, 1835054.26, 1616743.96, 1779745.24, 1772628, 1736200.18, > > 1736792.72, 1835714.4, 2031238.04, 1937816.14, 1942473.52, 2131666.68, > > 2099279.26, 1939093.78, 2135231.54, 2187614.52, 2150766.28, 2179862.62, > > 2467330.32, 2421603.34, 2585889.54, 4489381.11, 4915745.55, 5313521.43, > > 5185438.48, 5346116.46, 4507418.33, 5028489.81, 4931266.16, 5529189.46, > > 5470279.34, 5354912.01, 5937028.11, 6422819.13, 5989941.72, 6549070.26, > > 6710738.34, 6745949.78, 6345832.78, 6656868.36, 6836903.51, 6456545.14, > > 7039815.42, 7288665.89, 7372047.96, 8116822.48, 7318300.42, 8742429.72, > > 8780764.44, 8984081.22, 8221966.77, 8594896.69, 8319125.91, 8027227.8, > > 9241082.48, 8765799.78, 9360643.68, 9384937.59, 8237007.99, 9251122.07, > > 8703017.5, 9004464.9, 8099029.39, 8883214.99, 8360815.05, 8408082.51, > > 9126756.64, 8610501.05, 9109139.05, 8904803.6, 12766215.9, 14055014.03, > > 12789865.86, 13251587.21, 13731917.7, 14925330.72, 14295954.4, > > 13346681.84, 14233732.03, 12743141.34, 13742979.78, 11770238.46, > > 11655300, 12327000, 10096000, 8712000, 6742500, 7199000, 5459000, > > 4442000, 7448500, 6322500, 6030500, 5521000, 4752000, 6248500, > > 5233000, 7440500, 5604500, 6516500, 6001500, 9364500, 14528500, > > 14076000, 11671500, 11778500, 13902500, 13073000, 11097000, 9547500, > > 10255000, 8986500, 10807000, 10031500, 9847000, 12216500, 11648500, > > 13106000, 10856500, 9679500, 9986500, 8947500, 11105500, 9950500, > > 10922000, 9031500, 9720500, 9709000, 9470500, 9316000, 9884500, > > 9067500, 8985000, 10888000, 9676500, 10047000, 8952000, 10191500, > > 12763000, 14885000, 13592000, 13364500, 11924000, 13888000, 12833500, > > 12239000, 945, 10028000, 10171500, 13648000, 13989000, 14488000, > > 14195000, 12800500, 12703000, 1530, 14963000, 15049000, 13513000, > > 14155500, 14047500, 12923500, 13298500, 12814000, 13492000, 14405500, > > 12597500, 14486000, 12103500, 12815000, 11912000, 12353500, 12718500, > > 12972000, 12499000, 13683500, 17437000, 18147000, 17008000, 1718, > > 1616, 15096500, 13707000, 16254000, 14673500, 13661500, 17014000, > > 16104500, 17113000, 17200500, 15304500, 17131000, 16551000, 16356000, > > 14702000, 14488000, 14902500, 14435500, 15598500, 14754500, 15015000, > > 16444500, 1462, 15701000, 14211000, 15243000, 13898000, 14889000, > > 18571000, 15950500, 20171000, 20096000, 19647000, 20394500, 18213000, > > 18714500, 18301000, 14581000, 12333000, 14482500, 17538500, 17480500, > > 19574000, 18464500, 1941, 19013000, 16523500, 18755000, 18194000, > > 18918000, 34130500, 34421500, 36727000, 33406500, 34779500, 35916500, > > 36193000, 35878500, 32274500, 35097000, 34319500, 36459000, 35222500, > > 35972000, 37382000, 34482000, 35776000, 3533, 3599, 34788500, > > 32173500, 34879000, 33195500, 35243500, 33581000, 35632000, 32716000, > &
Re: [R] Issues with R's forecast function
You have completely ignored mentioning what R contributed packages you may have been using in "back when it worked". It is critical that you keep track of which "library" statements are necessary to run your code, if any. I searched for "R usemethod forecast" in Google and this [1] came up. Perhaps it is helpful? It seems that some people have had problems when they updated some but not all of their R packages. [1] https://stackoverflow.com/questions/70283794/forecasting-in-r-usemethod-model-function-error On May 27, 2024 9:24:50 AM PDT, Paul Bernal wrote: >Dear all, > >I am currently using R 4.3.2 and the data I am working with is the >following: > >ts_ingresos_reservas= ts(ingresos_reservaciones$RESERVACIONES, start = >c(1996,11), end = c(2024,4), frequency = 12) > >structure(c(11421.54, 388965.46, 254774.78, 228066.02, 254330.44, >272561.38, 377802.1, 322810.02, 490996.48, 581998.3, 557009.96, >619568.56, 578893.9, 938765.36, 566374.38, 582678.46, 931035.04, >855661.3, 839760.22, 745521.4, 816424.96, 899616.64, 921462.88, >942825, 1145845.74, 1260554.36, 1003983.5, 855516.22, 1273913.68, >1204626.54, 1034135.18, 904641.14, 1003094.3, 1073084.74, 928515.64, >854864.4, 928927.48, 1076922.34, 1031265.04, 1043755.7, 1238565.12, >1343609.54, 1405817.92, 1243192.86, 1235505.44, 1280514.56, 1314029.08, >1562841.28, 1405662.96, 1315083.12, 1363980.02, 1126195.72, 1542338.98, >1577437.94, 1474855.98, 1287170.56, 1404118.3, 1528979.66, 1286690.34, >1544495.16, 1527018.22, 1462908.72, 1682739.76, 1439027.72, 1531060.44, >1793606.88, 1835054.26, 1616743.96, 1779745.24, 1772628, 1736200.18, >1736792.72, 1835714.4, 2031238.04, 1937816.14, 1942473.52, 2131666.68, >2099279.26, 1939093.78, 2135231.54, 2187614.52, 2150766.28, 2179862.62, >2467330.32, 2421603.34, 2585889.54, 4489381.11, 4915745.55, 5313521.43, >5185438.48, 5346116.46, 4507418.33, 5028489.81, 4931266.16, 5529189.46, >5470279.34, 5354912.01, 5937028.11, 6422819.13, 5989941.72, 6549070.26, >6710738.34, 6745949.78, 6345832.78, 6656868.36, 6836903.51, 6456545.14, >7039815.42, 7288665.89, 7372047.96, 8116822.48, 7318300.42, 8742429.72, >8780764.44, 8984081.22, 8221966.77, 8594896.69, 8319125.91, 8027227.8, >9241082.48, 8765799.78, 9360643.68, 9384937.59, 8237007.99, 9251122.07, >8703017.5, 9004464.9, 8099029.39, 8883214.99, 8360815.05, 8408082.51, >9126756.64, 8610501.05, 9109139.05, 8904803.6, 12766215.9, 14055014.03, >12789865.86, 13251587.21, 13731917.7, 14925330.72, 14295954.4, >13346681.84, 14233732.03, 12743141.34, 13742979.78, 11770238.46, >11655300, 12327000, 10096000, 8712000, 6742500, 7199000, 5459000, >4442000, 7448500, 6322500, 6030500, 5521000, 4752000, 6248500, >5233000, 7440500, 5604500, 6516500, 6001500, 9364500, 14528500, >14076000, 11671500, 11778500, 13902500, 13073000, 11097000, 9547500, >10255000, 8986500, 10807000, 10031500, 9847000, 12216500, 11648500, >13106000, 10856500, 9679500, 9986500, 8947500, 11105500, 9950500, >10922000, 9031500, 9720500, 9709000, 9470500, 9316000, 9884500, >9067500, 8985000, 10888000, 9676500, 10047000, 8952000, 10191500, >12763000, 14885000, 13592000, 13364500, 11924000, 13888000, 12833500, >12239000, 945, 10028000, 10171500, 13648000, 13989000, 14488000, >14195000, 12800500, 12703000, 1530, 14963000, 15049000, 13513000, >14155500, 14047500, 12923500, 13298500, 12814000, 13492000, 14405500, >12597500, 14486000, 12103500, 12815000, 11912000, 12353500, 12718500, >12972000, 12499000, 13683500, 17437000, 18147000, 17008000, 1718, >1616, 15096500, 13707000, 16254000, 14673500, 13661500, 17014000, >16104500, 17113000, 17200500, 15304500, 17131000, 16551000, 16356000, >14702000, 14488000, 14902500, 14435500, 15598500, 14754500, 15015000, >16444500, 1462, 15701000, 14211000, 15243000, 13898000, 14889000, >18571000, 15950500, 20171000, 20096000, 19647000, 20394500, 18213000, >18714500, 18301000, 14581000, 12333000, 14482500, 17538500, 17480500, >19574000, 18464500, 1941, 19013000, 16523500, 18755000, 18194000, >18918000, 34130500, 34421500, 36727000, 33406500, 34779500, 35916500, >36193000, 35878500, 32274500, 35097000, 34319500, 36459000, 35222500, >35972000, 37382000, 34482000, 35776000, 3533, 3599, 34788500, >32173500, 34879000, 33195500, 35243500, 33581000, 35632000, 32716000, >33966500, 31778000, 28164500, 25729500, 23034500, 24427500, 26506500, >26655500), tsp = c(1996.833, 2024.25, 12), class = "ts") > >Now that I have my time series data, I tried generating forecasts with the >following code: > >ingresos_reservas_arimamod = auto.arima(ts_ingresos_reservas) >ingresos_reservas_arimafor = forecast(ingresos_reservas_arimamod, h = >151) > >ingresos_reservas_holtwintersmod = HoltWinters(ts_ingresos_reservas) &
Re: [R] Issues with R's forecast function
Hi Paul, It looks like you're using the forecast package, right? Have you loaded it? What is the output of sessionInfo() ? It looks to me like you either haven't loaded the needed packages, or there's some kind of conflict. Your examples don't give me errors when I run them, so we need more information. Sarah On Mon, May 27, 2024 at 12:25 PM Paul Bernal wrote: > > Dear all, > > I am currently using R 4.3.2 and the data I am working with is the > following: > > ts_ingresos_reservas= ts(ingresos_reservaciones$RESERVACIONES, start = > c(1996,11), end = c(2024,4), frequency = 12) > > structure(c(11421.54, 388965.46, 254774.78, 228066.02, 254330.44, > 272561.38, 377802.1, 322810.02, 490996.48, 581998.3, 557009.96, > 619568.56, 578893.9, 938765.36, 566374.38, 582678.46, 931035.04, > 855661.3, 839760.22, 745521.4, 816424.96, 899616.64, 921462.88, > 942825, 1145845.74, 1260554.36, 1003983.5, 855516.22, 1273913.68, > 1204626.54, 1034135.18, 904641.14, 1003094.3, 1073084.74, 928515.64, > 854864.4, 928927.48, 1076922.34, 1031265.04, 1043755.7, 1238565.12, > 1343609.54, 1405817.92, 1243192.86, 1235505.44, 1280514.56, 1314029.08, > 1562841.28, 1405662.96, 1315083.12, 1363980.02, 1126195.72, 1542338.98, > 1577437.94, 1474855.98, 1287170.56, 1404118.3, 1528979.66, 1286690.34, > 1544495.16, 1527018.22, 1462908.72, 1682739.76, 1439027.72, 1531060.44, > 1793606.88, 1835054.26, 1616743.96, 1779745.24, 1772628, 1736200.18, > 1736792.72, 1835714.4, 2031238.04, 1937816.14, 1942473.52, 2131666.68, > 2099279.26, 1939093.78, 2135231.54, 2187614.52, 2150766.28, 2179862.62, > 2467330.32, 2421603.34, 2585889.54, 4489381.11, 4915745.55, 5313521.43, > 5185438.48, 5346116.46, 4507418.33, 5028489.81, 4931266.16, 5529189.46, > 5470279.34, 5354912.01, 5937028.11, 6422819.13, 5989941.72, 6549070.26, > 6710738.34, 6745949.78, 6345832.78, 6656868.36, 6836903.51, 6456545.14, > 7039815.42, 7288665.89, 7372047.96, 8116822.48, 7318300.42, 8742429.72, > 8780764.44, 8984081.22, 8221966.77, 8594896.69, 8319125.91, 8027227.8, > 9241082.48, 8765799.78, 9360643.68, 9384937.59, 8237007.99, 9251122.07, > 8703017.5, 9004464.9, 8099029.39, 8883214.99, 8360815.05, 8408082.51, > 9126756.64, 8610501.05, 9109139.05, 8904803.6, 12766215.9, 14055014.03, > 12789865.86, 13251587.21, 13731917.7, 14925330.72, 14295954.4, > 13346681.84, 14233732.03, 12743141.34, 13742979.78, 11770238.46, > 11655300, 12327000, 10096000, 8712000, 6742500, 7199000, 5459000, > 4442000, 7448500, 6322500, 6030500, 5521000, 4752000, 6248500, > 5233000, 7440500, 5604500, 6516500, 6001500, 9364500, 14528500, > 14076000, 11671500, 11778500, 13902500, 13073000, 11097000, 9547500, > 10255000, 8986500, 10807000, 10031500, 9847000, 12216500, 11648500, > 13106000, 10856500, 9679500, 9986500, 8947500, 11105500, 9950500, > 10922000, 9031500, 9720500, 9709000, 9470500, 9316000, 9884500, > 9067500, 8985000, 10888000, 9676500, 10047000, 8952000, 10191500, > 12763000, 14885000, 13592000, 13364500, 11924000, 13888000, 12833500, > 12239000, 945, 10028000, 10171500, 13648000, 13989000, 14488000, > 14195000, 12800500, 12703000, 1530, 14963000, 15049000, 13513000, > 14155500, 14047500, 12923500, 13298500, 12814000, 13492000, 14405500, > 12597500, 14486000, 12103500, 12815000, 11912000, 12353500, 12718500, > 12972000, 12499000, 13683500, 17437000, 18147000, 17008000, 1718, > 1616, 15096500, 13707000, 16254000, 14673500, 13661500, 17014000, > 16104500, 17113000, 17200500, 15304500, 17131000, 16551000, 16356000, > 14702000, 14488000, 14902500, 14435500, 15598500, 14754500, 15015000, > 16444500, 1462, 15701000, 14211000, 15243000, 13898000, 14889000, > 18571000, 15950500, 20171000, 20096000, 19647000, 20394500, 18213000, > 18714500, 18301000, 14581000, 12333000, 14482500, 17538500, 17480500, > 19574000, 18464500, 1941, 19013000, 16523500, 18755000, 18194000, > 18918000, 34130500, 34421500, 36727000, 33406500, 34779500, 35916500, > 36193000, 35878500, 32274500, 35097000, 34319500, 36459000, 35222500, > 35972000, 37382000, 34482000, 35776000, 3533, 3599, 34788500, > 32173500, 34879000, 33195500, 35243500, 33581000, 35632000, 32716000, > 33966500, 31778000, 28164500, 25729500, 23034500, 24427500, 26506500, > 26655500), tsp = c(1996.833, 2024.25, 12), class = "ts") > > Now that I have my time series data, I tried generating forecasts with the > following code: > > ingresos_reservas_arimamod = auto.arima(ts_ingresos_reservas) > ingresos_reservas_arimafor = forecast(ingresos_reservas_arimamod, h = > 151) > > ingresos_reservas_holtwintersmod = HoltWinters(ts_ingresos_reservas) > ingresos_reservas_holtwintersfor = > forecast(ingresos_reservas_holtwintersmod, h = 151) > > ingresos_reservas_etsmod= ets
[R] Issues with R's forecast function
Dear all, I am currently using R 4.3.2 and the data I am working with is the following: ts_ingresos_reservas= ts(ingresos_reservaciones$RESERVACIONES, start = c(1996,11), end = c(2024,4), frequency = 12) structure(c(11421.54, 388965.46, 254774.78, 228066.02, 254330.44, 272561.38, 377802.1, 322810.02, 490996.48, 581998.3, 557009.96, 619568.56, 578893.9, 938765.36, 566374.38, 582678.46, 931035.04, 855661.3, 839760.22, 745521.4, 816424.96, 899616.64, 921462.88, 942825, 1145845.74, 1260554.36, 1003983.5, 855516.22, 1273913.68, 1204626.54, 1034135.18, 904641.14, 1003094.3, 1073084.74, 928515.64, 854864.4, 928927.48, 1076922.34, 1031265.04, 1043755.7, 1238565.12, 1343609.54, 1405817.92, 1243192.86, 1235505.44, 1280514.56, 1314029.08, 1562841.28, 1405662.96, 1315083.12, 1363980.02, 1126195.72, 1542338.98, 1577437.94, 1474855.98, 1287170.56, 1404118.3, 1528979.66, 1286690.34, 1544495.16, 1527018.22, 1462908.72, 1682739.76, 1439027.72, 1531060.44, 1793606.88, 1835054.26, 1616743.96, 1779745.24, 1772628, 1736200.18, 1736792.72, 1835714.4, 2031238.04, 1937816.14, 1942473.52, 2131666.68, 2099279.26, 1939093.78, 2135231.54, 2187614.52, 2150766.28, 2179862.62, 2467330.32, 2421603.34, 2585889.54, 4489381.11, 4915745.55, 5313521.43, 5185438.48, 5346116.46, 4507418.33, 5028489.81, 4931266.16, 5529189.46, 5470279.34, 5354912.01, 5937028.11, 6422819.13, 5989941.72, 6549070.26, 6710738.34, 6745949.78, 6345832.78, 6656868.36, 6836903.51, 6456545.14, 7039815.42, 7288665.89, 7372047.96, 8116822.48, 7318300.42, 8742429.72, 8780764.44, 8984081.22, 8221966.77, 8594896.69, 8319125.91, 8027227.8, 9241082.48, 8765799.78, 9360643.68, 9384937.59, 8237007.99, 9251122.07, 8703017.5, 9004464.9, 8099029.39, 8883214.99, 8360815.05, 8408082.51, 9126756.64, 8610501.05, 9109139.05, 8904803.6, 12766215.9, 14055014.03, 12789865.86, 13251587.21, 13731917.7, 14925330.72, 14295954.4, 13346681.84, 14233732.03, 12743141.34, 13742979.78, 11770238.46, 11655300, 12327000, 10096000, 8712000, 6742500, 7199000, 5459000, 4442000, 7448500, 6322500, 6030500, 5521000, 4752000, 6248500, 5233000, 7440500, 5604500, 6516500, 6001500, 9364500, 14528500, 14076000, 11671500, 11778500, 13902500, 13073000, 11097000, 9547500, 10255000, 8986500, 10807000, 10031500, 9847000, 12216500, 11648500, 13106000, 10856500, 9679500, 9986500, 8947500, 11105500, 9950500, 10922000, 9031500, 9720500, 9709000, 9470500, 9316000, 9884500, 9067500, 8985000, 10888000, 9676500, 10047000, 8952000, 10191500, 12763000, 14885000, 13592000, 13364500, 11924000, 13888000, 12833500, 12239000, 945, 10028000, 10171500, 13648000, 13989000, 14488000, 14195000, 12800500, 12703000, 1530, 14963000, 15049000, 13513000, 14155500, 14047500, 12923500, 13298500, 12814000, 13492000, 14405500, 12597500, 14486000, 12103500, 12815000, 11912000, 12353500, 12718500, 12972000, 12499000, 13683500, 17437000, 18147000, 17008000, 1718, 1616, 15096500, 13707000, 16254000, 14673500, 13661500, 17014000, 16104500, 17113000, 17200500, 15304500, 17131000, 16551000, 16356000, 14702000, 14488000, 14902500, 14435500, 15598500, 14754500, 15015000, 16444500, 1462, 15701000, 14211000, 15243000, 13898000, 14889000, 18571000, 15950500, 20171000, 20096000, 19647000, 20394500, 18213000, 18714500, 18301000, 14581000, 12333000, 14482500, 17538500, 17480500, 19574000, 18464500, 1941, 19013000, 16523500, 18755000, 18194000, 18918000, 34130500, 34421500, 36727000, 33406500, 34779500, 35916500, 36193000, 35878500, 32274500, 35097000, 34319500, 36459000, 35222500, 35972000, 37382000, 34482000, 35776000, 3533, 3599, 34788500, 32173500, 34879000, 33195500, 35243500, 33581000, 35632000, 32716000, 33966500, 31778000, 28164500, 25729500, 23034500, 24427500, 26506500, 26655500), tsp = c(1996.833, 2024.25, 12), class = "ts") Now that I have my time series data, I tried generating forecasts with the following code: ingresos_reservas_arimamod = auto.arima(ts_ingresos_reservas) ingresos_reservas_arimafor = forecast(ingresos_reservas_arimamod, h = 151) ingresos_reservas_holtwintersmod = HoltWinters(ts_ingresos_reservas) ingresos_reservas_holtwintersfor = forecast(ingresos_reservas_holtwintersmod, h = 151) ingresos_reservas_etsmod= ets(ts_ingresos_reservas) ingresos_reservas_etsfor= forecast(ingresos_reservas_etsmod, level = c(90,99), h = 151) ingresos_reservas_batsmod = bats(ts_ingresos_reservas) ingresos_reservas_batsfor = forecast(ingresos_reservas_batsmod, level = c(90,99), h = 151, robust = TRUE) ingresos_reservas_tbatsmod = tbats(ts_ingresos_reservas) ingresos_reservas_tbatsfor = forecast(ingresos_reservas_tbatsmod, level = c(90,99), h = 151, robust = TRUE) ingresos_reservas_nnetarmod = nnetar(ts_ingresos_reservas) ingresos_reservas_nnetarfor = forecast(ingresos_reservas_nnetarmod, PI = TRUE, h = 151, robust = TRUE) This code used to work, but now, I keep getting the following error: Error in UseMethod("fo
Re: [R] Can someone please have a look at my query on stackoverflow ?
If I had seen that post before it got a bounty, I would have voted to migrate it to https://stats.stackexchange.com since it is a request for advice on methods as well as an implicit request for a package recommendation. — David Sent from my iPhone > On May 27, 2024, at 5:40 AM, Ashim Kapoor wrote: > > Dear experts, > > I am having difficulty with computing spectrum of seasonal ARMA models. > > My query is posted here : > > https://stackoverflow.com/questions/78526800/computing-the-spectrum-of-a-seasonal-model-in-r > > Will be grateful if someone has a look at it and responds. > > Many thanks, > Ashim. > >[[alternative HTML version deleted]] > > ______ > 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-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] Can someone please have a look at my query on stackoverflow ?
Dear experts, I am having difficulty with computing spectrum of seasonal ARMA models. My query is posted here : https://stackoverflow.com/questions/78526800/computing-the-spectrum-of-a-seasonal-model-in-r Will be grateful if someone has a look at it and responds. Many thanks, Ashim. [[alternative HTML version deleted]] __ 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] dplyr, group_by and selective action according to each group
Thank you for your answers. Endeed, if I can do the treatment row by row, which is the case, I can use a condition statement with mutate. Instead of ifelse I found the case_when statement in order to take into account the three groups. And the list of functions with the relevant names is a very good idea I will use. Best regards Laurent Le 25/05/2024 à 04:56, avi.e.gr...@gmail.com a écrit : Although there may well be many ways to do what is being asked for with the tidyverse, sometimes things are simple enough to do the old-fashioned way. The request seems to have been to do something to all rows in ONE specific group but was phrased in the sense of wanting to know which group your functionality is being called in. What grouping gains you is more worthwhile if you are interested in doing things groupwise across all groups such as getting a count of how many are in each group or some vectorized operation like getting the mean or SD of a column or whatever. But for the purposes mentioned here, consider a lower-tech alternative such as this. Instead of group_by(gr) which is a trivial group, consider using other dplyr predicates like "mutate" to trigger on all rows that meet a condition like gr having a value of 3 as in: mutate(DATAFRAME, result=ifelse(gr==3, f(), whatever) The above is not a full-blown example but something similar can be tailored to do quite a bit. As an example, if gr specified whether the measure in another column was in meters or feet, you could convert that other column to meters if gr was == "feet" and on a second line of code, convert the "gr" value in that row to now say "meters" so that in the end, they are all in meters. Of course if you have a more complex use case such as grouping by multiple variables, and having the same (or different) logic for multiple values, this can get more complex. But if you want to get working code sooner, consider using methods you understand rather than seeing if someone in the tidyverse universe has already created exactly what you want. There are things you can access such as if you want to keep only the first record in each group, you can filter by row_number==1, or use the do() function. The dplyr (and related packages) keep evolving and functionality may be deprecated, but check this page for ideas: https://dplyr.tidyverse.org/reference/group_data.html Some of those may give you access to which rows are in each group and to other ways to approach the problem somewhat from outside after grouping so you can apply your function to the subset of the rows you want. -Original Message- From: R-help On Behalf Of Bert Gunter Sent: Friday, May 24, 2024 6:52 PM To: Laurent Rhelp Cc: r-help@r-project.org Subject: Re: [R] dplyr, group_by and selective action according to each group Laurent: As I don't use dplyr, this won't help you, but I hope you and others may find it entertaining anyway. If I understand you correctly (and ignore this if I have not), there are a ton of ways to do this in base R, including using switch() along the lines you noted in your post. However, when the functions get sufficiently complicated or numerous, it may be useful to store them in a named list and use the names to call them in some sort of loop. Here I have just used your anonymous functions in the list, but of course you could have used already existing functions instead. ## your example df_test <- data.frame( x1=1:9, x2=1:9, gr=rep(paste0("gr",1:3),each=3)) ## function list with the relevant names funcs <- list(gr1 = \(x)x+1, gr2 = \(x)0, gr3 = \(x)x+2) ## Alternatively you could do this if you had many different functions: ## funcs <- list(\(x)x+1, \(x)0, \(x)x+2) ## names(funcs) <- sort(unique(df_test$gr)) ## note that sort() is unnecessary in your example, but I think that it would ## be helpful if you had a lot of different groups and corresponding functions ## to track. ##Now the little loop to call the functions df_test$x1 <- with(df_test,{ for(nm in names(funcs)) x1[gr == nm] <- funcs[[nm]](x1[gr == nm]) x1} ) # Note that the above uses one of the features that I really like about R -- functions are full first class objects that can be thrown around and handled just like any other "variables" . So funcs[[nm]](whatever) seems to me to be a natural way to choose and call the function you want. You may disagree, of course. Caveat: I make no claims about the efficiency or lack thereof of the above. Cheers, Bert On Fri, May 24, 2024 at 12:35 PM Laurent Rhelp wrote: Dear RHelp-list, Using dplyr and the group_by approach on a dataframe, I want to be able to apply a specific action according to the group name. The code bellow works, but I am not able to write it in a more esthetic way using dplyr. Can somebody help me to find a better solution ? Thank you Best regards Laurent d
Re: [R] dplyr, group_by and selective action according to each group
Although there may well be many ways to do what is being asked for with the tidyverse, sometimes things are simple enough to do the old-fashioned way. The request seems to have been to do something to all rows in ONE specific group but was phrased in the sense of wanting to know which group your functionality is being called in. What grouping gains you is more worthwhile if you are interested in doing things groupwise across all groups such as getting a count of how many are in each group or some vectorized operation like getting the mean or SD of a column or whatever. But for the purposes mentioned here, consider a lower-tech alternative such as this. Instead of group_by(gr) which is a trivial group, consider using other dplyr predicates like "mutate" to trigger on all rows that meet a condition like gr having a value of 3 as in: mutate(DATAFRAME, result=ifelse(gr==3, f(), whatever) The above is not a full-blown example but something similar can be tailored to do quite a bit. As an example, if gr specified whether the measure in another column was in meters or feet, you could convert that other column to meters if gr was == "feet" and on a second line of code, convert the "gr" value in that row to now say "meters" so that in the end, they are all in meters. Of course if you have a more complex use case such as grouping by multiple variables, and having the same (or different) logic for multiple values, this can get more complex. But if you want to get working code sooner, consider using methods you understand rather than seeing if someone in the tidyverse universe has already created exactly what you want. There are things you can access such as if you want to keep only the first record in each group, you can filter by row_number==1, or use the do() function. The dplyr (and related packages) keep evolving and functionality may be deprecated, but check this page for ideas: https://dplyr.tidyverse.org/reference/group_data.html Some of those may give you access to which rows are in each group and to other ways to approach the problem somewhat from outside after grouping so you can apply your function to the subset of the rows you want. -Original Message- From: R-help On Behalf Of Bert Gunter Sent: Friday, May 24, 2024 6:52 PM To: Laurent Rhelp Cc: r-help@r-project.org Subject: Re: [R] dplyr, group_by and selective action according to each group Laurent: As I don't use dplyr, this won't help you, but I hope you and others may find it entertaining anyway. If I understand you correctly (and ignore this if I have not), there are a ton of ways to do this in base R, including using switch() along the lines you noted in your post. However, when the functions get sufficiently complicated or numerous, it may be useful to store them in a named list and use the names to call them in some sort of loop. Here I have just used your anonymous functions in the list, but of course you could have used already existing functions instead. ## your example df_test <- data.frame( x1=1:9, x2=1:9, gr=rep(paste0("gr",1:3),each=3)) ## function list with the relevant names funcs <- list(gr1 = \(x)x+1, gr2 = \(x)0, gr3 = \(x)x+2) ## Alternatively you could do this if you had many different functions: ## funcs <- list(\(x)x+1, \(x)0, \(x)x+2) ## names(funcs) <- sort(unique(df_test$gr)) ## note that sort() is unnecessary in your example, but I think that it would ## be helpful if you had a lot of different groups and corresponding functions ## to track. ##Now the little loop to call the functions df_test$x1 <- with(df_test,{ for(nm in names(funcs)) x1[gr == nm] <- funcs[[nm]](x1[gr == nm]) x1} ) # Note that the above uses one of the features that I really like about R -- functions are full first class objects that can be thrown around and handled just like any other "variables" . So funcs[[nm]](whatever) seems to me to be a natural way to choose and call the function you want. You may disagree, of course. Caveat: I make no claims about the efficiency or lack thereof of the above. Cheers, Bert On Fri, May 24, 2024 at 12:35 PM Laurent Rhelp wrote: > Dear RHelp-list, > > Using dplyr and the group_by approach on a dataframe, I want to be > able to apply a specific action according to the group name. The code > bellow works, but I am not able to write it in a more esthetic way using > dplyr. Can somebody help me to find a better solution ? > > Thank you > > Best regards > > Laurent > > df_test <- data.frame( x1=1:9, x2=1:9, gr=rep(paste0("gr",1:3),each=3)) > df_test <- df_test %>% dplyr::group_by(gr) %>% >group_modify(.f=function(.x,.y){ > print(paste0("Nom du groupe : ",.y[["gr"]])) > switch(as.character(.y[["gr"]]) > , gr1 = {.x[,"
Re: [R] dplyr, group_by and selective action according to each group
Laurent: As I don't use dplyr, this won't help you, but I hope you and others may find it entertaining anyway. If I understand you correctly (and ignore this if I have not), there are a ton of ways to do this in base R, including using switch() along the lines you noted in your post. However, when the functions get sufficiently complicated or numerous, it may be useful to store them in a named list and use the names to call them in some sort of loop. Here I have just used your anonymous functions in the list, but of course you could have used already existing functions instead. ## your example df_test <- data.frame( x1=1:9, x2=1:9, gr=rep(paste0("gr",1:3),each=3)) ## function list with the relevant names funcs <- list(gr1 = \(x)x+1, gr2 = \(x)0, gr3 = \(x)x+2) ## Alternatively you could do this if you had many different functions: ## funcs <- list(\(x)x+1, \(x)0, \(x)x+2) ## names(funcs) <- sort(unique(df_test$gr)) ## note that sort() is unnecessary in your example, but I think that it would ## be helpful if you had a lot of different groups and corresponding functions ## to track. ##Now the little loop to call the functions df_test$x1 <- with(df_test,{ for(nm in names(funcs)) x1[gr == nm] <- funcs[[nm]](x1[gr == nm]) x1} ) # Note that the above uses one of the features that I really like about R -- functions are full first class objects that can be thrown around and handled just like any other "variables" . So funcs[[nm]](whatever) seems to me to be a natural way to choose and call the function you want. You may disagree, of course. Caveat: I make no claims about the efficiency or lack thereof of the above. Cheers, Bert On Fri, May 24, 2024 at 12:35 PM Laurent Rhelp wrote: > Dear RHelp-list, > > Using dplyr and the group_by approach on a dataframe, I want to be > able to apply a specific action according to the group name. The code > bellow works, but I am not able to write it in a more esthetic way using > dplyr. Can somebody help me to find a better solution ? > > Thank you > > Best regards > > Laurent > > df_test <- data.frame( x1=1:9, x2=1:9, gr=rep(paste0("gr",1:3),each=3)) > df_test <- df_test %>% dplyr::group_by(gr) %>% >group_modify(.f=function(.x,.y){ > print(paste0("Nom du groupe : ",.y[["gr"]])) > switch(as.character(.y[["gr"]]) > , gr1 = {.x[,"x1"] <- .x[,"x1"]+1} > , gr2 = {.x[,"x1"] <- 0} > , gr3 = {.x[,"x1"] <- .x[,"x1"]+2} > , {stop(paste0('The group ',.y[["gr"]]," is not taken into > account"))} > ) > return(.x) }) %>% ungroup() > > df_test > > __ > 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. > [[alternative HTML version deleted]] __ 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] dplyr, group_by and selective action according to each group
Dear RHelp-list, Using dplyr and the group_by approach on a dataframe, I want to be able to apply a specific action according to the group name. The code bellow works, but I am not able to write it in a more esthetic way using dplyr. Can somebody help me to find a better solution ? Thank you Best regards Laurent df_test <- data.frame( x1=1:9, x2=1:9, gr=rep(paste0("gr",1:3),each=3)) df_test <- df_test %>% dplyr::group_by(gr) %>% group_modify(.f=function(.x,.y){ print(paste0("Nom du groupe : ",.y[["gr"]])) switch(as.character(.y[["gr"]]) , gr1 = {.x[,"x1"] <- .x[,"x1"]+1} , gr2 = {.x[,"x1"] <- 0} , gr3 = {.x[,"x1"] <- .x[,"x1"]+2} , {stop(paste0('The group ',.y[["gr"]]," is not taken into account"))} ) return(.x) }) %>% ungroup() df_test __ 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] Regexp pattern but fixed replacement?
On Thu, 11 Apr 2024, Duncan Murdoch writes: > I noticed this issue in stringr::str_replace, but it > also affects sub() in base R. > > If the pattern in a call to one of these needs to be a > regular expression, then backslashes in the replacement > text are treated specially. > > For example, > > gsub("a|b", "\\", "abcdef") > > gives "def", not "def" as I wanted. To get the > latter, I need to escape the replacement backslashes, > e.g. > > gsub("a|b", "", "abcdef") > > which gives "cdef". > > I have two questions: > > 1. Is there a variant on sub or str_replace which > allows the pattern to be declared as a regular > expression, but the replacement to be declared as > fixed? I realize that this reply is late, but you can use raw strings for the replacement: gsub("a|b", r"(\\)", "abcdef") ## [1] "cdef" which might be easier to read, sometimes. [...] -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net __ 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] R, RStudio, and a server for my iPad.
...or look inside the administration interface for your router. Typically starts with opening a browser on 192.168.0.1 or 192.168.1.1 (with a password that you presumably have from your provider) and going to "Access Control" or thereabouts. -pd > On 12 Apr 2014, at 20:08 , Viechtbauer Wolfgang (STAT) > wrote: > > You will have to enter the external IP address and then use port forwarding. > > Just google for that term (port forwarding) ... For example: > > http://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/ > http://en.wikipedia.org/wiki/Port_forwarding > > Best, > Wolfgang > ________ > From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf > Of John Sorkin [jsor...@grecc.umaryland.edu] > Sent: Saturday, April 12, 2014 7:37 PM > To: fransiepansiekever...@gmail.com > Cc: r-help@r-project.org > Subject: Re: [R] R, RStudio, and a server for my iPad. > > Grand, > Thank you. I have been able to use my iPad to connect to a server running > RStudio server as described in an earlier email and can use the virtual > keyboard, which works but is not convenient as one needs to go from keyboard > screen to another. > My current problem is that while I can get everything to work when my iPad is > on my local network, I don't know how to access my server from outside my > LAN. I know my server's private IP address I know my cable modem's external > IP address, but I have no idea what IP address to enter in my iPad, when my > iPad is outside my LAN trying to access my server. > John > __ > R-help@r-project.org mailing list > 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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] Listing folders on One Drive
I would just use fi <- file.info(dir(path, recursive=TRUE, include.dirs=TRUE)) path could be the OneDrive directory or Scotland (and is not needed if you're already in the directory you want). Then rownames(subset(fi, isdir)) will contain all the directories. Maybe you want to use grep or other machinery to thin it out. Regards, Jorgen Harmse. -- Message: 1 Date: Mon, 20 May 2024 14:36:58 +0100 From: Nick Wray mailto:nickmw...@gmail.com>> To: r-help@r-project.org <mailto:r-help@r-project.org> Subject: [R] Listing folders on One Drive Message-ID: mailto:ds4we...@mail.gmail.com>> Content-Type: text/plain; charset="utf-8" Hello I have lots of folders of individual Scottish river catchments on my uni One Drive. Each folder is labelled with the river name eg "Tay" and they are all in a folder named "Scotland" I want to list the folders on One Drive so that I can cross check that I have them all against a list of folders on my laptop. Can I somehow use list.files() - I've tried various things but none seem to work... Any help appreciated Thanks Nick Wray [[alternative HTML version deleted]] ______ 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] wrtiteBin in conjunction with seek : the position in the file is not good when writing
It works !! Thank you VERY much because I didn't understand the rw argument for the seek command and endeed it is explained: File connections can be open for both writing/appending, in which case*R*keeps separate positions for reading and writing. Which|seek|refers to can be set by its|rw|argument: the default is the last mode (reading or writing) which was used. Most files are only opened for reading or writing and so default to that state. If a file is open for both reading and writing but has not been used, the default is to give the reading position (0). Best regards Laurent Le 21/05/2024 à 12:15, Ivan Krylov a écrit : > В Tue, 21 May 2024 11:29:33 +0200 > Laurent Rhelp пишет: > >> pos <- seek(con_in,2,origin="start") >> # We have to repeat the command to return the good amount of read >> # bytes >> print(paste0("pos is not equal to 2, pos = ",pos)) > That's because seek() returns the previous position ("before any > move", the one that the help page calls "current"), not the one after > the seek. Fortunately, calling seek(origin = "start") twice with the > same offset doesn't break anything. > >> # we are on position 6 >> pos <- seek(con_in,0,origin="current") > That's strange. You started at offset 2 and read three bytes. You > should be at offset 5 at this point. For me, seek() returns 5 here, not > 6. > >> bytes = readBin(con=con_in, what="raw",n = 1) > But after this, we should be on position 6. > >> writeBin( my_string, con=con_in, useBytes = FALSE) > It's described in help(seek) that R maintains two different pointers > for reading and writing a file. You have been reading it, advancing the > read pointer to 6, but the write pointer stayed at offset 0. > > Try seek(con_in, seek(con_in, 0, 'current', 'read'), 'start', 'write') > to set the write pointer to the read pointer before issuing writes. > This seems to give me the expected result. > [[alternative HTML version deleted]] __ 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] wrtiteBin in conjunction with seek : the position in the file is not good when writing
В Tue, 21 May 2024 11:29:33 +0200 Laurent Rhelp пишет: > pos <- seek(con_in,2,origin="start") > # We have to repeat the command to return the good amount of read > # bytes > print(paste0("pos is not equal to 2, pos = ",pos)) That's because seek() returns the previous position ("before any move", the one that the help page calls "current"), not the one after the seek. Fortunately, calling seek(origin = "start") twice with the same offset doesn't break anything. > # we are on position 6 > pos <- seek(con_in,0,origin="current") That's strange. You started at offset 2 and read three bytes. You should be at offset 5 at this point. For me, seek() returns 5 here, not 6. > bytes = readBin(con=con_in, what="raw",n = 1) But after this, we should be on position 6. > writeBin( my_string, con=con_in, useBytes = FALSE) It's described in help(seek) that R maintains two different pointers for reading and writing a file. You have been reading it, advancing the read pointer to 6, but the write pointer stayed at offset 0. Try seek(con_in, seek(con_in, 0, 'current', 'read'), 'start', 'write') to set the write pointer to the read pointer before issuing writes. This seems to give me the expected result. -- Best regards, Ivan __ 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] wrtiteBin in conjunction with seek : the position in the file is not good when writing
Dear RHelp-list, I want to write at a specific position in a file without reading all the file because it is very large and I cannot read it in my RAM. But I miss something about the use of the command writeBin in conjunction with seek. In the example bellow the seek commands works well with the readBin command but not with writeBin, the writeBin command write from the beginning of the file and not from the current position and however in the doculentation it is written: If the connection is open it is read/written from its current position. Thank you Best regards Laurent Here is the tiny example: The file_test.txt before: 1234567890 1234567890 The file_test.txt after: AA AA7890 1234567890 The file should have been like that: 123456 AA AA1234567890 ## open the file in read/write mode + binary fname <- file.path(".","txt","file_test.txt") con_in <- file(fname,"r+b") # move on 2 bytes pos <- seek(con_in,2,origin="start") # We have to repeat the command to return the good amount of read bytes print(paste0("pos is not equal to 2, pos = ",pos)) pos <- seek(con_in,2,origin="start") print(paste0("Now pos is equal to 2, pos = ",pos)) ## reading 3 characters bytes = readBin(con=con_in, what="raw",n = 3) my_number <- as.numeric(readBin(bytes,"character")) print(my_number) # we are on position 6 pos <- seek(con_in,0,origin="current") print(paste0("pos = ",pos)) bytes = readBin(con=con_in, what="raw",n = 1) my_number <- as.numeric(readBin(bytes,"character")) print(my_number) my_string <- charToRaw(sprintf(paste('%',3,'s',sep=''),"AA")) writeBin( my_string, con=con_in, useBytes = FALSE) writeBin( my_string, con=con_in, useBytes = FALSE) close(con_in) __ 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] R-help Digest, Vol 255, Issue 17
You might be interested in the `Rdatasets` package, https://vincentarelbundock.github.io/Rdatasets/ which lists over 2200 datasets from various packages. What is the context of the `lottery` dataset. I seem to recall smth to do with the NJ Lottery -Michael 1. Availability of Sdatasets (Avro Alo) -- Message: 1 Date: Sun, 19 May 2024 08:58:20 + From: Avro Alo To: "r-help@r-project.org" Subject: [R] Availability of Sdatasets Message-ID: <8I3Bj0m1IzC35J4nEoROCf1yZD66oeLHFLtxsXKSty3vplcl5gKp-_XmdSvEbG0UYtxv8g0Jw0ihsR5x0MS0QdF7DOmooZ2C9BJVqUUlNSQ=@protonmail.com> Content-Type: text/plain; charset="utf-8" >From the mention in R-intro I went to look at The new S language book. In chapter 1 it has a lottery dataset. So naturally I thought it is pre-supplied with R. But I didn't fount, made a google search and found the package that has the dataset, https://docs.tibco.com/pub/enterprise-runtime-for-R/6.1.1/doc/html/Language_Reference/Sdatasets/00Index.html This package is very interesting on it's own. But how can I get it? Also, shouldn't regular R installation have this too? Thanks! (first time posting here) -- Subject: Digest Footer _______ R-help@r-project.org mailing list 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. ------ End of R-help Digest, Vol 255, Issue 17 ______ 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] Listing folders on One Drive
Dear Nick, See list.dirs(), which is documented in the same help file as list.files(). I hope this helps, John -- John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada web: https://www.john-fox.ca/ -- On 2024-05-20 9:36 a.m., Nick Wray wrote: [You don't often get email from nickmw...@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] Caution: External email. Hello I have lots of folders of individual Scottish river catchments on my uni One Drive. Each folder is labelled with the river name eg "Tay" and they are all in a folder named "Scotland" I want to list the folders on One Drive so that I can cross check that I have them all against a list of folders on my laptop. Can I somehow use list.files() - I've tried various things but none seem to work... Any help appreciated Thanks Nick Wray [[alternative HTML version deleted]] __________ 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-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] Listing folders on One Drive
Nick, As Jeff said, we don't know what you tried and what did not work. There are built-in and probably package versions but have you tried something like list.files()? You can tweak it to get the files you want by doing something like: -change directory to HERE - here.files <- list.files(recursive=TRUE) - change directory to THERE - here.files <- list.files(recursive=TRUE) Now compare what you have in the two places. There are many ways but if all the files in or, if recursive, deeper, are the same, you have them all. Of course this does not test to see if the files are identical. Or you could use sorting and comparing to see if you can isolate what is missing, or use set operations that test for intersection or something like" Missing <- setdiff(here.files, there.files) And in that case, also test the reverse. The function setequal() test for equality but won't tell you what is missing. Obviously, if your method generates full, not relative file names, you could process the names to remove a fixed prefix. -Original Message- From: R-help On Behalf Of Nick Wray Sent: Monday, May 20, 2024 9:37 AM To: r-help@r-project.org Subject: [R] Listing folders on One Drive Hello I have lots of folders of individual Scottish river catchments on my uni One Drive. Each folder is labelled with the river name eg "Tay" and they are all in a folder named "Scotland" I want to list the folders on One Drive so that I can cross check that I have them all against a list of folders on my laptop. Can I somehow use list.files() - I've tried various things but none seem to work... Any help appreciated Thanks Nick Wray [[alternative HTML version deleted]] ______ 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-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] Listing folders on One Drive
What does "doesn't work" mean? What have you tried? On May 20, 2024 6:36:58 AM PDT, Nick Wray wrote: >Hello I have lots of folders of individual Scottish river catchments on my >uni One Drive. Each folder is labelled with the river name eg "Tay" and >they are all in a folder named "Scotland" >I want to list the folders on One Drive so that I can cross check that I >have them all against a list of folders on my laptop. >Can I somehow use list.files() - I've tried various things but none seem to >work... >Any help appreciated >Thanks Nick Wray > > [[alternative HTML version deleted]] > >__ >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. -- Sent from my phone. Please excuse my brevity. __ 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] Listing folders on One Drive
Hello I have lots of folders of individual Scottish river catchments on my uni One Drive. Each folder is labelled with the river name eg "Tay" and they are all in a folder named "Scotland" I want to list the folders on One Drive so that I can cross check that I have them all against a list of folders on my laptop. Can I somehow use list.files() - I've tried various things but none seem to work... Any help appreciated Thanks Nick Wray [[alternative HTML version deleted]] __________ 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] Availability of Sdatasets
>From the mention in R-intro I went to look at The new S language book. In chapter 1 it has a lottery dataset. So naturally I thought it is pre-supplied with R. But I didn't fount, made a google search and found the package that has the dataset, https://docs.tibco.com/pub/enterprise-runtime-for-R/6.1.1/doc/html/Language_Reference/Sdatasets/00Index.html This package is very interesting on it's own. But how can I get it? Also, shouldn't regular R installation have this too? Thanks! (first time posting here) __ 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] [External] Re: Removing polygons from shapefile of Scotland and Islands
Scotland is the second feature in the UK data, so get it and split this one MULTIPOLYGON feature into individual POLYGONS scot = st_cast(the_uk$geometry[2],"POLYGON") # which is the largest polygon? which.max(st_area(scot)) [1] 1 # the first one. ok... plot(scot[[1]]) # mainland # add the rest of the islands for context, in grey, maybe to show they're outside our study area: for(i in 2:length(scot)){plot(scot[[i]], col="grey", add=TRUE)} There are 2794 polygons in Scotland (according to this data)... Barry On Tue, May 14, 2024 at 4:40 PM Jan van der Laan wrote: > This email originated outside the University. Check before clicking links > or attachments. > > I believe mapshaper has functionality for removing small 'islands'. > There is a webinterface for mapshaper, but I see there is also an > R-package (see > > https://search.r-project.org/CRAN/refmans/rmapshaper/html/ms_filter_islands.html > for island removal). > > If you want to manually select which islands to keep and which to > remove, you can split multipolygons into single polygons. I believe that > is possible using st_cast. > > But if it is just getting the relevant portion of the map on screen. > With the plot-command and using st_viewport it is possible to set the > part of the map that is drawn. > > HTH, > Jsn > > > On 14-05-2024 15:16, Nick Wray wrote: > > Hello I have a shapefile of Scotland, including the islands. The river > > flow data I am using is only for the mainland and for a clearer and > larger > > map I would like to not plot Orkney and Shetland to the north of the > > mainland, as I don't need them. > > > > The map I have I got from > > > https://borders.ukdataservice.ac.uk/easy_download_data.html?data=infuse_ctry_2011 > > > > then I put the uk shapefile onto my laptop with no problems (I have sf > > running) > > > > > the_uk<-st_read(dsn="C:/Users/nickm/Desktop/Shapefiles/infuse_ctry_2011.shp") > > > > scotland<-the_uk[2,] > > > > plot(scotland$geometry) > > > > This gives me a nice map of Scotland plus islands but obviously there > are > > lots of separate polygons and if I go into the points with something like > > > > scot_pts<-unlist(as.data.frame(scotland$geometry)) > > > > it's not at all clear how I can get rid of the points I don't want as > they > > don't seem to be listed in any easy way to find where one polygon stops > and > > another starts > > > > I am wondering whether this approach is right anyway or whether there is > > some sf function which would allow me to identify the polygons I want - > > essentially the big one which is the mainland without lots of elaborate > > conversions and manipulations > > > > Any pointers, thoughts etc much appreciated > > > > Thanks Nick Wray > > > > [[alternative HTML version deleted]] > > > > __________ > > 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-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. > [[alternative HTML version deleted]] __ 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] Current version of R, 4.4.0 and patch to correct the bug fix related to the RStudio viewer pane on Windows systems
We are a government agency so it's an issue. But I appreciate your input and Duncan's as well. We have the answer we needed based on Duncan's response. Thank you for your time! av Ann Vega, PSPO She/Her/Hers (Learn More<https://intranet.ord.epa.gov/dei/gender-pronouns>) Office of Science Information Management, Data Architect EPA Office of Research and Development Cincinnati, OH Mobile: 513-418-1922 - or reach out to me on Teams! Hours: Monday-Thursday, 7:30am - 6:00 pm, CDO: Fridays Email: vega@epa.gov<mailto:vega@epa.gov> From: CALUM POLWART Sent: Thursday, May 16, 2024 1:38 PM To: Vega, Ann (she/her/hers) Cc: R-help@r-project.org Subject: Re: [R] Current version of R, 4.4.0 and patch to correct the bug fix related to the RStudio viewer pane on Windows systems Caution: This email originated from outside EPA, please exercise additional caution when deciding whether to open attachments or click on provided links. Do you receive RDS objects from unknown (untrusted) sources? ?? If not - the security issue is a non-issue as I understand it. On Thu, 16 May 2024, 16:21 Vega, Ann (she/her/hers) via R-help, mailto:r-help@r-project.org>> wrote: I help to coordinate the USEPA's R user group. We have over 500 members and our security officer has required us to update to R version 4.4.0 because of the security vulnerability to versions prior. However, we cannot download the patched version because it does not have a signed certificate and Microsoft Defender won't allow us to install it. Most of our users rely on the RStudio viewer pane so we are in a bit of a quandary. We suspect other government agencies are impacted by this as well. Can you give me an estimated time for when another official version will be released with the patch included? I may be able to ask our security officer to allow us to delay our install until that official version is released. Alternatively, if the patched version could have a signed certificate, that would allow us to install it. Thank you. Ann Vega, PSPO She/Her/Hers (Learn More<https://intranet.ord.epa.gov/dei/gender-pronouns>) Office of Science Information Management, Data Architect EPA Office of Research and Development Cincinnati, OH Mobile: 513-418-1922 - or reach out to me on Teams! Hours: Monday-Thursday, 7:30am - 6:00 pm, CDO: Fridays Email: vega@epa.gov<mailto:vega@epa.gov><mailto:vega@epa.gov<mailto:vega@epa.gov>> [[alternative HTML version deleted]] __________ R-help@r-project.org<mailto: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<http://www.r-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ 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] Current version of R, 4.4.0 and patch to correct the bug fix related to the RStudio viewer pane on Windows systems
Yes, but this sounds more like a bureaucratic requirement ("all available patches must be installed") and less like something someone has thought through. It's conceivable that one might be able to talk to a security officer and convince them that this is not in fact an important issue, but I'm not optimistic about that ... Ben Bolker On 2024-05-16 1:38 p.m., CALUM POLWART wrote: Do you receive RDS objects from unknown (untrusted) sources? ?? If not - the security issue is a non-issue as I understand it. On Thu, 16 May 2024, 16:21 Vega, Ann (she/her/hers) via R-help, < r-help@r-project.org> wrote: I help to coordinate the USEPA's R user group. We have over 500 members and our security officer has required us to update to R version 4.4.0 because of the security vulnerability to versions prior. However, we cannot download the patched version because it does not have a signed certificate and Microsoft Defender won't allow us to install it. Most of our users rely on the RStudio viewer pane so we are in a bit of a quandary. We suspect other government agencies are impacted by this as well. Can you give me an estimated time for when another official version will be released with the patch included? I may be able to ask our security officer to allow us to delay our install until that official version is released. Alternatively, if the patched version could have a signed certificate, that would allow us to install it. Thank you. Ann Vega, PSPO She/Her/Hers (Learn More<https://intranet.ord.epa.gov/dei/gender-pronouns ) Office of Science Information Management, Data Architect EPA Office of Research and Development Cincinnati, OH Mobile: 513-418-1922 - or reach out to me on Teams! Hours: Monday-Thursday, 7:30am - 6:00 pm, CDO: Fridays Email: vega@epa.gov<mailto:vega@epa.gov> [[alternative HTML version deleted]] ______ 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. [[alternative HTML version deleted]] ______ 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-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] Current version of R, 4.4.0 and patch to correct the bug fix related to the RStudio viewer pane on Windows systems
Do you receive RDS objects from unknown (untrusted) sources? ?? If not - the security issue is a non-issue as I understand it. On Thu, 16 May 2024, 16:21 Vega, Ann (she/her/hers) via R-help, < r-help@r-project.org> wrote: > I help to coordinate the USEPA's R user group. We have over 500 members > and our security officer has required us to update to R version 4.4.0 > because of the security vulnerability to versions prior. However, we > cannot download the patched version because it does not have a signed > certificate and Microsoft Defender won't allow us to install it. > > Most of our users rely on the RStudio viewer pane so we are in a bit of a > quandary. We suspect other government agencies are impacted by this as > well. > > Can you give me an estimated time for when another official version will > be released with the patch included? I may be able to ask our security > officer to allow us to delay our install until that official version is > released. Alternatively, if the patched version could have a signed > certificate, that would allow us to install it. > > Thank you. > > Ann Vega, PSPO > She/Her/Hers (Learn More<https://intranet.ord.epa.gov/dei/gender-pronouns > >) > Office of Science Information Management, Data Architect > EPA Office of Research and Development > Cincinnati, OH > > Mobile: 513-418-1922 - or reach out to me on Teams! > Hours: Monday-Thursday, 7:30am - 6:00 pm, CDO: Fridays > Email: vega@epa.gov<mailto:vega@epa.gov> > > > > [[alternative HTML version deleted]] > > ______ > 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. > [[alternative HTML version deleted]] __ 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] Current version of R, 4.4.0 and patch to correct the bug fix related to the RStudio viewer pane on Windows systems
The developer.r-project.org site lists plans for releases, and no plan is in place yet for a 4.4.1 release. You can look at the history of previous versions if you want to make a guess: 4.3.1: June, 2023 4.2.1: June, 2022 4.1.1: August, 2021 4.0.1: June, 2020 3.6.1: July, 2019 3.5.1: July, 2018 3.4.1: June, 2017 3.3.1: June, 2016 So it's a good guess that it will happen before September, and better than even odds it will be before July. Duncan Murdoch On 2024-05-16 7:39 a.m., Vega, Ann (she/her/hers) via R-help wrote: I help to coordinate the USEPA's R user group. We have over 500 members and our security officer has required us to update to R version 4.4.0 because of the security vulnerability to versions prior. However, we cannot download the patched version because it does not have a signed certificate and Microsoft Defender won't allow us to install it. Most of our users rely on the RStudio viewer pane so we are in a bit of a quandary. We suspect other government agencies are impacted by this as well. Can you give me an estimated time for when another official version will be released with the patch included? I may be able to ask our security officer to allow us to delay our install until that official version is released. Alternatively, if the patched version could have a signed certificate, that would allow us to install it. Thank you. Ann Vega, PSPO She/Her/Hers (Learn More<https://intranet.ord.epa.gov/dei/gender-pronouns>) Office of Science Information Management, Data Architect EPA Office of Research and Development Cincinnati, OH Mobile: 513-418-1922 - or reach out to me on Teams! Hours: Monday-Thursday, 7:30am - 6:00 pm, CDO: Fridays Email: vega@epa.gov<mailto:vega@epa.gov> [[alternative HTML version deleted]] __________ 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-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] Current version of R, 4.4.0 and patch to correct the bug fix related to the RStudio viewer pane on Windows systems
I help to coordinate the USEPA's R user group. We have over 500 members and our security officer has required us to update to R version 4.4.0 because of the security vulnerability to versions prior. However, we cannot download the patched version because it does not have a signed certificate and Microsoft Defender won't allow us to install it. Most of our users rely on the RStudio viewer pane so we are in a bit of a quandary. We suspect other government agencies are impacted by this as well. Can you give me an estimated time for when another official version will be released with the patch included? I may be able to ask our security officer to allow us to delay our install until that official version is released. Alternatively, if the patched version could have a signed certificate, that would allow us to install it. Thank you. Ann Vega, PSPO She/Her/Hers (Learn More<https://intranet.ord.epa.gov/dei/gender-pronouns>) Office of Science Information Management, Data Architect EPA Office of Research and Development Cincinnati, OH Mobile: 513-418-1922 - or reach out to me on Teams! Hours: Monday-Thursday, 7:30am - 6:00 pm, CDO: Fridays Email: vega@epa.gov<mailto:vega@epa.gov> [[alternative HTML version deleted]] __________ 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] Least error-prone reading of Excel files?
https://www.r-bloggers.com/2021/06/reading-data-from-excel-files-xlsxlsxcsv-into-r-quick-guide/ Excel can hold a great quantity of data. However, I find that it is slow and often crashes when I try to use Excel at large scale. It also grinds my entire system to a halt. At the kb and mb scales I typically have few problems. At gb scales Excel will hold the data, but doing anything with it is problematic (for me). I have used readxl and associated read_excel() in R and not noticed issues at my small scales. I could read a file multiple times in different data frames and then compare them but that too is slow and can exceed system resources. I only deal with a few files, so I would use something like 7-zip to decompress the files before having R read them. I would bet that there are existing programs that would unzip large batches of files, but I have never had to do this where the target files are scattered amongst other files that are not needed. If I can use "select all" then that is simple enough. Tim -Original Message----- From: R-help On Behalf Of DynV Montrealer Sent: Thursday, May 16, 2024 9:51 AM To: r-help@r-project.org Subject: [R] Least error-prone reading of Excel files? [External Email] I'm tasked to read a table from an excel file and it doesn't mention which method to use. I went back some lessons ago and the 5 years old lesson mentioned to pick a package using the highest score the way of the attached (screenshot). Since there's no requirement of a method to read Excel files, I'd rather use the least error-prone one; what would that be? eg will try multiple decompression algorithm if there's a decompression error. Thank you kindly ______ 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] Least error-prone reading of Excel files?
I'm tasked to read a table from an excel file and it doesn't mention which method to use. I went back some lessons ago and the 5 years old lesson mentioned to pick a package using the highest score the way of the attached (screenshot). Since there's no requirement of a method to read Excel files, I'd rather use the least error-prone one; what would that be? eg will try multiple decompression algorithm if there's a decompression error. Thank you kindly __ 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] Extracting values from Surv function in survival package
I don't think that gives the summary of event numbers without extra work. library(survival) fit <- survfit( Surv(time,status)~sex,data=lung) summary(fit)$n.event [1] 3 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 3 1 1 1 1 1 2 [38] 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 [112] 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [149] 1 1 You can get something out using: summary(fit)$table[,"events"] sex=1 sex=2 11253 But there are sub-options in the summary that might work. summary(fit, times =1022, extend=T)$n.event [1] 112 53 times=1022 is the maximum time in the lung dataset (you will need your maximum) and extend=T, extends the other curves to that data point allowing totals for events at that data point On Thu, 16 May 2024, 08:53 Göran Broström, wrote: > Hi Dennis, > > look at the help page for summary.survfit, the Value n.event. > > Göran > > On 2024-05-15 22:41, Dennis Fisher wrote: > > OS X > > R 4.3.3 > > > > Colleagues > > > > I have created objects using the Surv function in the survival package: > >> FIT.1 > > Call: survfit(formula = FORMULA1) > > > > n events median 0.95LCL 0.95UCL > > SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA > > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA > > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5 5168 81 NA > > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3 1 1 22 NA NA > > > > I am interested in extracting the “n” and “events” values. > > “n” is easy: > >> FIT.1[[1]] > > [1] 18 13 5 1 > > > > or > >> FIT.1$n > > [1] 18 13 5 1 > > > > But I can’t figure out how to access “events”. > > > > str(FIT.1) provides no insights: > > List of 17 > > $ n: int [1:4] 18 13 5 1 > > $ time : num [1:37] 45 106 107 124 152 156 170 176 319 371 ... > > $ n.risk : num [1:37] 18 17 16 15 14 13 12 11 10 9 ... > > $ n.event : num [1:37] 1 1 1 1 1 1 1 1 1 1 ... > > $ n.censor : num [1:37] 0 0 0 0 0 0 0 0 0 0 ... > > $ surv : num [1:37] 0.944 0.889 0.833 0.778 0.722 ... > > $ std.err : num [1:37] 0.0572 0.0833 0.1054 0.126 0.1462 ... > > $ cumhaz : num [1:37] 0.0556 0.1144 0.1769 0.2435 0.315 ... > > $ std.chaz : num [1:37] 0.0556 0.0809 0.1022 0.1221 0.1414 ... > > $ strata : Named int [1:4] 18 13 5 1 > >..- attr(*, "names")= chr [1:4] "SUBDATA$ARM=1, SUBDATA[, > EXP.STRAT]=0" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1" "SUBDATA$ARM=2, > SUBDATA[, EXP.STRAT]=2" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3" > > $ type : chr "right" > > $ logse: logi TRUE > > $ conf.int : num 0.95 > > $ conf.type: chr "log" > > $ lower: num [1:37] 0.844 0.755 0.678 0.608 0.542 ... > > $ upper: num [1:37] 1 1 1 0.996 0.962 ... > > $ call : language survfit(formula = FORMULA1) > > - attr(*, "class")= chr "survfit" > > > > If I could access: > > n events median 0.95LCL 0.95UCL > > SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA > > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA > > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5 5168 81 NA > > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3 1 1 22 NA NA > > it should be easy to get “events”. > > > > Any thoughts? > > > > Dennis > > > > Dennis Fisher MD > > P < (The "P Less Than" Company) > > Phone / Fax: 1-866-PLessThan (1-866-753-7784) > > www.PLessThan.com > > > > __ > > 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-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. > [[alternative HTML version deleted]] __ 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] segmented 2.1-0 is released
dear R users, I am pleased to announce that segmented 2.1-0 is now available on CRAN. segmented focuses on estimation of breakpoints/changepoints of segmented, i.e. piecewise linear, relationships in (generalized) linear models. Starting with version 2.0-0, it is also possible to model stepmented, i.e. piecewise constant, effects. In the last release both models may be fitted via a formula interface, such as segreg(y ~ seg(x1, npsi=2) + seg(x2) + z) stepreg(y ~ seg(x1, npsi=2) + seg(x2) +seg(x3, npsi=3) + z, family=poisson) There is virtually no limit in the number of covariates and corresponding number of changepoints to be estimated. thank you, kind regards, Vito -- = Vito M.R. Muggeo, PhD Professor of Statistics Dip.to Sc Econom, Az e Statistiche Università di Palermo viale delle Scienze, edificio 13 90128 Palermo - ITALY tel: 091 23895240; fax: 091 485726 http://www.unipa.it/persone/docenti/m/vito.muggeo Assoc Editor: Statist Modelling, Statist Meth Appl past chair, Statistical Modelling Society coordinator, PhD Program in Econ, Businss, Statist ___ 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] Extracting values from Surv function in survival package
Hi Dennis, look at the help page for summary.survfit, the Value n.event. Göran On 2024-05-15 22:41, Dennis Fisher wrote: OS X R 4.3.3 Colleagues I have created objects using the Surv function in the survival package: FIT.1 Call: survfit(formula = FORMULA1) n events median 0.95LCL 0.95UCL SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5 5168 81 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3 1 1 22 NA NA I am interested in extracting the “n” and “events” values. “n” is easy: FIT.1[[1]] [1] 18 13 5 1 or FIT.1$n [1] 18 13 5 1 But I can’t figure out how to access “events”. str(FIT.1) provides no insights: List of 17 $ n: int [1:4] 18 13 5 1 $ time : num [1:37] 45 106 107 124 152 156 170 176 319 371 ... $ n.risk : num [1:37] 18 17 16 15 14 13 12 11 10 9 ... $ n.event : num [1:37] 1 1 1 1 1 1 1 1 1 1 ... $ n.censor : num [1:37] 0 0 0 0 0 0 0 0 0 0 ... $ surv : num [1:37] 0.944 0.889 0.833 0.778 0.722 ... $ std.err : num [1:37] 0.0572 0.0833 0.1054 0.126 0.1462 ... $ cumhaz : num [1:37] 0.0556 0.1144 0.1769 0.2435 0.315 ... $ std.chaz : num [1:37] 0.0556 0.0809 0.1022 0.1221 0.1414 ... $ strata : Named int [1:4] 18 13 5 1 ..- attr(*, "names")= chr [1:4] "SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3" $ type : chr "right" $ logse: logi TRUE $ conf.int : num 0.95 $ conf.type: chr "log" $ lower: num [1:37] 0.844 0.755 0.678 0.608 0.542 ... $ upper: num [1:37] 1 1 1 0.996 0.962 ... $ call : language survfit(formula = FORMULA1) - attr(*, "class")= chr "survfit" If I could access: n events median 0.95LCL 0.95UCL SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5 5168 81 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3 1 1 22 NA NA it should be easy to get “events”. Any thoughts? Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone / Fax: 1-866-PLessThan (1-866-753-7784) www.PLessThan.com __ 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-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] Extracting values from Surv function in survival package
More difficult than it should be IMO. survminer package is often helpful. But if you want to avoid dependency: library(survival) fit <- survfit( Surv(time,status)~sex,data=lung) surfable <-summary(fit)$table surfable # just the events surfable[,"events"] On Wed, 15 May 2024, 21:42 Dennis Fisher, wrote: > OS X > R 4.3.3 > > Colleagues > > I have created objects using the Surv function in the survival package: > > FIT.1 > Call: survfit(formula = FORMULA1) > >n events median 0.95LCL 0.95UCL > SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5 5168 81 NA > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3 1 1 22 NA NA > > I am interested in extracting the “n” and “events” values. > “n” is easy: > > FIT.1[[1]] > [1] 18 13 5 1 > > or > > FIT.1$n > [1] 18 13 5 1 > > But I can’t figure out how to access “events”. > > str(FIT.1) provides no insights: > List of 17 > $ n: int [1:4] 18 13 5 1 > $ time : num [1:37] 45 106 107 124 152 156 170 176 319 371 ... > $ n.risk : num [1:37] 18 17 16 15 14 13 12 11 10 9 ... > $ n.event : num [1:37] 1 1 1 1 1 1 1 1 1 1 ... > $ n.censor : num [1:37] 0 0 0 0 0 0 0 0 0 0 ... > $ surv : num [1:37] 0.944 0.889 0.833 0.778 0.722 ... > $ std.err : num [1:37] 0.0572 0.0833 0.1054 0.126 0.1462 ... > $ cumhaz : num [1:37] 0.0556 0.1144 0.1769 0.2435 0.315 ... > $ std.chaz : num [1:37] 0.0556 0.0809 0.1022 0.1221 0.1414 ... > $ strata : Named int [1:4] 18 13 5 1 > ..- attr(*, "names")= chr [1:4] "SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0" > "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1" "SUBDATA$ARM=2, SUBDATA[, > EXP.STRAT]=2" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3" > $ type : chr "right" > $ logse: logi TRUE > $ conf.int : num 0.95 > $ conf.type: chr "log" > $ lower: num [1:37] 0.844 0.755 0.678 0.608 0.542 ... > $ upper: num [1:37] 1 1 1 0.996 0.962 ... > $ call : language survfit(formula = FORMULA1) > - attr(*, "class")= chr "survfit" > > If I could access: >n events median 0.95LCL 0.95UCL > SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5 5168 81 NA > SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3 1 1 22 NA NA > it should be easy to get “events”. > > Any thoughts? > > Dennis > > Dennis Fisher MD > P < (The "P Less Than" Company) > Phone / Fax: 1-866-PLessThan (1-866-753-7784) > www.PLessThan.com > > __ > 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. > [[alternative HTML version deleted]] __ 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] Extracting values from Surv function in survival package
OS X R 4.3.3 Colleagues I have created objects using the Surv function in the survival package: > FIT.1 Call: survfit(formula = FORMULA1) n events median 0.95LCL 0.95UCL SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5 5168 81 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3 1 1 22 NA NA I am interested in extracting the “n” and “events” values. “n” is easy: > FIT.1[[1]] [1] 18 13 5 1 or > FIT.1$n [1] 18 13 5 1 But I can’t figure out how to access “events”. str(FIT.1) provides no insights: List of 17 $ n: int [1:4] 18 13 5 1 $ time : num [1:37] 45 106 107 124 152 156 170 176 319 371 ... $ n.risk : num [1:37] 18 17 16 15 14 13 12 11 10 9 ... $ n.event : num [1:37] 1 1 1 1 1 1 1 1 1 1 ... $ n.censor : num [1:37] 0 0 0 0 0 0 0 0 0 0 ... $ surv : num [1:37] 0.944 0.889 0.833 0.778 0.722 ... $ std.err : num [1:37] 0.0572 0.0833 0.1054 0.126 0.1462 ... $ cumhaz : num [1:37] 0.0556 0.1144 0.1769 0.2435 0.315 ... $ std.chaz : num [1:37] 0.0556 0.0809 0.1022 0.1221 0.1414 ... $ strata : Named int [1:4] 18 13 5 1 ..- attr(*, "names")= chr [1:4] "SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2" "SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3" $ type : chr "right" $ logse: logi TRUE $ conf.int : num 0.95 $ conf.type: chr "log" $ lower: num [1:37] 0.844 0.755 0.678 0.608 0.542 ... $ upper: num [1:37] 1 1 1 0.996 0.962 ... $ call : language survfit(formula = FORMULA1) - attr(*, "class")= chr "survfit" If I could access: n events median 0.95LCL 0.95UCL SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13345 156 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5 5168 81 NA SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=3 1 1 22 NA NA it should be easy to get “events”. Any thoughts? Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone / Fax: 1-866-PLessThan (1-866-753-7784) www.PLessThan.com ______ 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] flexsurvspline with offset
Dear all, I am using R 4.4.0 via RStudio (2024.04.0) on a Windows PC. The code below worked on the previous version of the flexsurv but is not working since my recent update (version 2.3). The code that was working is: library(survival) rfs <- pmax(rotterdam$recur, rotterdam$death) rfstime <- with(rotterdam, ifelse(recur==1, rtime, dtime)) fit1 <- flexsurvspline(Surv(rfstime, rfs) ~ age + meno + size + er, k=2, data = rotterdam) # obtain the linear predictor for each patient predf <- model.matrix(fit1) %*% fit1$res[-(1:4),"est"] # Predict baseline survival at 5 years y5_Flex_1 <- summary(fit1,type="survival",t=5) y5_Flex <- y5_Flex_1[[1]]$est y5_Flex # Shrinkage factor vanH <- 0.9589255 heuristic_lp_flex = vanH*predf # Now calculate the shrunken model baseline survival prob at 5 years by fixing the shrunken lp as an offset and predicting the baseline survival fit1_shrunk <- flexsurvspline(Surv(rfstime,rfs)~offset(heuristic_lp_flex),k=2,data=rotterdam) The error message is Error in model.matrix.default(forms[[i]], m) : model frame and formula mismatch in model.matrix() Any suggestions gratefully received!!! Kind regards, Laura [[alternative HTML version deleted]] __________ 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] Removing polygons from shapefile of Scotland and Islands
I believe mapshaper has functionality for removing small 'islands'. There is a webinterface for mapshaper, but I see there is also an R-package (see https://search.r-project.org/CRAN/refmans/rmapshaper/html/ms_filter_islands.html for island removal). If you want to manually select which islands to keep and which to remove, you can split multipolygons into single polygons. I believe that is possible using st_cast. But if it is just getting the relevant portion of the map on screen. With the plot-command and using st_viewport it is possible to set the part of the map that is drawn. HTH, Jsn On 14-05-2024 15:16, Nick Wray wrote: Hello I have a shapefile of Scotland, including the islands. The river flow data I am using is only for the mainland and for a clearer and larger map I would like to not plot Orkney and Shetland to the north of the mainland, as I don't need them. The map I have I got from https://borders.ukdataservice.ac.uk/easy_download_data.html?data=infuse_ctry_2011 then I put the uk shapefile onto my laptop with no problems (I have sf running) the_uk<-st_read(dsn="C:/Users/nickm/Desktop/Shapefiles/infuse_ctry_2011.shp") scotland<-the_uk[2,] plot(scotland$geometry) This gives me a nice map of Scotland plus islands but obviously there are lots of separate polygons and if I go into the points with something like scot_pts<-unlist(as.data.frame(scotland$geometry)) it's not at all clear how I can get rid of the points I don't want as they don't seem to be listed in any easy way to find where one polygon stops and another starts I am wondering whether this approach is right anyway or whether there is some sf function which would allow me to identify the polygons I want - essentially the big one which is the mainland without lots of elaborate conversions and manipulations Any pointers, thoughts etc much appreciated Thanks Nick Wray [[alternative HTML version deleted]] ______ 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-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] Altrep and translations (was " Description of error is untranslated when ....")
Hello On the other hand, i find that R_compact_intrange checks whether (r = n2 - n1 + 1) >= R_XLEN_T_MAX, while seq_colon checks for (r = fabs(n2 - n1)) >= R_XLEN_T_MAX. And only then n is defined as r + 1 + epsilon. r is not used again That is why seq_colon does not reject that size at first and then altrep does. Should not line 101 be " if (r + 1 + FLT_EPSILON >= R_XLEN_T_MAX) " instead of r >= R_XLEN_T_MAX? El mar, 14 may 2024 a las 4:45, Martin Maechler () escribió: > >>>>> Ivan Krylov via R-help > >>>>> on Tue, 14 May 2024 08:08:58 +0300 writes: > > > Dear Ricardo Villalba, Thank you for spotting this corner > > case! > > > В Mon, 13 May 2024 11:37:57 -0300 Ricardo Villalba > > пишет: > > >> I track the messages to be coded here: > >> > https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/altclasses.c#L580 > >> and here > >> > https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/seq.c#L102 > > > You may have noticed that one of these places lacks the > > underscore that R uses as the translation keyword: it's > > _(string) that looks up the translation of the string. > > > Would you like to suggest a patch on r-de...@r-project.org > > or https://bugs.r-project.org ? > > > -- > > Best regards, Ivan > > Thank you, but, well... for such small changes -- that would be > quite a bit of (human, i.e. R-core) overhead, but of course is > generally a good possibility (but here, wait! .. and read on : ) > > Actually -- this now gets more "R-devel" - appropriate -- > I notice that there are quite a few error("..." .. ) > and also warning("..." ..) calls in > src/main/altclasses.c *and* in > src/main/altrep.cand *none* of them asks for translation; > > While this could be for historical reasons (code originally much > by Gabe Becker from outside R-core *and* at first just in a > separate branch before being merged in to the main (r-devel) > branch. > OTOH: There may be good reasons for translations lookup being > brittle in case of altrep error messages .. and hence left off > purposely? > > Martin > > -- > Martin Maechler > ETH Zurich and R Core Team > > -- ®DV! [[alternative HTML version deleted]] __ 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] Removing polygons from shapefile of Scotland and Islands
Hello I have a shapefile of Scotland, including the islands. The river flow data I am using is only for the mainland and for a clearer and larger map I would like to not plot Orkney and Shetland to the north of the mainland, as I don't need them. The map I have I got from https://borders.ukdataservice.ac.uk/easy_download_data.html?data=infuse_ctry_2011 then I put the uk shapefile onto my laptop with no problems (I have sf running) the_uk<-st_read(dsn="C:/Users/nickm/Desktop/Shapefiles/infuse_ctry_2011.shp") scotland<-the_uk[2,] plot(scotland$geometry) This gives me a nice map of Scotland plus islands but obviously there are lots of separate polygons and if I go into the points with something like scot_pts<-unlist(as.data.frame(scotland$geometry)) it's not at all clear how I can get rid of the points I don't want as they don't seem to be listed in any easy way to find where one polygon stops and another starts I am wondering whether this approach is right anyway or whether there is some sf function which would allow me to identify the polygons I want - essentially the big one which is the mainland without lots of elaborate conversions and manipulations Any pointers, thoughts etc much appreciated Thanks Nick Wray [[alternative HTML version deleted]] ______ 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] Altrep and translations (was " Description of error is untranslated when ....")
>>>>> Ivan Krylov via R-help >>>>> on Tue, 14 May 2024 08:08:58 +0300 writes: > Dear Ricardo Villalba, Thank you for spotting this corner > case! > В Mon, 13 May 2024 11:37:57 -0300 Ricardo Villalba > пишет: >> I track the messages to be coded here: >> https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/altclasses.c#L580 >> and here >> https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/seq.c#L102 > You may have noticed that one of these places lacks the > underscore that R uses as the translation keyword: it's > _(string) that looks up the translation of the string. > Would you like to suggest a patch on r-de...@r-project.org > or https://bugs.r-project.org ? > -- > Best regards, Ivan Thank you, but, well... for such small changes -- that would be quite a bit of (human, i.e. R-core) overhead, but of course is generally a good possibility (but here, wait! .. and read on : ) Actually -- this now gets more "R-devel" - appropriate -- I notice that there are quite a few error("..." .. ) and also warning("..." ..) calls in src/main/altclasses.c *and* in src/main/altrep.cand *none* of them asks for translation; While this could be for historical reasons (code originally much by Gabe Becker from outside R-core *and* at first just in a separate branch before being merged in to the main (r-devel) branch. OTOH: There may be good reasons for translations lookup being brittle in case of altrep error messages .. and hence left off purposely? Martin -- Martin Maechler ETH Zurich and R Core Team ______ 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] Description of error is untranslated when R_XLEN_T_MAX is exceeded by only 1 element.
Dear Ricardo Villalba, Thank you for spotting this corner case! В Mon, 13 May 2024 11:37:57 -0300 Ricardo Villalba пишет: > I track the messages to be coded here: > https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/altclasses.c#L580 > and here > https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/seq.c#L102 You may have noticed that one of these places lacks the underscore that R uses as the translation keyword: it's _(string) that looks up the translation of the string. Would you like to suggest a patch on r-de...@r-project.org or https://bugs.r-project.org ? -- Best regards, Ivan __________ 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] test2r.mengz1(X)
... but maybe cocor() in the cocor package will do do what you want. -- Bert On Mon, May 13, 2024 at 1:57 PM Duncan Murdoch wrote: > > Google says that function is in the bcdstats package, which isn't on > CRAN. It appears to be a private package for a course, kept on Github. > > Duncan Murdoch > > On 2024-05-13 12:24 p.m., Alligand, Justine wrote: > > Dear participants and subscribers of the R-help mailing list, > > > > I would like to compare two dependent correlations with one overlapping > > variable. The Meng Z1 method seemed suitable for this purpose. I found out > > that the "cocor" package is required for this instrument. I checked several > > times whether the package was installed and activated and both were the > > case. I have also tried the "psych" package, but I get the same error in > > both cases: > >> library(cocor) > >> library(psych) > >> test2r.mengz1(corAVOBMI, corAVVBMI, corAVOAVV, 39) > > Error in test2r.mengz1(corAVOBMI, corAVVBMI, corAVOAVV, 39) : > >could not find function "test2r.mengz1" (Translated from German) > > Do I not have the right package? Or can you recognize another error? > > Many thanks in advance. > > > > Yours faithfully > > Justine Alligand > > > > > > [[alternative HTML version deleted]] > > > > __ > > 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-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-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] test2r.mengz1(X)
Google says that function is in the bcdstats package, which isn't on CRAN. It appears to be a private package for a course, kept on Github. Duncan Murdoch On 2024-05-13 12:24 p.m., Alligand, Justine wrote: Dear participants and subscribers of the R-help mailing list, I would like to compare two dependent correlations with one overlapping variable. The Meng Z1 method seemed suitable for this purpose. I found out that the "cocor" package is required for this instrument. I checked several times whether the package was installed and activated and both were the case. I have also tried the "psych" package, but I get the same error in both cases: library(cocor) library(psych) test2r.mengz1(corAVOBMI, corAVVBMI, corAVOAVV, 39) Error in test2r.mengz1(corAVOBMI, corAVVBMI, corAVOAVV, 39) : could not find function "test2r.mengz1" (Translated from German) Do I not have the right package? Or can you recognize another error? Many thanks in advance. Yours faithfully Justine Alligand [[alternative HTML version deleted]] ______ 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-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] test2r.mengz1(X)
Dear participants and subscribers of the R-help mailing list, I would like to compare two dependent correlations with one overlapping variable. The Meng Z1 method seemed suitable for this purpose. I found out that the "cocor" package is required for this instrument. I checked several times whether the package was installed and activated and both were the case. I have also tried the "psych" package, but I get the same error in both cases: > library(cocor) > library(psych) > test2r.mengz1(corAVOBMI, corAVVBMI, corAVOAVV, 39) Error in test2r.mengz1(corAVOBMI, corAVVBMI, corAVOAVV, 39) : could not find function "test2r.mengz1" (Translated from German) Do I not have the right package? Or can you recognize another error? Many thanks in advance. Yours faithfully Justine Alligand [[alternative HTML version deleted]] ______ 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] [EXTERNAL] Re: duplicated() on zero-column data frames returns empty
Good luck! It looks like a significant effort for someone not already on the team. Regards, Jorgen Harmse. From: Mark Webster Date: Monday, May 13, 2024 at 04:07 To: Jorgen Harmse , Ivan Krylov Cc: r-help@r-project.org Subject: [EXTERNAL] Re: duplicated() on zero-column data frames returns empty > If you would like to try your hand at developing a patch and make a > case for it at R-devel or the Bugzilla, the resources at > <https://contributor.r-project.org/> can be helpful. I am attempting to get admitted onto the Bugzilla at the moment for the data frame cases, fingers crossed! Best Regards, Mark Webster [[alternative HTML version deleted]] ______ 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] Description of error is untranslated when R_XLEN_T_MAX is exceeded by only 1 element.
Typo: *2^48 should be 2^52 El lun, 13 may 2024 a las 11:37, Ricardo Villalba () escribió: > Hello everyone > When asking to create sequence longer than 2^48 (which is forbidden) the > same error message appears translated and untranslated depending on whether > R_XLEN_T_MAX is reached or exceeded > while not an error o problem beyond that of the untranslated text, i find > this weird. ¿could it be fixed in any manner? > > R_XLEN_T_MAX <- 4503599627370496 > > > length(1:(R_XLEN_T_MAX - 1)) > [1] 4.5036e+15 > > length(1:(R_XLEN_T_MAX + 0)) > Error: result would be too long a vector > > length(1:(R_XLEN_T_MAX + 1)) > Error en 1:(R_XLEN_T_MAX + 1): el resultado seria un vector muy largo > > The last is the same as the second, but translated into spanish. > > I track the messages to be coded here: > https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/altclasses.c#L580 > and > here > https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/seq.c#L102 > > -- > ®DV! > -- ®DV! [[alternative HTML version deleted]] __ 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] Description of error is untranslated when R_XLEN_T_MAX is exceeded by only 1 element.
Hello everyone When asking to create sequence longer than 2^48 (which is forbidden) the same error message appears translated and untranslated depending on whether R_XLEN_T_MAX is reached or exceeded while not an error o problem beyond that of the untranslated text, i find this weird. ¿could it be fixed in any manner? R_XLEN_T_MAX <- 4503599627370496 > length(1:(R_XLEN_T_MAX - 1)) [1] 4.5036e+15 > length(1:(R_XLEN_T_MAX + 0)) Error: result would be too long a vector > length(1:(R_XLEN_T_MAX + 1)) Error en 1:(R_XLEN_T_MAX + 1): el resultado seria un vector muy largo The last is the same as the second, but translated into spanish. I track the messages to be coded here: https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/altclasses.c#L580 and here https://github.com/r-devel/r-svn/blob/abe625945c4402cd2bb97b5a64e7469db3e904f0/src/main/seq.c#L102 -- ®DV! [[alternative HTML version deleted]] __________ 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] Is there some way to customize colours for the View output?
В Mon, 13 May 2024 06:08:22 -0400 Duncan Murdoch пишет: > The row and column names don't appear to be controllable from that > menu, they seem (on my machine) to be displayed in the same colour as > the background of a dialog box, i.e. some kind of gray. I don't > think R tries to control that colour, but perhaps some Windows > setting would change it. This is entirely correct: the dialog uses the colour returned by dialog_bg(), which is GetSysColor(COLOR_BTNFACE). I think it could be a reasonable feature request to use an adjustable colour for the row and column headers. -- Best regards, Ivan ______ 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] Is there some way to customize colours for the View output?
I just tried it on an old Windows computer. I don't see dataeditfg in the preferences menu; I think it is the internal variable name used for "dataedittext". The row and column names don't appear to be controllable from that menu, they seem (on my machine) to be displayed in the same colour as the background of a dialog box, i.e. some kind of gray. I don't think R tries to control that colour, but perhaps some Windows setting would change it. Duncan Murdoch On 2024-05-13 4:50 a.m., Iago Giné Vázquez wrote: Hi all, I've just could test your suggestions on using dataedit... entries now, and indeed they work... partially. See, please, the next screenshot: https://ibb.co/Dkn2pVs <https://ibb.co/Dkn2pVs> dataedituser modifies the red borders dataedittext the yellow text dataeditfg... I do not know, specified to green the output of View(mtcars) does not change from that of the screenshot dataeditbg is the (almost) black background, but in the column and row names. I tried the modifying the different colours through the GUI preferences, and the background colour for column and row names did not change. May this be a bug? Thank you for your help. Best regards, Iago *De:* Rolf Turner *Enviat el:* dimarts, 7 de maig de 2024 23:58 *Per a:* Duncan Murdoch *A/c:* Iago Giné Vázquez ; r-help@r-project.org ; Achim Zeileis *Tema:* Re: [R] Is there some way to customize colours for the View output? On Tue, 7 May 2024 06:34:50 -0400 Duncan Murdoch wrote: On 07/05/2024 6:31 a.m., Iago Giné Vázquez wrote: > Thanks Duncan. > > I am currently on Windows. Is there any solution for it? Switch to Linux or MacOS? Fortune nomination! cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't. (secretaries) phone: +64-9-373-7599 ext. 89622 Home phone: +64-9-480-4619 ______ 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] duplicated() on zero-column data frames returns empty
> If you would like to try your hand at developing a patch and make a > case for it at R-devel or the Bugzilla, the resources at > <https://contributor.r-project.org/> can be helpful. I am attempting to get admitted onto the Bugzilla at the moment for the data frame cases, fingers crossed! Best Regards,Mark Webster [[alternative HTML version deleted]] ______ 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] Is there some way to customize colours for the View output?
Hi all, I've just could test your suggestions on using dataedit... entries now, and indeed they work... partially. See, please, the next screenshot: https://ibb.co/Dkn2pVs dataedituser modifies the red borders dataedittext the yellow text dataeditfg... I do not know, specified to green the output of View(mtcars) does not change from that of the screenshot dataeditbg is the (almost) black background, but in the column and row names. I tried the modifying the different colours through the GUI preferences, and the background colour for column and row names did not change. May this be a bug? Thank you for your help. Best regards, Iago De: Rolf Turner Enviat el: dimarts, 7 de maig de 2024 23:58 Per a: Duncan Murdoch A/c: Iago Gin� V�zquez ; r-help@r-project.org ; Achim Zeileis Tema: Re: [R] Is there some way to customize colours for the View output? On Tue, 7 May 2024 06:34:50 -0400 Duncan Murdoch wrote: > On 07/05/2024 6:31 a.m., Iago Gin� V�zquez wrote: > > Thanks Duncan. > > > > I am currently on Windows. Is there any solution for it? > > Switch to Linux or MacOS? Fortune nomination! cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't. (secretaries) phone: +64-9-373-7599 ext. 89622 Home phone: +64-9-480-4619 [[alternative HTML version deleted]] ______ 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] duplicated() on zero-column data frames returns empty
(Sorry for only getting back to this more than a month later.) В Mon, 8 Apr 2024 17:03:00 + Jorgen Harmse пишет: > What is the policy for changing something that is wrong? There is a > trade-off between breaking old code that worked around a problem and > breaking new code written by people who make reasonable assumptions. First of all, quantify the breakage. Does the proposed change break `make check-devel`? Does it break CRAN and BioConductor? (This one is hard to measure properly: someone will have to run >2 R CMD checks times two, for "before the change" and "after the change".) Given a persuasive case, breaking changes can still be made, but will require a deprecation period to let the packages adjust. If you would like to try your hand at developing a patch and make a case for it at R-devel or the Bugzilla, the resources at <https://contributor.r-project.org/> can be helpful. -- Best regards, Ivan ______ 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] R CMD check vs RStudio check
В Fri, 10 May 2024 03:46:54 + "Boylan, Ross" пишет: > The devtools::check() documentation mentions it invoke > pkgbuild::build() and rcmdcheck::rcmdcheck(). Since I'm guessing my > command line build and check invoked those last 2, or at least > operated similarly, they seem less likely suspects. You are correct, it's part of what pkgbuild::build() does: https://search.r-project.org/CRAN/refmans/pkgbuild/html/build.html#clean_doc >> DESCRIPTION entries >> >> Config/build/clean-inst-doc can be set to FALSE to avoid cleaning >> up inst/doc when building a source package. Set it to TRUE to force >> a cleanup. See the clean_doc argument. (I didn't know that either, just searched their source code for "inst.*doc".) -- Best regards, Ivan __ 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] Print date on y axis with month, day, and year
Às 00:58 de 10/05/2024, Sorkin, John escreveu: I am trying to use ggplot to plot the data, and R code, below. The dates (jdate) are printing as Mar 01, Mar 15, etc. I want to have the date printed as MMM DD (or any other way that will show month, date, and year, e.g. mm/dd/yy). How can I accomplish this? yyy <- structure(list( jdate = structure(c(19052, 19053, 19054, 19055, 19058, 19059, 19060, 19061, 19062, 19063, 19065, 19066, 19067, 19068, 19069, 19072, 19073, 19074, 19075, 19076, 19077, 19083, 19086, 19087, 19088, 19089, 19090, 19093, 19094, 19095), class = "Date"), Sum = c ( 1, 3, 9, 11, 13, 16, 18, 22, 26, 27, 30, 32, 35, 39, 41, 43, 48, 51, 56, 58, 59, 63, 73, 79, 81, 88, 91, 93, 96, 103)), row.names = c(NA, 30L), class = "data.frame") yyy class(yyy$jdate) ggplot(data=yyy[1:30,],aes(as.Date(jdate,format="%m-%d-%Y"),Sum)) +geom_point() Thank you John John David Sorkin M.D., Ph.D. Professor of Medicine, University of Maryland School of Medicine; Associate Director for Biostatistics and Informatics, Baltimore VA Medical Center Geriatrics Research, Education, and Clinical Center; PI Biostatistics and Informatics Core, University of Maryland School of Medicine Claude D. Pepper Older Americans Independence Center; Senior Statistician University of Maryland Center for Vascular Research; Division of Gerontology and Paliative Care, 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 Cell phone 443-418-5382 ______ 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, Since class(yyy$jdate) returns "Date", you have a real date and scale_x_date can handle the printed formats, there is no need for an extra as.Date in aes(). And get rid of the format = "%m-%d-%Y" argument. Let scale_x_date take care of formating the date as you want it displayed. Any of the two below is a valid date format. ggplot(data = yyy[1:30,], aes(jdate, Sum)) + geom_point() + # scale_x_date(date_labels = "%b %d, %Y") scale_x_date(date_labels = "%m/%d/%Y") Hope this helps, Rui Barradas -- Este e-mail foi analisado pelo software antivírus AVG para verificar a presença de vírus. www.avg.com __ 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] R CMD check vs RStudio check
Ivan, thank you for the tips; they allowed me to move on to the next problems. By building the tar file first and checking it later, and fixing several other problems I got R CMD check to work. It does *not* delete inst/doc. It also does not run boostrap.R, as far as I can tell, presumably because only devtools does. Check within RStudio continues to delete inst/doc, so this behavior is probably coming from RStudio, devtools, or one the packages it invokes. The devtools::check() documentation mentions it invoke pkgbuild::build() and rcmdcheck::rcmdcheck(). Since I'm guessing my command line build and check invoked those last 2, or at least operated similarly, they seem less likely suspects. As I think I already mentioned, bootstrap.R when run outside of a check, but inside RStudio, also does not delete inst/doc. Anyway, there a lot of moving parts. Does anybody have any ideas? Deleting the directory just seems weird and so it's hard to know where to look. Thanks. Ross -Original Message- From: Ivan Krylov Sent: Friday, May 3, 2024 12:52 PM To: Boylan, Ross via R-help Cc: Boylan, Ross Subject: Re: [R] R CMD check vs RStudio check В Fri, 3 May 2024 19:45:08 + "Boylan, Ross via R-help" пишет: > & $R CMD check . > * checking for file './DESCRIPTION' ... ERROR Required fields missing > or empty: > 'Author' 'Maintainer' You're checking a source package directory. This could work, but it's much easier and more reliable to (1) build a source tarball using R CMD build and (2) check the tarball. This is probably part of what devtools::check() does. (It can also do a lot of other things pre-R CMD build.) The reason checking the source directory is failing is because it's R CMD build that creates the necessary 'Author' and 'Maintainer' fields from Authors@R in your DESCRIPTION. > P.S. What's with the "..Rcheck" log directory, which appears literally > with the 2 dots? Is this just MS-Windows getting confused and not > interpreting .. as the parent directory? "..Rcheck" is built from the argument of R CMD check . followed by ".Rcheck". -- Best regards, Ivan __ 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] Print date on y axis with month, day, and year
gg0 <- ggplot(data=yyy[1:30,],aes(as.Date(jdate,format="%m-%d-%Y"),Sum)) +geom_point() gg0 + scale_x_date(date_labels = "%m/%d/%Y") On 2024-05-09 7:58 p.m., Sorkin, John wrote: I am trying to use ggplot to plot the data, and R code, below. The dates (jdate) are printing as Mar 01, Mar 15, etc. I want to have the date printed as MMM DD (or any other way that will show month, date, and year, e.g. mm/dd/yy). How can I accomplish this? yyy <- structure(list( jdate = structure(c(19052, 19053, 19054, 19055, 19058, 19059, 19060, 19061, 19062, 19063, 19065, 19066, 19067, 19068, 19069, 19072, 19073, 19074, 19075, 19076, 19077, 19083, 19086, 19087, 19088, 19089, 19090, 19093, 19094, 19095), class = "Date"), Sum = c ( 1, 3, 9, 11, 13, 16, 18, 22, 26, 27, 30, 32, 35, 39, 41, 43, 48, 51, 56, 58, 59, 63, 73, 79, 81, 88, 91, 93, 96, 103)), row.names = c(NA, 30L), class = "data.frame") yyy class(yyy$jdate) ggplot(data=yyy[1:30,],aes(as.Date(jdate,format="%m-%d-%Y"),Sum)) +geom_point() Thank you John John David Sorkin M.D., Ph.D. Professor of Medicine, University of Maryland School of Medicine; Associate Director for Biostatistics and Informatics, Baltimore VA Medical Center Geriatrics Research, Education, and Clinical Center; PI Biostatistics and Informatics Core, University of Maryland School of Medicine Claude D. Pepper Older Americans Independence Center; Senior Statistician University of Maryland Center for Vascular Research; Division of Gerontology and Paliative Care, 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 Cell phone 443-418-5382 __ 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-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] Print date on y axis with month, day, and year
I am trying to use ggplot to plot the data, and R code, below. The dates (jdate) are printing as Mar 01, Mar 15, etc. I want to have the date printed as MMM DD (or any other way that will show month, date, and year, e.g. mm/dd/yy). How can I accomplish this? yyy <- structure(list( jdate = structure(c(19052, 19053, 19054, 19055, 19058, 19059, 19060, 19061, 19062, 19063, 19065, 19066, 19067, 19068, 19069, 19072, 19073, 19074, 19075, 19076, 19077, 19083, 19086, 19087, 19088, 19089, 19090, 19093, 19094, 19095), class = "Date"), Sum = c ( 1, 3, 9, 11, 13, 16, 18, 22, 26, 27, 30, 32, 35, 39, 41, 43, 48, 51, 56, 58, 59, 63, 73, 79, 81, 88, 91, 93, 96, 103)), row.names = c(NA, 30L), class = "data.frame") yyy class(yyy$jdate) ggplot(data=yyy[1:30,],aes(as.Date(jdate,format="%m-%d-%Y"),Sum)) +geom_point() Thank you John John David Sorkin M.D., Ph.D. Professor of Medicine, University of Maryland School of Medicine; Associate Director for Biostatistics and Informatics, Baltimore VA Medical Center Geriatrics Research, Education, and Clinical Center; PI Biostatistics and Informatics Core, University of Maryland School of Medicine Claude D. Pepper Older Americans Independence Center; Senior Statistician University of Maryland Center for Vascular Research; Division of Gerontology and Paliative Care, 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 Cell phone 443-418-5382 ______ 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] Compilation problems with R4.4.0
Glad you got R working! В Thu, 9 May 2024 12:19:49 + Simon Andrews пишет: > Does this need reporting upstream as a bug in R or lapack? Maybe in AlmaLinux (and I think RHEL9 too, but that's up to Miguel Esteva). Best case scenario, they somehow built the reference BLAS and LAPACK packages with the wrong Fortran compiler version or flags, which is why gfortran-11 gets a zero instead of the return value from DOUBLE COMPLEX zdotu(...) and crashes when calling dgesv(...) from lapack-3.9.0-10.el9.x86_64. Worst case scenario, the zdotu() problem and the crash have two completely different causes elsewhere. -- Best regards, Ivan __ 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] Strange variable names in factor regression
Comment in in-line below On 09/05/2024 13:09, Naresh Gurbuxani wrote: On converting character variables to ordered factors, regression result has strange names. Is it possible to obtain same variable names with and without intercept? Thanks, Naresh mydf <- data.frame(date = seq.Date(as.Date("2024-01-01"), as.Date("2024-03-31"), by = 1)) mydf[, "wday"] <- weekdays(mydf$date, abbreviate = TRUE) mydf.work <- subset(mydf, !(wday %in% c("Sat", "Sun"))) mydf.weekend <- subset(mydf, wday %in% c("Sat", "Sun")) mydf.work[, "volume"] <- round(rnorm(nrow(mydf.work), mean = 20, sd = 5)) mydf.weekend[, "volume"] <- round(rnorm(nrow(mydf.weekend), mean = 10, sd = 5)) mydf <- rbind(mydf.work, mydf.weekend) reg <- lm(volume ~ wday, data = mydf) ## Variable names as expected coef(reg) (Intercept) wdayMon wdaySat wdaySun wdayThu wdayTue 21.3846154 1.3076923 -12.000 -12.9230769 -1.9230769 -0.6923077 wdayWed -1.6153846 reg <- lm(volume ~ wday - 1, data = mydf) # Variable names as expected coef(reg) wdayFri wdayMon wdaySat wdaySun wdayThu wdayTue wdayWed 21.384615 22.692308 9.384615 8.461538 19.461538 20.692308 19.769231 # Ordered factors for weekday sequence mydf$wday <- factor(mydf$wday, levels = c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"), ordered = TRUE) reg <- lm(volume ~ wday - 1, data = mydf) # Variable names as expected coef(reg) wdayMon wdayTue wdayWed wdayThu wdayFri wdaySat wdaySun 22.692308 20.692308 19.769231 19.461538 21.384615 9.384615 8.461538 reg <- lm(volume ~ wday, data = mydf) # Strange variable names coef(reg) (Intercept) wday.L wday.Q wday.C wday^4 wday^5 17.406593 -12.036715 -4.968654 -1.852819 3.291477 4.263642 wday^6 2.591317 Yes, that is what ordered is supposed to do, fit polynomial contrasts. When you remove the intercept that breaks it so you get a different fit, in fact the same as you got when it was not ordered. Michael __ 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. -- Michael __ 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.