Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet
Hi Tim This is brilliant - thank you!! I've had to tweak the basePath line a bit (I am on a Linux machine), but having done that, the code works as intended. This is a truly helpful contribution that gives me ideas about how to work it through for the missing fields, which is one of the major sticking points I kept bumping up against. Thank you so much for this. All the best Andy On 05/01/2024 13:59, Howard, Tim G (DEC) wrote: Here's a simplified version of how I would do it, using `textreadr` but otherwise base functions. I haven't done it all, but have a few examples of finding the correct row then extracting the right data. I made a duplicate of the file you provided, so this loops through the two identical files, extracts a few parts, then sticks those parts in a data frame. # library(textreadr) # recommend not using setwd(), but instead just include the # path as follows basePath <- file.path("C:","temp") files <- list.files(path=basePath, pattern = "docx$") length(files) # 2 # initialize a list to put the data in myList <- vector(mode = "list", length = length(files)) for(i in 1:length(files)){ fileDat <- read_docx(file.path(basePath, files[[i]])) # get the data you want, here one line per item to make it clearer # assume consistency among articles ttl <- fileDat[[1]] src <- fileDat[[2]] dt <- fileDat[[3]] aut <- fileDat[grepl("Byline:",fileDat)] aut <- trimws(sub("Byline:","",aut), whitespace = "[\\h\\v]") pg <- fileDat[grepl("Pg.",fileDat)] pg <- as.integer(sub(".*Pg. ([[:digit:]]+)","\\1",pg)) len <- fileDat[grepl("Length:", fileDat)] len <- as.integer(sub("Length:.{1}([[:digit:]]+) .*","\\1",len)) myList[[i]] <- data.frame("title"=ttl, "source"=src, "date"=dt, "author"=aut, "page"=pg, "length"=len) } # roll up the list to a data frame. Many ways to do this. myDF <- do.call("rbind",myList) # Hope that helps. Tim -- Date: Thu, 4 Jan 2024 12:59:59 + From: Andy To: r-help@r-project.org Subject: Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet Message-ID: Content-Type: text/plain; charset="utf-8"; Format="flowed" Hi folks Thanks for your help and suggestions - very much appreciated. I now have some working code, using this file I uploaded for public access: https://docs/. google.com%2Fdocument%2Fd%2F1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVER k%2Fedit%3Fusp%3Dsharing%26ouid%3D103065135255080058813%26rtpof% 3Dtrue%26sd%3Dtrue=05%7C02%7Ctim.howard%40dec.ny.gov%7C8f2 952a3ae474d4da14908dc0ddd95fd%7Cf46cb8ea79004d108ceb80e8c1c81ee7 %7C0%7C0%7C638400492578674983%7CUnknown%7CTWFpbGZsb3d8eyJWIj oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3 000%7C%7C%7C=%2BpYrk6cJA%2BDUn9szLbd2Y7R%2F30UNY2TFSJN HcwkHa9Y%3D=0 The small code segment that now works is as follows: ### # Load libraries library(textreadr) library(tcltk) library(tidyverse) #library(officer) #library(stringr) #for splitting and trimming raw data #library(tidyr) #for converting to wide format # I'd like to keep this as it enables more control over the selected directories filepath <- setwd(tk_choose.dir()) # The following correctly lists the names of all 9 files in my test directory files <- list.files(filepath, ".docx") files length(files) # Ideally, I'd like to skip this step by being able to automatically read in the name of each file, but one step at a time: filename <- "Now they want us to charge our electric cars from litter bins.docx" # This produces the file content as output when run, and identifies the fields that I want to extract. read_docx(filename) %>% str_split(",") %>% unlist() %>% str_trim() ### What I'd like to try and accomplish next is to extract the data from selected fields and append to a spreadsheet (Calc or Excel) under specific columns, or if it is easier to write a CSV which I can then use later. The fields I want to extract are illustrated with reference to the above file, viz.: The title: "Now they want us to charge our electric cars from litter bins" The name of the newspaper: "Mail on Sunday (London)" The publication date: "September 24, 2023" (in date format, preferably separated into month and year (day is not important)) The section: "NEWS" The page number(s): "16" (as numeric) The length: "515" (as numeric) The author: "Anna Mikhailova" The subject: from the Subject section, but this is to match a value e.g. GREENWASHING
Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet
Hi folks Thanks for your help and suggestions - very much appreciated. I now have some working code, using this file I uploaded for public access: https://docs.google.com/document/d/1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVERk/edit?usp=sharing=103065135255080058813=true=true The small code segment that now works is as follows: ### # Load libraries library(textreadr) library(tcltk) library(tidyverse) #library(officer) #library(stringr) #for splitting and trimming raw data #library(tidyr) #for converting to wide format # I'd like to keep this as it enables more control over the selected directories filepath <- setwd(tk_choose.dir()) # The following correctly lists the names of all 9 files in my test directory files <- list.files(filepath, ".docx") files length(files) # Ideally, I'd like to skip this step by being able to automatically read in the name of each file, but one step at a time: filename <- "Now they want us to charge our electric cars from litter bins.docx" # This produces the file content as output when run, and identifies the fields that I want to extract. read_docx(filename) %>% str_split(",") %>% unlist() %>% str_trim() ### What I'd like to try and accomplish next is to extract the data from selected fields and append to a spreadsheet (Calc or Excel) under specific columns, or if it is easier to write a CSV which I can then use later. The fields I want to extract are illustrated with reference to the above file, viz.: The title: "Now they want us to charge our electric cars from litter bins" The name of the newspaper: "Mail on Sunday (London)" The publication date: "September 24, 2023" (in date format, preferably separated into month and year (day is not important)) The section: "NEWS" The page number(s): "16" (as numeric) The length: "515" (as numeric) The author: "Anna Mikhailova" The subject: from the Subject section, but this is to match a value e.g. GREENWASHING >= 50% (here this value is 51% so would be included). A match moves onto select the highest value under the section "Industry" (here it is ELECTRIC MOBILITY (91%)) and appends this text and % value. If no match with 'Greenwashing', then appends 'Null' and moves onto the next file in the directory. ### The theory I am working with is if I can figure out how to extract these fields and append correctly, then the rest should just be wrapping this up in a for loop. However, I am struggling to get my head around the extraction and append part. If I can get it to work for one of these fields, I suspect that I can repeat the basic syntax to extract and append the remaining fields. Therefore, if someone can either suggest a syntax or point me to a useful tutorial, that would be splendid. Thank you in anticipation. Best wishes Andy __ 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] Help request: Parsing docx files for key words and appending to a spreadsheet
If you do something like this for i in $(pandoc --list-output-formats); do pandoc -f docx -t $i -o test.$i Now\ they\ want\ us\ to\ charge\ our\ electric\ cars\ from\ litter\ bins.docx; done you get approximately 65 formats, from which you can pick one which you can write a little parser for. The dokuwiki one for example uses long lines which makes parsing easier. el On 2023-12-30 13:57 , Andy wrote: > Good idea, El - thanks. > > The link is > https://docs.google.com/document/d/1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVERk/edit?usp=sharing=103065135255080058813=true=true > > This is helpful. > > From the article, which is typical of Lexis+ output, I want to > extract the following fields and append to a Calc/ Excel spreadsheet. > Given the volume of articles I have to work through, if this can be > iterative and semi-automatic, that would be a god send and I might be > able to do some actual research on the articles before I reach my > pensionable age. :-) > > Title Newspaper Date Section and page number Length Byline Subject > (only if the threshold of coverage for a specific subject is >> =50% is reached (e.g. Greenwashing (51%)) - if not, enter 'nil' and >> > move onto the next article in the folder > > This is the ambition. I am clearly a long way short of that though. > > Many thanks. Andy __ 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] Help request: Parsing docx files for key words and appending to a spreadsheet
В Sat, 30 Dec 2023 12:18:52 + Andy пишет: > filepath <- setwd(tk_choose.dir()) Since you're using tcltk, you can get a file path in one step using tk_choose.files(). (Use multi = FALSE to choose only one file.) > full_filename <- paste(filepath, filename, sep="/") There's also file.path(), which results in slightly more compact, self-documenting code. Nowadays, using '/' as the directory separator can be considered portable, one notable exception being some Windows cmd.exe built-ins (where '/' is interpreted as flag specifier). Perl5 documentation mentions Classic MacOS using ':' as the directory separator (and many other operating systems supporting or emulating Unix-style '/' separators), but that hasn't been relevant for a long while. > Error in x$doc_obj : $ operator is invalid for atomic vectors Which line of code produces the error? What is the argument of docx_summary() at this point? Since you're learning R, I can recommend a couple of free books: Visual Statistics [1] to study the basics of R and The R Inferno [2] for when you get stuck. -- Best regards, Ivan [1] http://web.archive.org/web/20230415001551/http://ashipunov.info/shipunov/school/biol_240/en/visual_statistics.pdf [2] https://www.burns-stat.com/documents/books/the-r-inferno/ __ 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] Help request: Parsing docx files for key words and appending to a spreadsheet
Sorry, I was being too quick. You have to pay attention to the pipe operator You were advised to do the following content <- read_docx(full_filename) |> docx_summary() which should have worked but I think you left out the |> operator. Alternatively tmp <- read_docx(full_filename) content <- docx_summary(tmp) On Sat, Dec 30, 2023 at 2:37 PM Andy wrote: > An update: Running this block of code: > > # Load libraries > library(tcltk) > library(tidyverse) > library(officer) > > filepath <- setwd(tk_choose.dir()) > > filename <- "Now they want us to charge our electric cars from litter > bins.docx" > > #full_filename <- paste0(filepath, filename) > full_filename <- paste(filepath, filename, sep="/") > > if (!file.exists(full_filename)) { >message("File missing") > } else { >content <- read_docx(full_filename) |> > docx_summary() ># this reads docx for the full filename and ># passes it ( |> command) to the next line ># which summarises it. ># the result is saved in a data frame object ># called content which we shall show some ># heading into from > >head(content) > } > > > Results in this error now:Error in x$doc_obj : $ operator is invalid for > atomic vectors > > Thank you. > > > > On 30/12/2023 12:12, Andy wrote: > > Hi Eric > > > > Thanks for that. That seems to fix one problem (the lack of a > > separator), but introduces a new one when I complete the function > > Calum proposed:Error in docx_summary() : argument "x" is missing, with > > no default > > > > The whole code so far looks like this: > > > > > > # Load libraries > > library(tcltk) > > library(tidyverse) > > library(officer) > > > > filepath <- setwd(tk_choose.dir()) > > > > filename <- "Now they want us to charge our electric cars from litter > > bins.docx" > > #full_filename <- paste0(filepath, filename) # Calum's original > suggestion > > > > full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix > > > > #lets double check the file does exist! # The rest here is Calum's > > suggestion > > if (!file.exists(full_filename)) { > > message("File missing") > > } else { > > content <- read_docx(full_filename) > > docx_summary() > > # this reads docx for the full filename and > > # passes it ( |> command) to the next line > > # which summarises it. > > # the result is saved in a data frame object > > # called content which we shall show some > > # heading into from > > > > head(content) > > } > > > > > > Running this, results in the error cited above. > > > > Thanks as always :-) > > > > > > > > > > On 30/12/2023 11:58, Eric Berger wrote: > >> full_filename <- paste(filepath, filename,sep="/") > > > > > > [[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] Help request: Parsing docx files for key words and appending to a spreadsheet
An update: Running this block of code: # Load libraries library(tcltk) library(tidyverse) library(officer) filepath <- setwd(tk_choose.dir()) filename <- "Now they want us to charge our electric cars from litter bins.docx" #full_filename <- paste0(filepath, filename) full_filename <- paste(filepath, filename, sep="/") if (!file.exists(full_filename)) { message("File missing") } else { content <- read_docx(full_filename) |> docx_summary() # this reads docx for the full filename and # passes it ( |> command) to the next line # which summarises it. # the result is saved in a data frame object # called content which we shall show some # heading into from head(content) } Results in this error now:Error in x$doc_obj : $ operator is invalid for atomic vectors Thank you. On 30/12/2023 12:12, Andy wrote: > Hi Eric > > Thanks for that. That seems to fix one problem (the lack of a > separator), but introduces a new one when I complete the function > Calum proposed:Error in docx_summary() : argument "x" is missing, with > no default > > The whole code so far looks like this: > > > # Load libraries > library(tcltk) > library(tidyverse) > library(officer) > > filepath <- setwd(tk_choose.dir()) > > filename <- "Now they want us to charge our electric cars from litter > bins.docx" > #full_filename <- paste0(filepath, filename) # Calum's original suggestion > > full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix > > #lets double check the file does exist! # The rest here is Calum's > suggestion > if (!file.exists(full_filename)) { > message("File missing") > } else { > content <- read_docx(full_filename) > docx_summary() > # this reads docx for the full filename and > # passes it ( |> command) to the next line > # which summarises it. > # the result is saved in a data frame object > # called content which we shall show some > # heading into from > > head(content) > } > > > Running this, results in the error cited above. > > Thanks as always :-) > > > > > On 30/12/2023 11:58, Eric Berger wrote: >> full_filename <- paste(filepath, filename,sep="/") > > [[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] Help request: Parsing docx files for key words and appending to a spreadsheet
docx_summary(content) You should read documentation e.g. ?docx_summary and check the examples section On Sat, Dec 30, 2023 at 2:12 PM Andy wrote: > Hi Eric > > Thanks for that. That seems to fix one problem (the lack of a separator), > but introduces a new one when I complete the function Calum proposed: > Error in docx_summary() : argument "x" is missing, with no default > > The whole code so far looks like this: > > > # Load libraries > library(tcltk) > library(tidyverse) > library(officer) > > filepath <- setwd(tk_choose.dir()) > > filename <- "Now they want us to charge our electric cars from litter > bins.docx" > #full_filename <- paste0(filepath, filename) # Calum's original suggestion > > full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix > > #lets double check the file does exist! # The rest here is Calum's > suggestion > if (!file.exists(full_filename)) { > message("File missing") > } else { > content <- read_docx(full_filename) > docx_summary() > # this reads docx for the full filename and > # passes it ( |> command) to the next line > # which summarises it. > # the result is saved in a data frame object > # called content which we shall show some > # heading into from > > head(content) > } > > > Running this, results in the error cited above. > > Thanks as always :-) > > > > > On 30/12/2023 11:58, Eric Berger wrote: > > full_filename <- paste(filepath, filename,sep="/") > > > [[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] Help request: Parsing docx files for key words and appending to a spreadsheet
Hi Eric Thanks for that. That seems to fix one problem (the lack of a separator), but introduces a new one when I complete the function Calum proposed:Error in docx_summary() : argument "x" is missing, with no default The whole code so far looks like this: # Load libraries library(tcltk) library(tidyverse) library(officer) filepath <- setwd(tk_choose.dir()) filename <- "Now they want us to charge our electric cars from litter bins.docx" #full_filename <- paste0(filepath, filename) # Calum's original suggestion full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix #lets double check the file does exist! # The rest here is Calum's suggestion if (!file.exists(full_filename)) { message("File missing") } else { content <- read_docx(full_filename) docx_summary() # this reads docx for the full filename and # passes it ( |> command) to the next line # which summarises it. # the result is saved in a data frame object # called content which we shall show some # heading into from head(content) } Running this, results in the error cited above. Thanks as always :-) On 30/12/2023 11:58, Eric Berger wrote: > full_filename <- paste(filepath, filename,sep="/") [[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] Help request: Parsing docx files for key words and appending to a spreadsheet
full_filename <- paste(filepath, filename,sep="/") On Sat, Dec 30, 2023 at 1:45 PM Andy wrote: > Thanks Ivan and Calum > > I continue to appreciate your support. > > Calum, I entered the code snippet you provided, and it returns 'file > missing'. Looking at this, while the object 'full_filename' exists, what > is happening is that the path from getwd() is being appended to the > title of the article, but without the '/' between the end of the path > name (here 'TEST' and the name of the article. In other words, > full_filename is reading "~/TESTNow they want us to charge our electric > cars from litter bins.docx", so logically, this file doesn't exist. To > work, the '/' needs to be inserted to differentiate between the end of > the path name and the start of the article name. I've tried both paste0, > as you suggested, and paste but neither do the trick. > > Is this a result of me using the tkinter folder selection that you > remarked on? I wanted to keep that so that the selection is interactive, > but if there are better ways of doing this I am open to suggestions. > > Thanks again, both. > > Best wishes > Andrew > > > On 29/12/2023 22:25, CALUM POLWART wrote: > > > > > > help(read_docx) says that the function only imports one docx file. In > > order to read multiple files, use a for loop or the lapply function. > > > > > > I told you people will suggest better ways to loop!! > > > > > > > > docx_summary(read_docx("Now they want us to charge our electric cars > > from litter bins.docx")) should work. > > > > > > Ivan thanks for spotting my fail! Since the OP is new to all this I'm > > going to suggest a little tweak to this code which we can then build > > into a for loop: > > > > filepath <- getwd() #you will want to change this later. You are doing > > something with tcl to pick a directory which seems rather fancy! But > > keep doing it for now or set the directory here ending in a / > > > > filename <- "Now they want us to charge our electric cars from litter > > bins.docx" > > > > full_filename <- paste0(filepath, filename) > > > > #lets double check the file does exist! > > if (!file.exists(full_filename)) { > > message("File missing") > > } else { > > content <- read_docx(full_filename) |> > > docx_summary() > > # this reads docx for the full filename and > > # passes it ( |> command) to the next line > > # which summarises it. > > # the result is saved in a data frame object > > # called content which we shall show some > > # heading into from > > > >head(content) > > } > > > > Let's get this bit working before we try and loop > > > > [[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] Help request: Parsing docx files for key words and appending to a spreadsheet
Good idea, El - thanks. The link is https://docs.google.com/document/d/1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVERk/edit?usp=sharing=103065135255080058813=true=true This is helpful. From the article, which is typical of Lexis+ output, I want to extract the following fields and append to a Calc/ Excel spreadsheet. Given the volume of articles I have to work through, if this can be iterative and semi-automatic, that would be a god send and I might be able to do some actual research on the articles before I reach my pensionable age. :-) Title Newspaper Date Section and page number Length Byline Subject (only if the threshold of coverage for a specific subject is >=50% is reached (e.g. Greenwashing (51%)) - if not, enter 'nil' and move onto the next article in the folder This is the ambition. I am clearly a long way short of that though. Many thanks. Andy On 30/12/2023 00:08, Dr Eberhard W Lisse wrote: Andy, you can always open a public Dropbox or Google folder and post the link. el On 29/12/2023 22:37, Andy wrote: Thanks - I'll have a look at these options too. I'm happy to send over a sample document, but wasn't aware if attachments are allowed. The documents come Lexis+, so require user credentials to log in, but I could upload the file somewhere if that would help? Any ideas for a good location to do so? [...] __ 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] Help request: Parsing docx files for key words and appending to a spreadsheet
Thanks Ivan and Calum I continue to appreciate your support. Calum, I entered the code snippet you provided, and it returns 'file missing'. Looking at this, while the object 'full_filename' exists, what is happening is that the path from getwd() is being appended to the title of the article, but without the '/' between the end of the path name (here 'TEST' and the name of the article. In other words, full_filename is reading "~/TESTNow they want us to charge our electric cars from litter bins.docx", so logically, this file doesn't exist. To work, the '/' needs to be inserted to differentiate between the end of the path name and the start of the article name. I've tried both paste0, as you suggested, and paste but neither do the trick. Is this a result of me using the tkinter folder selection that you remarked on? I wanted to keep that so that the selection is interactive, but if there are better ways of doing this I am open to suggestions. Thanks again, both. Best wishes Andrew On 29/12/2023 22:25, CALUM POLWART wrote: > > > help(read_docx) says that the function only imports one docx file. In > order to read multiple files, use a for loop or the lapply function. > > > I told you people will suggest better ways to loop!! > > > > docx_summary(read_docx("Now they want us to charge our electric cars > from litter bins.docx")) should work. > > > Ivan thanks for spotting my fail! Since the OP is new to all this I'm > going to suggest a little tweak to this code which we can then build > into a for loop: > > filepath <- getwd() #you will want to change this later. You are doing > something with tcl to pick a directory which seems rather fancy! But > keep doing it for now or set the directory here ending in a / > > filename <- "Now they want us to charge our electric cars from litter > bins.docx" > > full_filename <- paste0(filepath, filename) > > #lets double check the file does exist! > if (!file.exists(full_filename)) { > message("File missing") > } else { > content <- read_docx(full_filename) |> > docx_summary() > # this reads docx for the full filename and > # passes it ( |> command) to the next line > # which summarises it. > # the result is saved in a data frame object > # called content which we shall show some > # heading into from > > head(content) > } > > Let's get this bit working before we try and loop > [[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] Help request: Parsing docx files for key words and appending to a spreadsheet
Andy, you can always open a public Dropbox or Google folder and post the link. el On 29/12/2023 22:37, Andy wrote: > Thanks - I'll have a look at these options too. > > I'm happy to send over a sample document, but wasn't aware if > attachments are allowed. The documents come Lexis+, so require user > credentials to log in, but I could upload the file somewhere if > that would help? Any ideas for a good location to do so? [...] __ 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] Help request: Parsing docx files for key words and appending to a spreadsheet
help(read_docx) says that the function only imports one docx file. In > order to read multiple files, use a for loop or the lapply function. > I told you people will suggest better ways to loop!! > > docx_summary(read_docx("Now they want us to charge our electric cars > from litter bins.docx")) should work. > Ivan thanks for spotting my fail! Since the OP is new to all this I'm going to suggest a little tweak to this code which we can then build into a for loop: filepath <- getwd() #you will want to change this later. You are doing something with tcl to pick a directory which seems rather fancy! But keep doing it for now or set the directory here ending in a / filename <- "Now they want us to charge our electric cars from litter bins.docx" full_filename <- paste0(filepath, filename) #lets double check the file does exist! if (!file.exists(full_filename)) { message("File missing") } else { content <- read_docx(full_filename) |> docx_summary() # this reads docx for the full filename and # passes it ( |> command) to the next line # which summarises it. # the result is saved in a data frame object # called content which we shall show some # heading into from head(content) } Let's get this bit working before we try and loop > [[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] Help request: Parsing docx files for key words and appending to a spreadsheet
В Fri, 29 Dec 2023 20:17:41 + Andy пишет: > doc_in <- read_docx(files) > > Results in this error:Error in filetype %in% c("docx") && > grepl("^([fh]ttp)", file) :'length = 9' in coercion to 'logical(1)' help(read_docx) says that the function only imports one docx file. In order to read multiple files, use a for loop or the lapply function. > content <- officer::docx_summary("Now they want us to charge our > electric cars from litter bins.docx") # A title of one of the articles > > The error returned is:Error in x$doc_obj : $ operator is invalid for > atomic vectors A similar problem here. help(docx_summary) says that the function accepts "rdocx" objects returned by read_docx, not file paths. A string in R is indeed an atomic vector of type character, length 1. docx_summary(read_docx("Now they want us to charge our electric cars from litter bins.docx")) should work. -- 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] Help request: Parsing docx files for key words and appending to a spreadsheet
Thanks - I'll have a look at these options too. I'm happy to send over a sample document, but wasn't aware if attachments are allowed. The documents come Lexis+, so require user credentials to log in, but I could upload the file somewhere if that would help? Any ideas for a good location to do so? On 29/12/2023 20:25, Dr Eberhard W Lisse wrote: I would also look at https://pandoc.org perhaps which can export a number of formats... And for spreadsheets https://github.com/jqnatividad/qsv is my goto weapon. Can also read and write XLSX and others. A sample document or two would always be helpful... el On 29/12/2023 21:01, CALUM POLWART wrote: It sounded like he looked at officeR but I would agree content <- officer::docx_summary("filename.docx") Would get the text content into an object called content. That object is a data.frame so you can then manipulate it. To be more specific, we might need an example of the DF [...] On Fri, Dec 29, 2023 at 10:14 AM Andy wrote: [...] I'd like to be able to accomplish the following: (1) Append the title, the month, the author, the number of words, and page number(s) to a spreadsheet (2) Read each article and extract keywords (in the docs, these are listed in 'Subject' section as a list of keywords with a percentage showing the extent to which the keyword features in the article (e.g., FAST FASHION (72%)) and to append the keyword and the % coverage to the same row in the spreadsheet. However, I want to ensure that the keyword coverage meets the threshold of >= 50%; if not, then pass onto the next article in the directory. Rinse and repeat for the entire directory. [...] __ 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] Help request: Parsing docx files for key words and appending to a spreadsheet
I would also look at https://pandoc.org perhaps which can export a number of formats... And for spreadsheets https://github.com/jqnatividad/qsv is my goto weapon. Can also read and write XLSX and others. A sample document or two would always be helpful... el On 29/12/2023 21:01, CALUM POLWART wrote: > It sounded like he looked at officeR but I would agree > > content <- officer::docx_summary("filename.docx") > > Would get the text content into an object called content. > > That object is a data.frame so you can then manipulate it. > To be more specific, we might need an example of the DF [...] >> On Fri, Dec 29, 2023 at 10:14 AM Andy >> wrote: [...] >>> I'd like to be able to accomplish the following: >>> >>> (1) Append the title, the month, the author, the number of >>> words, and page number(s) to a spreadsheet >>> >>> (2) Read each article and extract keywords (in the docs, >>> these are listed in 'Subject' section as a list of >>> keywords with a percentage showing the extent to which the >>> keyword features in the article (e.g., FAST FASHION (72%)) >>> and to append the keyword and the % coverage to the same >>> row in the spreadsheet. However, I want to ensure that >>> the keyword coverage meets the threshold of >= 50%; if >>> not, then pass onto the next article in the directory. >>> Rinse and repeat for the entire directory. [...] __ 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] Help request: Parsing docx files for key words and appending to a spreadsheet
Hi Roy (& others) Many thanks for the advice - well taken. Thanks also to the others who have responded so quickly - I thought I might have to wait days!! :-) I'm on a Linux (Mint) machine. Below, I document three attempts, two using officer and the last now using textreadr My attempts so far using 'officer': ## (1) First Attempt: # Load libraries library(tcltk) library(tidyverse) library(officer) setwd(tk_choose.dir()) doc_path <- list.files(getwd(), pattern = ".docx", full.names = TRUE) files <- list.files(getwd(), ".docx") files length(files) ## This works to here - obtain a list of docx files in directory 'TEST with 9 files'. However, the next line doc_in <- read_docx(files) Results in this error:Error in filetype %in% c("docx") && grepl("^([fh]ttp)", file) :'length = 9' in coercion to 'logical(1)' No idea how to debug that. Even when trying Calum's suggestion with officer: content <- officer::docx_summary("Now they want us to charge our electric cars from litter bins.docx") # A title of one of the articles The error returned is:Error in x$doc_obj : $ operator is invalid for atomic vectors ## (2) Second Attempt: # Load libraries library(tcltk) library(tidyverse) library(officer) setwd(tk_choose.dir()) doc_path <- list.files(getwd(), pattern = ".docx", full.names = TRUE) files <- list.files(getwd(), ".docx") files length(files) docx_summary(doc_path, preserve = FALSE) ## At this point, the error is:Error in x$doc_obj : $ operator is invalid for atomic vectors So, not sure how I am passing an atomic vector or if there is something I am supposed to set to make this something else? ## (3) Third attempt - now trying with textreadr (Thanks for the help on installing this, Calum): # Load libraries library(tcltk) library(tidyverse) library(textreadr) folder <- setwd(tk_choose.dir()) files <- list.files(folder, ".docx") files length(files) doc <- read_docx("Now they want us to charge our electric cars from litter bins.docx") # One of the 9 files in the folder read_docx(doc, skip = 0, remove.empty = TRUE, trim = TRUE) # To test against one file ## The last line returns the following error:Error in filetype %in% c("docx") && grepl("^([fh]ttp)", file) :'length = 38' in coercion to 'logical(1)' ## And so I am going around in circles and not at all clear on how I can make progress. I am sure that there must be a way, but the suggestions on-line each lead to the above errors. Thanks for any further help. Best wishes, and thanks Andy On 29/12/2023 18:25, Roy Mendelssohn - NOAA Federal wrote: > Hi Andy: > > I don’t have an answer but I do have what I hope is some friendly advice. > Generally the more information you can provide, the more likely you will get > help that is useful. In your case you say that you tried several packages > and they didn’t do what you wanted. Providing that code, as well as why > they didn’t do what you wanted (be specific) would greatly facilitate things. > > Happy new year, > > -Roy > > >> On Dec 29, 2023, at 10:14 AM, Andy wrote: >> >> Hello >> >> I am trying to work through a problem, but feel like I've gone down a rabbit >> hole. I'd very much appreciate any help. >> >> The task: I have several directories of multiple (some directories, up to >> 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that I want >> to iterate through to append to a spreadsheet only those articles that >> satisfy a condition (i.e., a specific keyword is present for >= 50% coverage >> of the subject matter). Lexis+ has a very specific structure and keywords >> are given in the row "Subject". >> >> I'd like to be able to accomplish the following: >> >> (1) Append the title, the month, the author, the number of words, and page >> number(s) to a spreadsheet >> >> (2) Read each article and extract keywords (in the docs, these are listed in >> 'Subject' section as a list of keywords with a percentage showing the extent >> to which the keyword features in the article (e.g., FAST FASHION (72%)) and >> to append the keyword and the % coverage to the same row in the spreadsheet. >> However, I want to ensure that the keyword coverage meets the threshold of >> >= 50%; if not, then pass onto the next article in the directory. Rinse and >> repeat for the entire directory. >> >> So far, I've tried working through some Stack Overflow-based solutions, but >> most seem to use the textreadr package, which is now deprecated; others use >> either the officer or the officedown packages. However, these packages don't >> appear to do what I want the program to do, at least not in any of the >> examples I have found, nor in the vignettes and relevant package manuals >> I've looked at. >> >> The first point is, is what I am intending to do even possible using R? If >> it is, then where do I start with this? If these docx files were converted >> to UTF-8 plain text, would that
Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet
It sounded like he looked at officeR but I would agree content <- officer::docx_summary("filename.docx") Would get the text content into an object called content. That object is a data.frame so you can then manipulate it. To be more specific, we might need an example of the DF You can loop this easily with a for statement although there are people who prefer a non-for approach to iteration in R. For can be slow. But if you don't need to do this very quickly I'd stick with for if you are used to programming On Fri, 29 Dec 2023, 18:35 jim holtman, wrote: > checkout the 'officer' package > > Thanks > > Jim Holtman > *Data Munger Guru* > > > *What is the problem that you are trying to solve?Tell me what you want to > do, not how you want to do it.* > > > On Fri, Dec 29, 2023 at 10:14 AM Andy wrote: > > > Hello > > > > I am trying to work through a problem, but feel like I've gone down a > > rabbit hole. I'd very much appreciate any help. > > > > The task: I have several directories of multiple (some directories, up > > to 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that > > I want to iterate through to append to a spreadsheet only those articles > > that satisfy a condition (i.e., a specific keyword is present for >= 50% > > coverage of the subject matter). Lexis+ has a very specific structure > > and keywords are given in the row "Subject". > > > > I'd like to be able to accomplish the following: > > > > (1) Append the title, the month, the author, the number of words, and > > page number(s) to a spreadsheet > > > > (2) Read each article and extract keywords (in the docs, these are > > listed in 'Subject' section as a list of keywords with a percentage > > showing the extent to which the keyword features in the article (e.g., > > FAST FASHION (72%)) and to append the keyword and the % coverage to the > > same row in the spreadsheet. However, I want to ensure that the keyword > > coverage meets the threshold of >= 50%; if not, then pass onto the next > > article in the directory. Rinse and repeat for the entire directory. > > > > So far, I've tried working through some Stack Overflow-based solutions, > > but most seem to use the textreadr package, which is now deprecated; > > others use either the officer or the officedown packages. However, these > > packages don't appear to do what I want the program to do, at least not > > in any of the examples I have found, nor in the vignettes and relevant > > package manuals I've looked at. > > > > The first point is, is what I am intending to do even possible using R? > > If it is, then where do I start with this? If these docx files were > > converted to UTF-8 plain text, would that make the task easier? > > > > I am not a confident coder, and am really only just getting my head > > around R so appreciate a steep learning curve ahead, but of course, I > > don't know what I don't know, so any pointers in the right direction > > would be a big help. > > > > Many thanks in anticipation > > > > Andy > > > > __ > > 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. > [[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] Help request: Parsing docx files for key words and appending to a spreadsheet
textreadr would be the obvious approach. When you say it is depreciated do you mean it's not available on cran? Sometimes maintaining a package on cran in just a pain in the ass. devtools::install_github("trinker/textreadr") Should let you install it. In theory docx files are actually just zip files (you can unzip them) and you may find there is then a specific file in the zip that is readable with on of R's General text file readers. Alternatively, read_docx from: https://www.rdocumentation.org/packages/qdapTools May be worth a look. What platform are you on. Certainly options to command line convert files to txt and do from there. On Fri, 29 Dec 2023, 18:25 Roy Mendelssohn - NOAA Federal via R-help, < r-help@r-project.org> wrote: > Hi Andy: > > I don’t have an answer but I do have what I hope is some friendly advice. > Generally the more information you can provide, the more likely you will > get help that is useful. In your case you say that you tried several > packages and they didn’t do what you wanted. Providing that code, as well > as why they didn’t do what you wanted (be specific) would greatly > facilitate things. > > Happy new year, > > -Roy > > > > On Dec 29, 2023, at 10:14 AM, Andy wrote: > > > > Hello > > > > I am trying to work through a problem, but feel like I've gone down a > rabbit hole. I'd very much appreciate any help. > > > > The task: I have several directories of multiple (some directories, up > to 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that I > want to iterate through to append to a spreadsheet only those articles that > satisfy a condition (i.e., a specific keyword is present for >= 50% > coverage of the subject matter). Lexis+ has a very specific structure and > keywords are given in the row "Subject". > > > > I'd like to be able to accomplish the following: > > > > (1) Append the title, the month, the author, the number of words, and > page number(s) to a spreadsheet > > > > (2) Read each article and extract keywords (in the docs, these are > listed in 'Subject' section as a list of keywords with a percentage showing > the extent to which the keyword features in the article (e.g., FAST FASHION > (72%)) and to append the keyword and the % coverage to the same row in the > spreadsheet. However, I want to ensure that the keyword coverage meets the > threshold of >= 50%; if not, then pass onto the next article in the > directory. Rinse and repeat for the entire directory. > > > > So far, I've tried working through some Stack Overflow-based solutions, > but most seem to use the textreadr package, which is now deprecated; others > use either the officer or the officedown packages. However, these packages > don't appear to do what I want the program to do, at least not in any of > the examples I have found, nor in the vignettes and relevant package > manuals I've looked at. > > > > The first point is, is what I am intending to do even possible using R? > If it is, then where do I start with this? If these docx files were > converted to UTF-8 plain text, would that make the task easier? > > > > I am not a confident coder, and am really only just getting my head > around R so appreciate a steep learning curve ahead, but of course, I don't > know what I don't know, so any pointers in the right direction would be a > big help. > > > > Many thanks in anticipation > > > > Andy > > > > __ > > 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] Help request: Parsing docx files for key words and appending to a spreadsheet
checkout the 'officer' package Thanks Jim Holtman *Data Munger Guru* *What is the problem that you are trying to solve?Tell me what you want to do, not how you want to do it.* On Fri, Dec 29, 2023 at 10:14 AM Andy wrote: > Hello > > I am trying to work through a problem, but feel like I've gone down a > rabbit hole. I'd very much appreciate any help. > > The task: I have several directories of multiple (some directories, up > to 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that > I want to iterate through to append to a spreadsheet only those articles > that satisfy a condition (i.e., a specific keyword is present for >= 50% > coverage of the subject matter). Lexis+ has a very specific structure > and keywords are given in the row "Subject". > > I'd like to be able to accomplish the following: > > (1) Append the title, the month, the author, the number of words, and > page number(s) to a spreadsheet > > (2) Read each article and extract keywords (in the docs, these are > listed in 'Subject' section as a list of keywords with a percentage > showing the extent to which the keyword features in the article (e.g., > FAST FASHION (72%)) and to append the keyword and the % coverage to the > same row in the spreadsheet. However, I want to ensure that the keyword > coverage meets the threshold of >= 50%; if not, then pass onto the next > article in the directory. Rinse and repeat for the entire directory. > > So far, I've tried working through some Stack Overflow-based solutions, > but most seem to use the textreadr package, which is now deprecated; > others use either the officer or the officedown packages. However, these > packages don't appear to do what I want the program to do, at least not > in any of the examples I have found, nor in the vignettes and relevant > package manuals I've looked at. > > The first point is, is what I am intending to do even possible using R? > If it is, then where do I start with this? If these docx files were > converted to UTF-8 plain text, would that make the task easier? > > I am not a confident coder, and am really only just getting my head > around R so appreciate a steep learning curve ahead, but of course, I > don't know what I don't know, so any pointers in the right direction > would be a big help. > > Many thanks in anticipation > > Andy > > __ > 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] Help request: Parsing docx files for key words and appending to a spreadsheet
Hi Andy: I don’t have an answer but I do have what I hope is some friendly advice. Generally the more information you can provide, the more likely you will get help that is useful. In your case you say that you tried several packages and they didn’t do what you wanted. Providing that code, as well as why they didn’t do what you wanted (be specific) would greatly facilitate things. Happy new year, -Roy > On Dec 29, 2023, at 10:14 AM, Andy wrote: > > Hello > > I am trying to work through a problem, but feel like I've gone down a rabbit > hole. I'd very much appreciate any help. > > The task: I have several directories of multiple (some directories, up to > 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that I want > to iterate through to append to a spreadsheet only those articles that > satisfy a condition (i.e., a specific keyword is present for >= 50% coverage > of the subject matter). Lexis+ has a very specific structure and keywords are > given in the row "Subject". > > I'd like to be able to accomplish the following: > > (1) Append the title, the month, the author, the number of words, and page > number(s) to a spreadsheet > > (2) Read each article and extract keywords (in the docs, these are listed in > 'Subject' section as a list of keywords with a percentage showing the extent > to which the keyword features in the article (e.g., FAST FASHION (72%)) and > to append the keyword and the % coverage to the same row in the spreadsheet. > However, I want to ensure that the keyword coverage meets the threshold of >= > 50%; if not, then pass onto the next article in the directory. Rinse and > repeat for the entire directory. > > So far, I've tried working through some Stack Overflow-based solutions, but > most seem to use the textreadr package, which is now deprecated; others use > either the officer or the officedown packages. However, these packages don't > appear to do what I want the program to do, at least not in any of the > examples I have found, nor in the vignettes and relevant package manuals I've > looked at. > > The first point is, is what I am intending to do even possible using R? If it > is, then where do I start with this? If these docx files were converted to > UTF-8 plain text, would that make the task easier? > > I am not a confident coder, and am really only just getting my head around R > so appreciate a steep learning curve ahead, but of course, I don't know what > I don't know, so any pointers in the right direction would be a big help. > > Many thanks in anticipation > > Andy > > __ > 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 request: Parsing docx files for key words and appending to a spreadsheet
Hello I am trying to work through a problem, but feel like I've gone down a rabbit hole. I'd very much appreciate any help. The task: I have several directories of multiple (some directories, up to 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that I want to iterate through to append to a spreadsheet only those articles that satisfy a condition (i.e., a specific keyword is present for >= 50% coverage of the subject matter). Lexis+ has a very specific structure and keywords are given in the row "Subject". I'd like to be able to accomplish the following: (1) Append the title, the month, the author, the number of words, and page number(s) to a spreadsheet (2) Read each article and extract keywords (in the docs, these are listed in 'Subject' section as a list of keywords with a percentage showing the extent to which the keyword features in the article (e.g., FAST FASHION (72%)) and to append the keyword and the % coverage to the same row in the spreadsheet. However, I want to ensure that the keyword coverage meets the threshold of >= 50%; if not, then pass onto the next article in the directory. Rinse and repeat for the entire directory. So far, I've tried working through some Stack Overflow-based solutions, but most seem to use the textreadr package, which is now deprecated; others use either the officer or the officedown packages. However, these packages don't appear to do what I want the program to do, at least not in any of the examples I have found, nor in the vignettes and relevant package manuals I've looked at. The first point is, is what I am intending to do even possible using R? If it is, then where do I start with this? If these docx files were converted to UTF-8 plain text, would that make the task easier? I am not a confident coder, and am really only just getting my head around R so appreciate a steep learning curve ahead, but of course, I don't know what I don't know, so any pointers in the right direction would be a big help. Many thanks in anticipation Andy __ 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] Single pdf of all R vignettes request
You can see all the installed vignettes on your system with `browseVignettes()`. (This opens a browser page.) Alternatively `browseVignettes("pkgname")` for those related to a single package. HTH, Eric On Mon, Oct 31, 2022 at 11:37 AM Richard O'Keefe wrote: > Let's put some numbers on that. > The CRAN package repository claims 18770 packages. > That excludes packages in other repositories, of > course; the total collection of vignettes may not > be discoverable. > It could be useful to collect documents and vignettes > and stuff them into an information retrieval system, > but I cannot imagine a single PDF being usable. > > On Mon, 31 Oct 2022 at 08:34, Jeff Newmiller > wrote: > > > No. It would be impractically large and would be out of date by the time > > it was finished being assembled. And not all vignettes are built in PDF > > form anyway. > > > > R packages are maintained by individuals or small teams completely > > independently from R. > > > > On October 30, 2022 12:23:54 PM PDT, "Sun, John" > > wrote: > > >Dear All, > > > > > >I am writing to ask whether there exists a single pdf of all the > > vignettes from R packages. > > >This would be good resource. > > > > > >Best regards, > > >John > > > > > >__ > > >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. > > > > [[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] Single pdf of all R vignettes request
Let's put some numbers on that. The CRAN package repository claims 18770 packages. That excludes packages in other repositories, of course; the total collection of vignettes may not be discoverable. It could be useful to collect documents and vignettes and stuff them into an information retrieval system, but I cannot imagine a single PDF being usable. On Mon, 31 Oct 2022 at 08:34, Jeff Newmiller wrote: > No. It would be impractically large and would be out of date by the time > it was finished being assembled. And not all vignettes are built in PDF > form anyway. > > R packages are maintained by individuals or small teams completely > independently from R. > > On October 30, 2022 12:23:54 PM PDT, "Sun, John" > wrote: > >Dear All, > > > >I am writing to ask whether there exists a single pdf of all the > vignettes from R packages. > >This would be good resource. > > > >Best regards, > >John > > > >__ > >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. > [[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] Single pdf of all R vignettes request
No. It would be impractically large and would be out of date by the time it was finished being assembled. And not all vignettes are built in PDF form anyway. R packages are maintained by individuals or small teams completely independently from R. On October 30, 2022 12:23:54 PM PDT, "Sun, John" wrote: >Dear All, > >I am writing to ask whether there exists a single pdf of all the vignettes >from R packages. >This would be good resource. > >Best regards, >John > >__ >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] Single pdf of all R vignettes request
Dear All, I am writing to ask whether there exists a single pdf of all the vignettes from R packages. This would be good resource. Best regards, John __ 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] A Request
Hi Chishti, Try this: dim(x)[2] length(dn) >From your error message, the two will be different. They should be the same. A wild guess is that the offending line of code should be: dimnames[2]<-1:dn Jim On Tue, Jun 21, 2022 at 11:10 PM Muhammad Zubair Chishti wrote: > > Hi, Dear Professor, > When I run a code in R, I face the following error: > Error in dimnames(x) <- dn : > length of 'dimnames' [2] not equal to array extent > > Kindly help how to handle this. > > Regards > Chishti > > [[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] A Request
Hi, you should post a reproducible example if you want to have an answer. This error is generated when you try to copy an object in another of the wrong size. > a <- data.frame(A=1:2) > dimnames(a) [[1]] [1] "1" "2" [[2]] [1] "A" > dn <- list(c("3", "4"), c("B", "D")) > dimnames(a) <- dn Erreur dans `dimnames<-.data.frame`(`*tmp*`, value = list(c("3", "4"), c("B", : 'dimnames' incorrect pour ce tableau de données Marc Le 21/06/2022 à 15:09, Muhammad Zubair Chishti a écrit : Hi, Dear Professor, When I run a code in R, I face the following error: Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent Kindly help how to handle this. Regards Chishti [[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. __ Marc Girondot, Pr Laboratoire Ecologie, Systématique et Evolution Equipe de Processus Ecologiques et Pressions Anthropiques CNRS, AgroParisTech et Université Paris-Saclay, UMR 8079 Bâtiment 362 91405 Orsay Cedex, France Tel: +33 (0)1.69.15.72.30 Mobile: +33 (0)6.20.18.22.16 e-mail: marc.giron...@universite-paris-saclay.fr marc.giron...@gmail.com Web: https://www.ese.universite-paris-saclay.fr/epc/conservation/index.html Skype: girondot __ 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] Student request for help in Self Organizing Map (SOM)
Well, this mailing list is about the R language itself, not specific packages or background theory. You may get an answer anyway, but you are likely to have better responses on the R-sig-geo mailing list or contacting the author of the contributed package you are using. Also, do figure out how to configure your email program to send plain text... if you don't you gamble that your message (especially R code) becomes very hard to read after your formatting gets removed by the list. On May 25, 2021 5:28:12 AM PDT, Riaz Bibi wrote: >Dear > >I am Bibi, a PhD student of Environmental Science in South Korea. I am >currently writing my research paper and to deal with data I need to do >Self >Organizing Map (SOM). > >I am using R version 4.1.0 (2021-05-18) with kohonen package. > >I was following this tutorial given >http://rstudio-pubs-static.s3.amazonaws.com/437468_136a369149e24f24a4d0c152860ab4c3.html >. > >But I have a small confusion that I could not understand. To check the >efficiency of SOM model, I need to find out topographic error, which I >could not figure out. > >I will be really thankful if you please tell me how I can calculate >topographic error or any alternative term or which one is the >topographic >error in the given article. > >Please accept my apology if I wrote or mentioned something >inappropriate. > >Looking forward to hearing back. > >Kind regards > >Bibi > > [[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] Student request for help in Self Organizing Map (SOM)
Dear I am Bibi, a PhD student of Environmental Science in South Korea. I am currently writing my research paper and to deal with data I need to do Self Organizing Map (SOM). I am using R version 4.1.0 (2021-05-18) with kohonen package. I was following this tutorial given http://rstudio-pubs-static.s3.amazonaws.com/437468_136a369149e24f24a4d0c152860ab4c3.html . But I have a small confusion that I could not understand. To check the efficiency of SOM model, I need to find out topographic error, which I could not figure out. I will be really thankful if you please tell me how I can calculate topographic error or any alternative term or which one is the topographic error in the given article. Please accept my apology if I wrote or mentioned something inappropriate. Looking forward to hearing back. Kind regards Bibi [[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-es] Request
Hola: En concreto, al final de esta página: https://stat.ethz.ch/mailman/listinfo/r-help-es se encuentra la opción para anular la suscripción a r-help-es. Un saludo, Marcelino El 01/09/2020 a las 18:26, Carlos Ortega escribió: Hola, Eres tú misma la que te tienes que dar de baja de la lista. Tienes que haber recibido de forma periódica un correo de r-project.org mailing list memberships reminder En el que te indica detalles de tu suscripción. Usando ese correo te puedes dar de baja y cancelar la suscripción. Saludos, Carlos. El mar., 1 sept. 2020 a las 16:45, Fernanda Magaña () escribió: Quiero dar de baja mi suscripción, por favor. [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es -- Marcelino de la Cruz Rot Depto. de Biología y Geología Física y Química Inorgánica Universidad Rey Juan Carlos Móstoles España ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R-es] Request
Hola, Eres tú misma la que te tienes que dar de baja de la lista. Tienes que haber recibido de forma periódica un correo de r-project.org mailing list memberships reminder En el que te indica detalles de tu suscripción. Usando ese correo te puedes dar de baja y cancelar la suscripción. Saludos, Carlos. El mar., 1 sept. 2020 a las 16:45, Fernanda Magaña () escribió: > Quiero dar de baja mi suscripción, por favor. > > [[alternative HTML version deleted]] > > ___ > R-help-es mailing list > R-help-es@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-help-es > -- Saludos, Carlos Ortega www.qualityexcellence.es [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
[R-es] Request
Quiero dar de baja mi suscripción, por favor. [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
[R] Rserve - Request assistance with installation, confirmation thereof and starting (R 3.5.1 on 64-bit Win7 Pro)
Hello, I am attempting to install two R packages with specific version numbers. These are Rserve_1.8-0.zip and MASS_7.3-45.zip. As the file extension suggests, I am installing packages from local zipfiles in the GUI Packages menu. R Console displays positive feedback when MASS is loaded in this manner: *> utils:::menuInstallLocal()* package ‘MASS’ successfully unpacked and MD5 sums checked The R Console does not display any message when I attempt to install Rserve in the same manner. What does this indicate about Rserve being installed successfully? I was only provided instructions to install these two packages. No mention is made af loading them and this is feasible as Rserve can run without R being open. Further, I recently located two discussion threads indicating Rserve requires a configuration file and this is created by the user. These threads refer the reader to three files: 1) Rserve.exe, 2) Rserve.dll, and 3) Rserve_d.exe and instructs these should be placed into the same directory where R.dll is located (This is the bin directory on my installation: R.home("bin")). Next, it instructs readers to create the file "Rserv.cfg" and provide the desired arguments such port number. Here is my result of sessionInfo() *> sessionInfo()* R version 3.5.1 (2018-07-02) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.5.1 tools_3.5.1 Please let me know if you need anything else regarding my installation of R. Since I have been unable to accomplish this task, I have not saved a workspace. Thank you. [[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] A request
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of RAHUL > 14BCE0064 > Sent: Monday, March 20, 2017 12:24 PM > To: r-help@r-project.org > Subject: [R] A request > > Hello there!! > > Could somebody please go through the question ( > http://stats.stackexchange.com/questions/268323/string-kernels-in-r)? > Page not found so no question to go through. > In short I need the reference to the algorithms used for string kernels in > Kernlab package in R. There are plenty references in docs and if it is still not enough you can go through actual code. Cheers Petr > > > Thank you. > > Regards: > Rahul > > [[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. Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je tento e-mail součástí obchodního jednání: - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu. - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou. - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech. - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient. __ 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] A request
Hello there!! Could somebody please go through the question ( http://stats.stackexchange.com/questions/268323/string-kernels-in-r)? In short I need the reference to the algorithms used for string kernels in Kernlab package in R. Thank you. Regards: Rahul [[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] Help request from Ph.D. Students
Dear NECMETTİN ALPAY KOÇAK, Re: > Dear All, > I am Ph.D. student in Econometrics. My thesis is about "Linear Filtering on a > Time Series" which R has already a nice package, namely "Filter". This > package is really helpful for my study. But, I really help from you to create > two filter using with "filter" package. > I want to create two filter desribed in attachment (effects word file) using > "filter" package. But, I dont know how? > > I really need your reply, > Sincerely, > > Alpay KOCAK > (etc...) I don't know a package called "filter", but a function "filter" is in the "stats" package There are however more packages to filter time data. I use "signal", which also has a "filter" function in addition to functions to design filters yourself (from simple first-order to higher-order butterworth etc). This package is intended to filter (electrical) signals, but might be used for any time series. In addition, there are several packages for the analysis of seasonal data. You might search CRAN for the names. Success and Best Wishes, Frank -- Franklin Bretschneider Dept of Biology Utrecht University brets...@xs4all.nl __ 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] Help request from Ph.D. Students
Try DLM package : dlm: Bayesian and Likelihood Analysis of Dynamic Linear Models M.O On Mon, 2016-01-11 at 13:07 +0100, Franklin Bretschneider wrote: > Dear NECMETTİN ALPAY KOÇAK, > > Re: > > > Dear All, > > I am Ph.D. student in Econometrics. My thesis is about "Linear Filtering on > > a Time Series" which R has already a nice package, namely "Filter". This > > package is really helpful for my study. But, I really help from you to > > create two filter using with "filter" package. > > I want to create two filter desribed in attachment (effects word file) > > using "filter" package. But, I dont know how? > > > > I really need your reply, > > Sincerely, > > > > Alpay KOCAK > > (etc...) > > > I don't know a package called "filter", but a function "filter" is in the > "stats" package > There are however more packages to filter time data. I use "signal", which > also has a "filter" function in addition to functions to design filters > yourself (from simple first-order to higher-order butterworth etc). > This package is intended to filter (electrical) signals, but might be used > for any time series. > In addition, there are several packages for the analysis of seasonal data. > You might search CRAN for the names. > Success and > Best Wishes, > > > Frank > -- > > > > Franklin Bretschneider > Dept of Biology > Utrecht University > brets...@xs4all.nl > > __ > 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 request from Ph.D. Students
Dear All, I am Ph.D. student in Econometrics. My thesis is about "Linear Filtering on a Time Series" which R has already a nice package, namely "Filter". This package is really helpful for my study. But, I really help from you to create two filter using with "filter" package. I want to create two filter desribed in attachment (effects word file) using "filter" package. But, I dont know how? I really need your reply, Sincerely, Alpay KOCAK The "filter" package usage is given below. filter(x, filter, method = c("convolution", "recursive"), sides = 2, circular = FALSE, init) And arguments, x : a univariate or multivariate time series. filter : a vector of filter coefficients in reverse time order (as for AR or MA coefficients). method : Either "convolution" or "recursive" (and can be abbreviated). If "convolution" a moving average is used: if "recursive" an autoregression is used. sides : for convolution filters only. If sides = 1 the filter coefficients are for past values only; if sides = 2 they are centred around lag 0. In this case the length of the filter should be odd, but if it is even, more of the filter is forward in time than backward. circular : for convolution filters only. If TRUE, wrap the filter around the ends of the series, otherwise assume external values are missing (NA). init : for recursive filters only. Specifies the initial values of the time series just prior to the start value, in reverse time order. The default is a set of zeros. __ 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] Subscription request
Hi, I have a few R programming related questions that i wanted to ask. Can you please accept my subscription request. Regards, Manish. [[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] Subscription request
On 14-Oct-2015 15:19:06 Manish Sindagi wrote: > Hi, > > I have a few R programming related questions that i wanted to ask. > Can you please accept my subscription request. > > Regards, > Manish. Visit the R-help info web page: https://stat.ethz.ch/mailman/listinfo/r-help Towards the bottom of this page is a section "Subscribing to R-help". Follow the instructions in this section, and it should work! Best wishes, Ted. - E-Mail: (Ted Harding)Date: 14-Oct-2015 Time: 19:34:55 This message was sent by XFMail __ 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] API request from R
On 2/19/2015 8:06 AM, Barry Rowlingson wrote: On Wed, Feb 18, 2015 at 11:44 AM, Mittal Ashra via R-help r-help@r-project.org wrote: Dear All, Apologies for mailing it to the whole crowd. This is Mittal, presently working in a Project where we have build a platform for displaying recommendations and the results are based on the statistical models. I have gone through the CRAN repository to look out for an package which converts the R code into an JAVA API and that can be called from the platform. However, did not find any. If anyone can guide me to the right package that will be grateful. The packages can be similar to DeployR from Revolution Analytics. I doubt there's anything smart enough to take a set of R functions and magically create all the necessary Java boilerplate code that constitutes an implementation of an API in Java (cynics would say Java was all boilerplate...). There's the rJava package, which includes the JRI system for calling R from Java. Then your java can kick off an R engine and do R stuff: I thought rJava called java from R not the other way around. Description: Low-level interface to Java VM very much like .C/.Call and friends. Allows creation of objects, calling methods and accessing fields. [boilerplate code deleted] Rengine re=new Rengine(args, false, new TextConsole()); [more deleted boilerplate] re.eval(data(iris),false); What you would have to do would be to write the Java functions/methods/classes with the appropriate arguments for your API and make them call the R code this way. I think RCaller is another way of doing this from Java - its not on CRAN since its not an R package, its a Java library. Barry __ 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 W. Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A T Still University of Health Sciences 800 W. Jefferson St Kirksville, MO 63501 rbaer(at)atsu.edu [[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] API request from R
On 19 Feb 2015 20:11, Robert Baer rb...@atsu.edu wrote: On 2/19/2015 8:06 AM, Barry Rowlingson wrote: On Wed, Feb 18, 2015 at 11:44 AM, Mittal Ashra via R-help r-help@r-project.org wrote: Dear All, Apologies for mailing it to the whole crowd. This is Mittal, presently working in a Project where we have build a platform for displaying recommendations and the results are based on the statistical models. I have gone through the CRAN repository to look out for an package which converts the R code into an JAVA API and that can be called from the platform. However, did not find any. If anyone can guide me to the right package that will be grateful. The packages can be similar to DeployR from Revolution Analytics. I doubt there's anything smart enough to take a set of R functions and magically create all the necessary Java boilerplate code that constitutes an implementation of an API in Java (cynics would say Java was all boilerplate...). There's the rJava package, which includes the JRI system for calling R from Java. Then your java can kick off an R engine and do R stuff: I thought rJava called java from R not the other way around. Description: Low-level interface to Java VM very much like .C/.Call and friends. Allows creation of objects, calling methods and accessing fields. Yes, but it includes the JRI code for calling R from Java. It's in the package directory with some example Java programme. [boilerplate code deleted] Rengine re=new Rengine(args, false, new TextConsole()); [more deleted boilerplate] re.eval(data(iris),false); What you would have to do would be to write the Java functions/methods/classes with the appropriate arguments for your API and make them call the R code this way. I think RCaller is another way of doing this from Java - its not on CRAN since its not an R package, its a Java library. Barry __ 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 W. Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A T Still University of Health Sciences 800 W. Jefferson St Kirksville, MO 63501 rbaer(at)atsu.edu [[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] API request from R
On Wed, Feb 18, 2015 at 11:44 AM, Mittal Ashra via R-help r-help@r-project.org wrote: Dear All, Apologies for mailing it to the whole crowd. This is Mittal, presently working in a Project where we have build a platform for displaying recommendations and the results are based on the statistical models. I have gone through the CRAN repository to look out for an package which converts the R code into an JAVA API and that can be called from the platform. However, did not find any. If anyone can guide me to the right package that will be grateful. The packages can be similar to DeployR from Revolution Analytics. I doubt there's anything smart enough to take a set of R functions and magically create all the necessary Java boilerplate code that constitutes an implementation of an API in Java (cynics would say Java was all boilerplate...). There's the rJava package, which includes the JRI system for calling R from Java. Then your java can kick off an R engine and do R stuff: [boilerplate code deleted] Rengine re=new Rengine(args, false, new TextConsole()); [more deleted boilerplate] re.eval(data(iris),false); What you would have to do would be to write the Java functions/methods/classes with the appropriate arguments for your API and make them call the R code this way. I think RCaller is another way of doing this from Java - its not on CRAN since its not an R package, its a Java library. Barry __ 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] API request from R
Dear All Thanks for the reply. RegardsMittal On Friday, 20 February 2015 1:56 AM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On 19 Feb 2015 20:11, Robert Baer rb...@atsu.edu wrote: On 2/19/2015 8:06 AM, Barry Rowlingson wrote: On Wed, Feb 18, 2015 at 11:44 AM, Mittal Ashra via R-help r-help@r-project.org wrote: Dear All, Apologies for mailing it to the whole crowd. This is Mittal, presently working in a Project where we have build a platform for displaying recommendations and the results are based on the statistical models. I have gone through the CRAN repository to look out for an package which converts the R code into an JAVA API and that can be called from the platform. However, did not find any. If anyone can guide me to the right package that will be grateful. The packages can be similar to DeployR from Revolution Analytics. I doubt there's anything smart enough to take a set of R functions and magically create all the necessary Java boilerplate code that constitutes an implementation of an API in Java (cynics would say Java was all boilerplate...). There's the rJava package, which includes the JRI system for calling R from Java. Then your java can kick off an R engine and do R stuff: I thought rJava called java from R not the other way around. Description: Low-level interface to Java VM very much like .C/.Call and friends. Allows creation of objects, calling methods and accessing fields. Yes, but it includes the JRI code for calling R from Java. It's in the package directory with some example Java programme. [boilerplate code deleted] Rengine re=new Rengine(args, false, new TextConsole()); [more deleted boilerplate] re.eval(data(iris),false); What you would have to do would be to write the Java functions/methods/classes with the appropriate arguments for your API and make them call the R code this way. I think RCaller is another way of doing this from Java - its not on CRAN since its not an R package, its a Java library. Barry __ 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 W. Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A T Still University of Health Sciences 800 W. Jefferson St Kirksville, MO 63501 rbaer(at)atsu.edu [[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] API request from R
Dear All, Apologies for mailing it to the whole crowd. This is Mittal, presently working in a Project where we have build a platform for displaying recommendations and the results are based on the statistical models. I have gone through the CRAN repository to look out for an package which converts the R code into an JAVA API and that can be called from the platform. However, did not find any. If anyone can guide me to the right package that will be grateful. The packages can be similar to DeployR from Revolution Analytics. RegardsMittal [[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] PubChem Request Search Script
Dear all, The question would be: I would love to get information and match names of different chemistry compounds. A compound looks like this. Link: http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=2 The task is the following: 1. You input a name via R to the link, then a database searches a similar or the same compound for you. (you autotype the name in the input field left to the search button.) 2. parse the information that you get back. (This I can do already via R) Thank you for you're attention, - - László-András Zsurzsa,- - Msc. Infromatics, Technical University Munich, Germany - - Scientific Employee, TUM - - [[alternative HTML version deleted]] __ 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.
[R] Fw: Request for information
Dear Sir, Greetings. I am Ravishankar from Platform Solutions function of Tata Consultancy Services, Mumbai India. I am associated with team within Platform Solutions group that specializes in statistical modeling solutions to various clients. We are exploring various statistical computing software tools for building statistical models and meet our client requirements. In the process, we identified your R-programming environment as one of the possible means to serve the purpose. We submit our request for more details to you regarding the usage of R for commercial purposes. In this regard, we also solicit a discussion with you for our further perusal. We earnestly look forward to your reply. Thanks Regards, Ravishankar Kandallu Platform Solutions Analytics-Support Tata Consultancy Services Limited Gateway Park, Road No.13 MIDC, Andheri (E) Mumbai - 400093,Maharashtra India Ph:- 912267795049 Buzz:- 4295049 Cell:- 9920935970 Mailto: ravishankar.kanda...@tcs.com Website: http://www.tcs.com Experience certainty. IT Services Business Solutions Consulting =-=-= Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you [[alternative HTML version deleted]] __ 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.
Re: [R] Fw: Request for information
Outrageous! http://www.r-project.org/ On Tue, May 14, 2013 at 11:53 PM, Ravishankar Kandallu ravishankar.kanda...@tcs.com wrote: Dear Sir, Greetings. I am Ravishankar from Platform Solutions function of Tata Consultancy Services, Mumbai India. I am associated with team within Platform Solutions group that specializes in statistical modeling solutions to various clients. We are exploring various statistical computing software tools for building statistical models and meet our client requirements. In the process, we identified your R-programming environment as one of the possible means to serve the purpose. We submit our request for more details to you regarding the usage of R for commercial purposes. In this regard, we also solicit a discussion with you for our further perusal. We earnestly look forward to your reply. Thanks Regards, Ravishankar Kandallu Platform Solutions Analytics-Support Tata Consultancy Services Limited Gateway Park, Road No.13 MIDC, Andheri (E) Mumbai - 400093,Maharashtra India Ph:- 912267795049 Buzz:- 4295049 Cell:- 9920935970 Mailto: ravishankar.kanda...@tcs.com Website: http://www.tcs.com Experience certainty. IT Services Business Solutions Consulting =-=-= Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you [[alternative HTML version deleted]] __ 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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[alternative HTML version deleted]] __ 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.
[R] R -HELP REQUEST
Good morning to you all, Sorry for taking your time from your research and teaching schedules. If you have a non-stationary univariate time Series data that has the transformation: Say; l.dat-log (series) d.ldat-diff (l.dat, differences=1) and you fit say arima model. predit.arima-predict (fit.series, n.ahead=10, xregnew= (n+1) :( n+10)) How could I re-transform prediction$pred to the level data since it has been differenced once? I know exp (prediction$pred) will bring the inverse of the log transform but what about the differenced transform? This is my question. I would be very grateful if you could help me with this.Thank you very much in anticipation Mr. Mahmoud Coker Senior Manager Bank of Sierra Leone (Sam-Bangura Building) Freetown-Sierra Leone West Africa Email: cokiest...@yahoo.com Phone: +232 78 625967 / +232 77 440143 [[alternative HTML version deleted]] __ 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.
Re: [R] R -HELP REQUEST
If you just want point forecasts, it's simple: Let your original series be X_t, t=1, ..., N. Let Y_t = log(X_t). Let Z_t = Y_t - Y_{t-1}, t = 2, ..., N. Fit your model and forecast, obtaining Z-hat__1, ..., Z-hat_10. Then Y-hat_{N+1} = Y_N + Z-hat_1, Y-hat_{N+2} = Y-hat_{N+1} + Z-hat_2, ., Y-hat_{N+10} = Y-hat_{N+9} + Z-hat_10. In R, let your forecast values be the vector Zhat (a vector of length 10). Then do: Yhat - cumsum(c(Y[N],Zhat))[-1] Xhat - exp(Yhat) Get error bounds on the forecasts is more problematic. cheers, Rolf Turner On 02/05/2013 11:49 PM, Mahmoud Coker wrote: Good morning to you all, Sorry for taking your time from your research and teaching schedules. If you have a non-stationary univariate time Series data that has the transformation: Say; l.dat-log (series) d.ldat-diff (l.dat, differences=1) and you fit say arima model. predit.arima-predict (fit.series, n.ahead=10, xregnew= (n+1) :( n+10)) How could I re-transform prediction$pred to the level data since it has been differenced once? I know exp (prediction$pred) will bring the inverse of the log transform but what about the differenced transform? This is my question. I would be very grateful if you could help me with this.Thank you very much in anticipation. __ 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.
[R] package request
which package from CRAN used for Big-Data analysis ? is there any separate package for Big-Data analysis? or for making reports Business intelligence -- View this message in context: http://r.789695.n4.nabble.com/package-request-tp4645661.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] package request
There are packages for big data analysis, which is best depends on what you want to do. The High Performance Computing task view on CRAN has a section on packages that deal with big data which gives some more detail and may help you choose which package(s) to use. On Wed, Oct 10, 2012 at 12:36 AM, sagarnikam123 sagarnikam...@gmail.com wrote: which package from CRAN used for Big-Data analysis ? is there any separate package for Big-Data analysis? or for making reports Business intelligence -- View this message in context: http://r.789695.n4.nabble.com/package-request-tp4645661.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com __ 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.
[R] R Interview Request
I am one half of the RCE podcast (www.rce-cast.com). We would like to feature R on the show, We would like a dev or two for about an hour on the phone or skype to chat about R its history and general information for an HPC/RC focused crowed. Feel free to contact me off list if you would like to participate. Brock Palen www.umich.edu/~brockp CAEN Advanced Computing bro...@umich.edu (734)936-1985 __ 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.
[R] Feature request: 'file.path()' accepting an input vector
Dear list, I have a small feature request regarding the implementation of 'file.path()': It'd be great if 'file.path()' would allow to specify an input *vector* instead of solely rely on a specification via the three dot argument. AFAIU, currently it's only possible to manually specify each path component via the three dot argument: file.path(letters[1], letters[2], letters[3]) [1] a/b/c Providing a vector object will result in the same vector being returned, instead of a slash separated scalar: file.path(letters[1:3]) [1] a b c It'd be great if the last call would have this result: file.path(letters[1:3]) [1] a/b/c If that's already possible, I'd appreciate a pointer. If not: thanks a lot for considering this, Best regards, Janko __ 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.
Re: [R] Feature request: 'file.path()' accepting an input vector
On 28/06/2012 10:40, Janko Thyson wrote: Dear list, I have a small feature request regarding the implementation of 'file.path()': Clearly you have not read where and how to make feature requests (R-devel list or Wishlist on bugs.r-project.org). It'd be great if 'file.path()' would allow to specify an input *vector* instead of solely rely on a specification via the three dot argument. AFAIU, currently it's only possible to manually specify each path component via the three dot argument: file.path(letters[1], letters[2], letters[3]) [1] a/b/c Providing a vector object will result in the same vector being returned, instead of a slash separated scalar: file.path(letters[1:3]) [1] a b c It'd be great if the last call would have this result: file.path(letters[1:3]) [1] a/b/c If that's already possible, I'd appreciate a pointer. If not: thanks a lot for considering this, It's not going ever to be possible: it does what it is intended and documented to do with a single vector, and people rely on the existing behaviour. OTOH paste(x, collapse=/) does what you want (you could use .Platform$file.sep for maximal portability). Or you could use do.call(file.path, as.list(x)) Best regards, Janko -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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.
Re: [R] Feature request: 'file.path()' accepting an input vector
Clearly you're right - and polite... as always I asked the question because I wanted to avoid 'paste(x, collapse=/)' and 'do.call(file.path, as.list(x))' because it's less efficient than 'file.path()' and '?file.path()' explicitly recommends *not* using 'paste()' for putting together file paths. On 28.06.2012 12:10, Prof Brian Ripley wrote: On 28/06/2012 10:40, Janko Thyson wrote: Dear list, I have a small feature request regarding the implementation of 'file.path()': Clearly you have not read where and how to make feature requests (R-devel list or Wishlist on bugs.r-project.org). It'd be great if 'file.path()' would allow to specify an input *vector* instead of solely rely on a specification via the three dot argument. AFAIU, currently it's only possible to manually specify each path component via the three dot argument: file.path(letters[1], letters[2], letters[3]) [1] a/b/c Providing a vector object will result in the same vector being returned, instead of a slash separated scalar: file.path(letters[1:3]) [1] a b c It'd be great if the last call would have this result: file.path(letters[1:3]) [1] a/b/c If that's already possible, I'd appreciate a pointer. If not: thanks a lot for considering this, It's not going ever to be possible: it does what it is intended and documented to do with a single vector, and people rely on the existing behaviour. OTOH paste(x, collapse=/) does what you want (you could use .Platform$file.sep for maximal portability). Or you could use do.call(file.path, as.list(x)) Best regards, Janko __ 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.
[R] help request
Good day everyone, I am using the data below to fit Intervention Time Series model for two policies introduced in 2002 (54th data point) and 2003 (55th data point) respectively. Please can anyone give me a complete R code for modeling the two step functions? I have already modeled the pre-intervention period (1948 - 2001) but I need codes for the full intervention model that estimates the impact parameters(omega) and the decay parameters(delta) as well. Thank you all for your assistance. data(1948 - 2011) 1 207559 2 278372 3 247834 4 262223 5 210663 6 246982 7 211016 8 223317 9 232448 10 259788 11 209765 12 259572 13 33 14 439159 15 415186 16 428018 17 427782 18 591031 19 415753 20 381353 21 430665 22 355588 23 417457 24 427894 25 469864 26 421843 27 354634 28 378759 29 400321 30 324111 31 271339 32 265076 33 296419 34 257974 35 224882 36 178626 37 158956 38 174809 39 219044 40 227765 41 188177 42 300101 43 296051 44 293352 45 242817 46 312123 47 254653 48 309454 49 403872 50 322488 51 409383 52 397675 53 436947 54 389772 55 340562 56 496846 57 736975 58 599318 59 740458 60 614532 61 680781 62 710642 63 632037 64 1024553 [[alternative HTML version deleted]] __ 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.
[R] Statmath-R-Forge: Request denied
Dear All, I want to subscribe for Statmath-R-Forge mailing list. But I am getting the following reply and I am unable to subscribe. Any insight on this would be appreciated. Regards Vikram Bahure __ Your request to the Statmath-R-Forge mailing list Subscription request has been rejected by the list moderator. The moderator gave the following reason for rejecting your request: This list is not public. Please register trackers and forums instead. Any questions or comments should be directed to the list administrator at: statmath-r-forge-ow...@wu.ac.at [[alternative HTML version deleted]] __ 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.
Re: [R] Statmath-R-Forge: Request denied
On 09/21/2011 10:11 AM, Vikram Bahure wrote: Dear All, I want to subscribe for Statmath-R-Forge mailing list. But I am getting the following reply and I am unable to subscribe. Any insight on this would be appreciated. Regards Vikram Bahure __ Your request to the Statmath-R-Forge mailing list Subscription request has been rejected by the list moderator. The moderator gave the following reason for rejecting your request: This list is not public. Please register trackers and forums instead. Any questions or comments should be directed to the list administrator at: statmath-r-forge-ow...@wu.ac.at [[alternative HTML version deleted]] __ 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. I think your problem is that: This list is not public Just my 2ct...and Any questions or comments should be directed to the list administrator... Paul -- Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological Institute (KNMI) Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39 P.O. Box 201 | 3730 AE | De Bilt tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770 __ 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.
Re: [R] Feature request: rating/review system for R packages
On 03/21/2011 04:33 AM, Janko Thyson wrote: ... Hi Janko, As Dieter said, Crantastic is an opportunity for R users to give both quickie ratings and reviews of packages. I have to say that doing a review isn't trivial. I feel that I should use a package for a while before I can review it, and the big packages would take quite some time to work through even the majority of functions, especially if you didn't normally use them. Nonetheless, I try to keep a running tally on the packages that I use, and when I've got a feeling for the capability, reliability and ease of use, I try to sit down and write one. I have an idea that many packages are downloaded and one or two useful functions are used a lot by any given user. Ben's idea has been floated before, but either no one has put it together or I haven't heard of it. That would probably produce a lot more information, and the sum of a package's usage is meaningful. Jim __ 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.
[R] Feature request: rating/review system for R packages
Dear List, I'm aware that this has been brought up before (e.g. http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7365.html http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7365.html ; https://stat.ethz.ch/pipermail/r-help/2009-March/190902.html https://stat.ethz.ch/pipermail/r-help/2009-March/190902.html), I couldn't find anything recent on the topic, though. After pondering all the pros and cons regarding the usefulness of a rating/review system for R packages, don't you think it would make sense to implement such a thing? Of course one could easily debate hours on how this should exactly look like (quality vs. quantitiy/popularity and such), but IMHO it would definitely be a start to have something like a simple version Amazon's review system available. It would allow you to form at least an initial opinion on purpose and quality of R packages before going at it. As more and more packages pop up on CRAN, I think it'd be great to have such a feature and that the time is ripe. Cheers, Janko [[alternative HTML version deleted]] __ 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.
Re: [R] Feature request: rating/review system for R packages
After pondering all the pros and cons regarding the usefulness of a rating/review system for R packages, don't you think it would make sense to implement such a thing? Or to look what is there, and how little it is filled: http://crantastic.org/ Dieter -- View this message in context: http://r.789695.n4.nabble.com/Feature-request-rating-review-system-for-R-packages-tp3391467p3391473.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Feature request: rating/review system for R packages
Dieter Menne dieter.menne at menne-biomed.de writes: After pondering all the pros and cons regarding the usefulness of a rating/review system for R packages, don't you think it would make sense to implement such a thing? Or to look what is there, and how little it is filled: http://crantastic.org/ Dieter If I were feeling a little more ambitious, I would write a contributed popularity contest package (cf. http://lwn.net/Articles/75753/, http://popcon.debian.org/) that did the following: * recorded information on a user's configuration and installed packages and reported it *somewhere* (web server, etc.; R has plenty of communications facilities built in) for more intrusive but complete information: * gave users an option to install a `hook' that would report at some interval (regular? random?) which packages were actually loaded (on Unix-alike machines one might be able to use the 'atime' feature to guess when a package was *last* loaded even if it wasn't currently in use) * gave users an option to contribute further information (country, research field, etc.) * might pop up a window showing installed packages and offering users the option to comment or to give ratings to particularly good or bad packages, which would be sent to wherever ... This would be completely optional, but *if* word got around it could collect a useful (albeit completely statistically unsound) set of information. *If* I were writing this I would (a) be very clear in the package description etc etc what information would be collected and stored, where, and how it would be used; (b) carefully think about the tradeoffs between annoying users and collecting more information; (c) consult with the fine folks running CRANtastic to see if they wanted to somehow integrate it into their infrastructure. The big advantage of this approach is that you don't need to convince anyone from R-core to do anything, you just need to convince users to install your package. Ben Bolker __ 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.
Re: [R] Feature request: rating/review system for R packages
It's unclear to me, why the rating/review system should relate to entire packages. Would it not be more informative, if single specific functions would be rated and reviewed? I would like to see if + is rated better than -, or if more difficulties are reported for * than for /. I could then consider in the future to prefer sums over differences. best, Heinz At 20.03.2011 19:03 +, Ben Bolker wrote: Dieter Menne dieter.menne at menne-biomed.de writes: After pondering all the pros and cons regarding the usefulness of a rating/review system for R packages, don't you think it would make sense to implement such a thing? Or to look what is there, and how little it is filled: http://crantastic.org/ Dieter If I were feeling a little more ambitious, I would write a contributed popularity contest package (cf. http://lwn.net/Articles/75753/, http://popcon.debian.org/) that did the following: * recorded information on a user's configuration and installed packages and reported it *somewhere* (web server, etc.; R has plenty of communications facilities built in) for more intrusive but complete information: * gave users an option to install a `hook' that would report at some interval (regular? random?) which packages were actually loaded (on Unix-alike machines one might be able to use the 'atime' feature to guess when a package was *last* loaded even if it wasn't currently in use) * gave users an option to contribute further information (country, research field, etc.) * might pop up a window showing installed packages and offering users the option to comment or to give ratings to particularly good or bad packages, which would be sent to wherever ... This would be completely optional, but *if* word got around it could collect a useful (albeit completely statistically unsound) set of information. *If* I were writing this I would (a) be very clear in the package description etc etc what information would be collected and stored, where, and how it would be used; (b) carefully think about the tradeoffs between annoying users and collecting more information; (c) consult with the fine folks running CRANtastic to see if they wanted to somehow integrate it into their infrastructure. The big advantage of this approach is that you don't need to convince anyone from R-core to do anything, you just need to convince users to install your package. Ben Bolker __ 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. __ 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.
[R] Urgent Request
Dear Colleagues, Hope you will be fine. I am student of Ph.D and doing some work on distribution. I developed a new distribution and having some problems in estimating their parameters by MLE. I used R-program and used maxLik function (maxLik: A Package for Maximum Likelihood Estimation in R) But there is some problem, it is not estimated the parameters properly. I also write an e-mail to the author of this paper but he could not solve my problem. His function works well for simple and known distribution but does not work for a new function. Can anybody spare some time for me? I really need your help. Please inform me so that I can send you the material. Waiting for a quick reply Best Regards, Muhammad Mohsin PhD Research Fellow University of Klagenfurt, Department of Statistics University st. 65-67, 9020 Klagenfurt, Austria, Europe University E-mail Address:mmoh...@edu.uni-klu.ac.at Phone No Office 0043 (0)463 27003129 Mobile No: 0043 (0)676 7218836 [[alternative HTML version deleted]] __ 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.
Re: [R] Urgent Request
muhammad mohsin mohsinshahid at yahoo.com writes: Hope you will be fine. I am student of Ph.D and doing ' some work on distribution. I developed a new distribution and having some problems in estimating their parameters by MLE. I used R-program and used maxLik function (maxLik: A Package for Maximum Likelihood Estimation in R) But there is some problem, it is not estimated the parameters properly. I also write an e-mail to the author of this paper but he could not solve my problem. His function works well for simple and known distribution but does not work for a new function. Can anybody spare some time for me? I really need your help. Please inform me so that I can send you the material. Waiting for a quick reply Best Regards, Muhammad Mohsin Dear Mr Mohsin, You are free to post a (self-contained/reproducible and preferably small/minimal) example here and see if it interests anyone sufficiently for them to volunteer time to see if they can find the problem. With respect, though, if you are a PhD student in statistics then this is part of your training, and it should really fall to you, or to your supervisor or other people at your institution, to work out how to solve it. You are (much) more likely to get useful help from this group if you can narrow your problem down to a specific point, and if you can indicate what steps you have tried to take to solve your problem for yourself. Maximum likelihood estimation is in general a challenging computational problem -- just because a general-purpose function or package exists doesn't mean it can solve all problems easily. You may have to work harder to understand the particular structure of your optimization problem and what methods will work for it. For a start, you might try other optimization algorithms (see e.g. the 'optimx' package, which may be on R-forge rather than CRAN [I don't remember], as well as the Optimization task view on CRAN). good luck Ben Bolker __ 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.
Re: [R] R scheduling request
You could include a call to the source function that will read and run an R script (I have not tried this, but don't see any reason that it would not work). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: Alessandro Oggioni [mailto:a.oggi...@ise.cnr.it] Sent: Tuesday, January 18, 2011 6:33 AM To: Greg Snow Cc: r-help Subject: Re: [R] R scheduling request Many thanks Greg! I try to use tcltk2 and tclTaskSchedule function but in argument expr is possible to insert a R script? Have you an example? Alessandro Il 17 gennaio 2011 22.02.51 UTC+1, Greg Snow greg.s...@imail.org ha scritto: You could write a batch file and then have your OS schedule to run R on the batch file whenever you want (see Rscript for one approach of running the batch). Inside of R you can use Sys.sleep to wait a certain amount of time before running the next command. If you load the tcltk2 package then you can use the tclTaskSchedule function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Alessandro Oggioni Sent: Saturday, January 15, 2011 6:19 AM To: r-help Subject: [R] R scheduling request Dear all, I have used R.rps to produce a Google API chart (googleVis) with a data request in another server. But i don't understand how is possible to scheduling a request data to the server and after produce a update of the charts. Thanks in advance. Alessandro Oggioni __ 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. __ 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.
Re: [R] R scheduling request
Thanks Greg, work i'm lost a { after function (). Alessandro 2011/1/19 Greg Snow greg.s...@imail.org: You could include a call to the source function that will read and run an R script (I have not tried this, but don't see any reason that it would not work). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: Alessandro Oggioni [mailto:a.oggi...@ise.cnr.it] Sent: Tuesday, January 18, 2011 6:33 AM To: Greg Snow Cc: r-help Subject: Re: [R] R scheduling request Many thanks Greg! I try to use tcltk2 and tclTaskSchedule function but in argument expr is possible to insert a R script? Have you an example? Alessandro Il 17 gennaio 2011 22.02.51 UTC+1, Greg Snow greg.s...@imail.org ha scritto: You could write a batch file and then have your OS schedule to run R on the batch file whenever you want (see Rscript for one approach of running the batch). Inside of R you can use Sys.sleep to wait a certain amount of time before running the next command. If you load the tcltk2 package then you can use the tclTaskSchedule function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Alessandro Oggioni Sent: Saturday, January 15, 2011 6:19 AM To: r-help Subject: [R] R scheduling request Dear all, I have used R.rps to produce a Google API chart (googleVis) with a data request in another server. But i don't understand how is possible to scheduling a request data to the server and after produce a update of the charts. Thanks in advance. Alessandro Oggioni __ 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. __ 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.
Re: [R] R scheduling request
Many thanks Greg! I try to use tcltk2 and tclTaskSchedule function but in argument expr is possible to insert a R script? Have you an example? Alessandro Il 17 gennaio 2011 22.02.51 UTC+1, Greg Snow greg.s...@imail.org ha scritto: You could write a batch file and then have your OS schedule to run R on the batch file whenever you want (see Rscript for one approach of running the batch). Inside of R you can use Sys.sleep to wait a certain amount of time before running the next command. If you load the tcltk2 package then you can use the tclTaskSchedule function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Alessandro Oggioni Sent: Saturday, January 15, 2011 6:19 AM To: r-help Subject: [R] R scheduling request Dear all, I have used R.rps to produce a Google API chart (googleVis) with a data request in another server. But i don't understand how is possible to scheduling a request data to the server and after produce a update of the charts. Thanks in advance. Alessandro Oggioni __ 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. __ 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.
Re: [R] R scheduling request
You could write a batch file and then have your OS schedule to run R on the batch file whenever you want (see Rscript for one approach of running the batch). Inside of R you can use Sys.sleep to wait a certain amount of time before running the next command. If you load the tcltk2 package then you can use the tclTaskSchedule function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Alessandro Oggioni Sent: Saturday, January 15, 2011 6:19 AM To: r-help Subject: [R] R scheduling request Dear all, I have used R.rps to produce a Google API chart (googleVis) with a data request in another server. But i don't understand how is possible to scheduling a request data to the server and after produce a update of the charts. Thanks in advance. Alessandro Oggioni __ 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. __ 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.
[R] R scheduling request
Dear all, I have used R.rps to produce a Google API chart (googleVis) with a data request in another server. But i don't understand how is possible to scheduling a request data to the server and after produce a update of the charts. Thanks in advance. Alessandro Oggioni __ 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.
Re: [R] Help request: highlighting R code on WordPress.com blogs
Hello D, Thanks for sharing your technique, nice work :) I hope the solution the people here are helping with will make it both cheaper and simpler for people with less CSS expreince. p.s: thank you for the kinds words regarding R-bloggers.com Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Fri, Sep 10, 2010 at 6:40 AM, D Kelly O'Day ko...@processtrends.comwrote: Tali I am one of your estimated 29 Wordpress bloggers. Thanks for your RBloggers site!! I use Wordpress.com's site for my blog. I use a simple method to highlight my R script in Wordpress, example http://chartsgraphs.wordpress.com/2010/07/17/time-series-regression-of-temperature-anomaly-data-1-%E2%80%93-don%E2%80%99t-use-ols/#more-3390 here . I use pre Rscript /pre to set up my R script blocks. I purchased Wordpress' CSS service and customized the pre /pre tags to add a text box and pale yellow color scheme. I use SnagIt to make images of the console results. -- View this message in context: http://r.789695.n4.nabble.com/Help-request-highlighting-R-code-on-WordPress-com-blogs-tp2532433p2533842.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[alternative HTML version deleted]] __ 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.
[R] Help request: highlighting R code on WordPress.com blogs
Hello dear R help members (and also Yihui and Romain), There are currently 28 R bloggers (out of the 117 R-bloggershttp://www.r-bloggers.com/I know of) that are using wordpress.com for publishing their R code (and I suspect this number will increase with time). WordPress.com doesn't support R syntax highlighting, nor can it be embedded from other services (like gist githttp://gettinggeneticsdone.blogspot.com/2010/09/embed-rstats-code-with-syntax.html ) After contacting the WordPress.com vip manager, he instructed me that they will add R support if a relevant brush will be created according to this document: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/custom.html Since this is what they use on wordpress.com (see: http://en.support.wordpress.com/code/posting-source-code/). Creating this brush is beyond my ability at this point, I am writing to *ask if any of you can/wishes to make this brush *for the community. Something I thought might be relevant is the code Yihui Xie recently wrotehttp://yihui.name/en/2010/08/auto-completion-in-notepad-for-r-script/for creating a NPPtoR code brush ( http://yihui.name/en/wp-content/uploads/2010/08/Npp_R_Auto_Completion.r) If such a brush will be created, I'll push to have it included in wordpress.com and to try and inform the current R bloggers using it. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- [[alternative HTML version deleted]] __ 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.
Re: [R] Help request: highlighting R code on WordPress.com blogs
Thanks, Tal. It does not look too difficult to write such a brush, which is actually a JS file. However, I have a concern that R has thousands of functions (in base R only), so it might not worth including all of them in the brush, which is the way that they implemented the highlighting script for Java and VB (they didn't define the list of functions because there are too many). Then what we need to do is just to insert a few keywords like TRUE/FALSE/for/while in the JS. I would like to contribute 10 minutes on this if nobody will pick up this job. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Thu, Sep 9, 2010 at 3:02 AM, Tal Galili tal.gal...@gmail.com wrote: Hello dear R help members (and also Yihui and Romain), There are currently 28 R bloggers (out of the 117 R-bloggers I know of) that are using wordpress.com for publishing their R code (and I suspect this number will increase with time). WordPress.com doesn't support R syntax highlighting, nor can it be embedded from other services (like gist git) After contacting the WordPress.com vip manager, he instructed me that they will add R support if a relevant brush will be created according to this document: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/custom.html Since this is what they use on wordpress.com (see: http://en.support.wordpress.com/code/posting-source-code/). Creating this brush is beyond my ability at this point, I am writing to ask if any of you can/wishes to make this brush for the community. Something I thought might be relevant is the code Yihui Xie recently wrote for creating a NPPtoR code brush (http://yihui.name/en/wp-content/uploads/2010/08/Npp_R_Auto_Completion.r) If such a brush will be created, I'll push to have it included in wordpress.com and to try and inform the current R bloggers using it. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- __ 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.
Re: [R] Help request: highlighting R code on WordPress.com blogs
Hello Yihui, I'd be glad to have you try and create the R brush - thanks for offering! In case you'll come up against walls, I hope there would be people in the mailing list that would be able to help out. Cheers, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Thu, Sep 9, 2010 at 10:01 PM, Yihui Xie x...@yihui.name wrote: Thanks, Tal. It does not look too difficult to write such a brush, which is actually a JS file. However, I have a concern that R has thousands of functions (in base R only), so it might not worth including all of them in the brush, which is the way that they implemented the highlighting script for Java and VB (they didn't define the list of functions because there are too many). Then what we need to do is just to insert a few keywords like TRUE/FALSE/for/while in the JS. I would like to contribute 10 minutes on this if nobody will pick up this job. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Thu, Sep 9, 2010 at 3:02 AM, Tal Galili tal.gal...@gmail.com wrote: Hello dear R help members (and also Yihui and Romain), There are currently 28 R bloggers (out of the 117 R-bloggers I know of) that are using wordpress.com for publishing their R code (and I suspect this number will increase with time). WordPress.com doesn't support R syntax highlighting, nor can it be embedded from other services (like gist git) After contacting the WordPress.com vip manager, he instructed me that they will add R support if a relevant brush will be created according to this document: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/custom.html Since this is what they use on wordpress.com (see: http://en.support.wordpress.com/code/posting-source-code/). Creating this brush is beyond my ability at this point, I am writing to ask if any of you can/wishes to make this brush for the community. Something I thought might be relevant is the code Yihui Xie recently wrote for creating a NPPtoR code brush (http://yihui.name/en/wp-content/uploads/2010/08/Npp_R_Auto_Completion.r ) If such a brush will be created, I'll push to have it included in wordpress.com and to try and inform the current R bloggers using it. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- [[alternative HTML version deleted]] __ 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.
Re: [R] Help request: highlighting R code on WordPress.com blogs
The question would be performance issues for having too many functions. We could just limit it to the reserved keywords. Another option for the functions is to highlight anything that looks like a function with the regular expression /[\w._]+(?=\()/ that is any function name with periods and underscores that is immediately followed by an open parentheses, or optionally by any number of spaces then an open parentheses /[\w._]+[ \t]*(?=\()/ -Andrew On Thu, Sep 9, 2010 at 1:01 PM, Yihui Xie x...@yihui.name wrote: Thanks, Tal. It does not look too difficult to write such a brush, which is actually a JS file. However, I have a concern that R has thousands of functions (in base R only), so it might not worth including all of them in the brush, which is the way that they implemented the highlighting script for Java and VB (they didn't define the list of functions because there are too many). Then what we need to do is just to insert a few keywords like TRUE/FALSE/for/while in the JS. I would like to contribute 10 minutes on this if nobody will pick up this job. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Thu, Sep 9, 2010 at 3:02 AM, Tal Galili tal.gal...@gmail.com wrote: Hello dear R help members (and also Yihui and Romain), There are currently 28 R bloggers (out of the 117 R-bloggers I know of) that are using wordpress.com for publishing their R code (and I suspect this number will increase with time). WordPress.com doesn't support R syntax highlighting, nor can it be embedded from other services (like gist git) After contacting the WordPress.com vip manager, he instructed me that they will add R support if a relevant brush will be created according to this document: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/custom.html Since this is what they use on wordpress.com (see: http://en.support.wordpress.com/code/posting-source-code/). Creating this brush is beyond my ability at this point, I am writing to ask if any of you can/wishes to make this brush for the community. Something I thought might be relevant is the code Yihui Xie recently wrote for creating a NPPtoR code brush (http://yihui.name/en/wp-content/uploads/2010/08/Npp_R_Auto_Completion.r) If such a brush will be created, I'll push to have it included in wordpress.com and to try and inform the current R bloggers using it. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- __ 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. __ 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.
Re: [R] Help request: highlighting R code on WordPress.com blogs
Tali I am one of your estimated 29 Wordpress bloggers. Thanks for your RBloggers site!! I use Wordpress.com's site for my blog. I use a simple method to highlight my R script in Wordpress, example http://chartsgraphs.wordpress.com/2010/07/17/time-series-regression-of-temperature-anomaly-data-1-%E2%80%93-don%E2%80%99t-use-ols/#more-3390 here . I use pre Rscript /pre to set up my R script blocks. I purchased Wordpress' CSS service and customized the pre /pre tags to add a text box and pale yellow color scheme. I use SnagIt to make images of the console results. -- View this message in context: http://r.789695.n4.nabble.com/Help-request-highlighting-R-code-on-WordPress-com-blogs-tp2532433p2533842.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Feature request for as.Date() function 20)
If you specify a format, then you don't get the error, just a missing value. It is a good practice to always specify the format rather than expecting the computer to always guess correctly or expect the original programmers to have anticipated everything that you may ever try. (the development version of the fortunes package has an entry about this). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of nabble.30.miller_2...@spamgourmet.com Sent: Wednesday, November 25, 2009 2:40 PM To: r-help@r-project.org Cc: r-help Subject: Re: [R] Feature request for as.Date() function 20) On Wed, Nov 25, 2009 at 2:56 PM, jim holtman - jholt...@gmail.com +nabble+miller_2555+9dc9649aca.jholtman#gmail@spamgourmet.com wrote: Seems to work fine in my testing: PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Similarly, the following command produces the same error: as.Date(NA) However, as.Date(NA) performs as documented. Can we enhance the as.Date() function to convert NA strings into NA value prior to type conversion? I sincerely appreciate the help, but with all due respect, I have read the posting guide and did provide the minimal code necessary to reproduce the desired feature. To reiterate, I would like to be able to feed the character string NA to the as.Date() function to yield the same result as `as.Date(NA)`. Please advise if testing the following does not yield an error: as.Date(NA); This may or may not aid the read.csv() error message in my particular code (for which a workaround has already been identified). Thank you. __ 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. __ 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.
Re: [R] Feature request for as.Date() function
On Thu, Nov 26, 2009 at 12:08 AM, jim holtman - jholt...@gmail.com +nabble+miller_2555+9dc9649aca.jholtman#gmail@spamgourmet.com wrote: An easy way is just to write your own function that will accept NA, convert it to NA and then call as.Date. I have written such a function, which has provided the temporary workaround mentioned. ( I am not that lazy yet :-) ) R is a functional language, so write some functions. Don't try to overload existing functions with new options that may break a lot of existing code. If you have special requirements, then adapt your code to them. You would probably have to wait around for a long time before an new option got in, so it is easier to create your own. I do not mind waiting for the additional functionality (and it is no longer an immediate need given the workaround). I was attempting to contribute to the continued enhancement of an open source project. Since the as.Date() function already defines standard unambiguous formats, and since NA (and NaN, Inf, etc) are not ambiguous within the transform to their numeric counterparts, it stands to reason that this is logical behaviour of this function. I also doubt this enhancement would break moderate-to-well-designed code since: (1) Existing code would enact a stop() condition based on the current implementation, forcing error-handling, if any. (2) Converting NA (and NaN, inf, etc) is not ambiguous. Coders feeding such strings should expect their numeric counterparts. In all likelihood, coders would convert these strings manually in error-handling code anyway. I have my solution, but wanted to better the project for use by other community members. The R Core Development Team is welcome to accept or ignore the suggestion. I do appreciate the time to discuss this topic, but will consider the matter closed for my part. Thanks. __ 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.
Re: [R] Feature request for as.Date() function
The situation he is referring to seems to be this: L - date,value\n'2009-01-01',10\n'2009-02-01',1\n'NA', 3 read.csv(textConnection(L), colClasses = c(Date, numeric)) Error in charToDate(x) : character string is not in a standard unambiguous format where all the fields in the date column are quoted. On Wed, Nov 25, 2009 at 2:56 PM, jim holtman jholt...@gmail.com wrote: Seems to work fine in my testing: x - read.csv(textConnection(date,value + 2009-01-01,10 + 2009-02-01,1 + 'NA', 3), colClasses=c(Date, 'integer')) str(x) 'data.frame': 3 obs. of 2 variables: $ date :Class 'Date' num [1:3] 14245 14276 NA $ value: int 10 1 3 x - read.csv(textConnection(date,value + 2009-01-01,10 + 2009-02-01,1 + NA, 3), colClasses=c(Date, 'integer')) str(x) 'data.frame': 3 obs. of 2 variables: $ date :Class 'Date' num [1:3] 14245 14276 NA $ value: int 10 1 3 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. On Wed, Nov 25, 2009 at 12:38 PM, nabble.30.miller_2...@spamgourmet.com wrote: Hello - I have a csv file with a few date columns. Some of the records have an NA character string instead of the date. When I attempt to use read.csv() and typecast the columns using colClasses, I receive the following error: Error in charToDate(x) : character string is not in a standard unambiguous format Similarly, the following command produces the same error: as.Date(NA) However, as.Date(NA) performs as documented. Can we enhance the as.Date() function to convert NA strings into NA value prior to type conversion? Thanks! __ 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.
[R] Feature request for as.Date() function
Hello - I have a csv file with a few date columns. Some of the records have an NA character string instead of the date. When I attempt to use read.csv() and typecast the columns using colClasses, I receive the following error: Error in charToDate(x) : character string is not in a standard unambiguous format Similarly, the following command produces the same error: as.Date(NA) However, as.Date(NA) performs as documented. Can we enhance the as.Date() function to convert NA strings into NA value prior to type conversion? Thanks! __ 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.
Re: [R] Feature request for as.Date() function
Seems to work fine in my testing: x - read.csv(textConnection(date,value + 2009-01-01,10 + 2009-02-01,1 + 'NA', 3), colClasses=c(Date, 'integer')) str(x) 'data.frame': 3 obs. of 2 variables: $ date :Class 'Date' num [1:3] 14245 14276 NA $ value: int 10 1 3 x - read.csv(textConnection(date,value + 2009-01-01,10 + 2009-02-01,1 + NA, 3), colClasses=c(Date, 'integer')) str(x) 'data.frame': 3 obs. of 2 variables: $ date :Class 'Date' num [1:3] 14245 14276 NA $ value: int 10 1 3 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. On Wed, Nov 25, 2009 at 12:38 PM, nabble.30.miller_2...@spamgourmet.com wrote: Hello - I have a csv file with a few date columns. Some of the records have an NA character string instead of the date. When I attempt to use read.csv() and typecast the columns using colClasses, I receive the following error: Error in charToDate(x) : character string is not in a standard unambiguous format Similarly, the following command produces the same error: as.Date(NA) However, as.Date(NA) performs as documented. Can we enhance the as.Date() function to convert NA strings into NA value prior to type conversion? Thanks! __ 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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.
Re: [R] Feature request for as.Date() function
hi, it fails, when the NA is surrounded by double quotes, which is the default way of quoting of the write.table command. x - read.csv(textConnection('date,value + + 2009-01-01,10 + + 2009-02-01,1 + + NA, 3'), colClasses=c(Date, 'integer')) Fehler in fromchar(x) : character string is not in a standard unambiguous format regards, stefan On Wed, Nov 25, 2009 at 02:56:56PM -0500, jim holtman wrote: Seems to work fine in my testing: x - read.csv(textConnection(date,value + 2009-01-01,10 + 2009-02-01,1 + 'NA', 3), colClasses=c(Date, 'integer')) str(x) 'data.frame': 3 obs. of 2 variables: $ date :Class 'Date' num [1:3] 14245 14276 NA $ value: int 10 1 3 x - read.csv(textConnection(date,value + 2009-01-01,10 + 2009-02-01,1 + NA, 3), colClasses=c(Date, 'integer')) str(x) 'data.frame': 3 obs. of 2 variables: $ date :Class 'Date' num [1:3] 14245 14276 NA $ value: int 10 1 3 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. On Wed, Nov 25, 2009 at 12:38 PM, nabble.30.miller_2...@spamgourmet.com wrote: Hello - I have a csv file with a few date columns. Some of the records have an NA character string instead of the date. When I attempt to use read.csv() and typecast the columns using colClasses, I receive the following error: Error in charToDate(x) : character string is not in a standard unambiguous format Similarly, the following command produces the same error: as.Date(NA) However, as.Date(NA) performs as documented. Can we enhance the as.Date() function to convert NA strings into NA value prior to type conversion? Thanks! __ 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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. __ 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.
Re: [R] Feature request for as.Date() function 20)
On Wed, Nov 25, 2009 at 2:56 PM, jim holtman - jholt...@gmail.com +nabble+miller_2555+9dc9649aca.jholtman#gmail@spamgourmet.com wrote: Seems to work fine in my testing: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Similarly, the following command produces the same error: as.Date(NA) However, as.Date(NA) performs as documented. Can we enhance the as.Date() function to convert NA strings into NA value prior to type conversion? I sincerely appreciate the help, but with all due respect, I have read the posting guide and did provide the minimal code necessary to reproduce the desired feature. To reiterate, I would like to be able to feed the character string NA to the as.Date() function to yield the same result as `as.Date(NA)`. Please advise if testing the following does not yield an error: as.Date(NA); This may or may not aid the read.csv() error message in my particular code (for which a workaround has already been identified). Thank you. __ 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.
Re: [R] Feature request for as.Date() function 20)
An easy way is just to write your own function that will accept NA, convert it to NA and then call as.Date. R is a functional language, so write some functions. Don't try to overload existing functions with new options that may break a lot of existing code. If you have special requirements, then adapt your code to them. You would probably have to wait around for a long time before an new option got in, so it is easier to create your own. On Wed, Nov 25, 2009 at 4:40 PM, nabble.30.miller_2...@spamgourmet.com wrote: On Wed, Nov 25, 2009 at 2:56 PM, jim holtman - nabble.30.miller_2...@spamgourmet.com wrote: Seems to work fine in my testing: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Similarly, the following command produces the same error: as.Date(NA) However, as.Date(NA) performs as documented. Can we enhance the as.Date() function to convert NA strings into NA value prior to type conversion? I sincerely appreciate the help, but with all due respect, I have read the posting guide and did provide the minimal code necessary to reproduce the desired feature. To reiterate, I would like to be able to feed the character string NA to the as.Date() function to yield the same result as `as.Date(NA)`. Please advise if testing the following does not yield an error: as.Date(NA); This may or may not aid the read.csv() error message in my particular code (for which a workaround has already been identified). Thank you. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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.
[R] A request for pointers on how to analyse Twitter with R ?
Hello dear R members. I just came across this website: http://giladlotan.org/viz/iranelection/ Here what it is about: ReTweet Revolution is a visual exploration of the most popular conversation threads that were passed amongst Twitter users at the time of the events following the Iranian elections in June of 2009. It uses an algorithm described here: http://giladlotan.org/viz/iranelection/methodology.html A very simple rundown of my analysis process: 1. Public Timeline Polling - During the period of the #iranelection events, my I would poll Twitter's public timeline, looking for keywords such as #iranelection,#gr88,ahmadinejad,mousavi. 2. Text Matching Algorithm - as new tweets entered my database, making matches between those that belong to the same conversational thread. 3. ReTweet analysis - mapping out the network structure by which messages spread between users. 4. Text differentiation analysis - looking at syntactical differences between tweets from within each thread. This highlights the broken telephone aspect of ReTweeting, where every user can choose to change and add to the message as it is passed onwards. *more to come* And I would love to be able to do something even similar to what he does (simply because it is cool). They way I see it it requires several steps into making this happen, including: 1) a way to pull and store data from twitter 2) a way to extract the data from the database 3) tools to analyse and visualize the data (this, I imagine, can be done using the tm package, the rest I don't know how to approach) Can any one give interesting pointers on this one ? Thanks, Tal -- -- My contact information: Tal Galili Phone number: 972-50-3373767 FaceBook: Tal Galili My Blogs: http://www.r-statistics.com/ http://www.talgalili.com http://www.biostatistics.co.il [[alternative HTML version deleted]] __ 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.
[R] Subscription request
Hello, I would like to subscribe to the mailing list. I already receive the daily digest, but for some reason I am not subscribed to the list, meaning any posts I make by replying to the e-mail digest have to be placed on the list by a moderator - incurring significant delay. Thanks, Michael [[alternative HTML version deleted]] __ 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.
Re: [R] Subscription request
On 29-Mar-09 11:48:12, Michael Larsson wrote: Hello, I would like to subscribe to the mailing list. I already receive the daily digest, but for some reason I am not subscribed to the list, meaning any posts I make by replying to the e-mail digest have to be placed on the list by a moderator - incurring significant delay. Thanks, Michael This almost certainly means that some other email address of yours is subscribed to the list (via which you receive the digests), whereas the email address from which you try to post to the list is not subscribed. You could check this by looking into the full headers of a digest you have received, to check what address it has been sent to. For example, in one message to me from R-help I find (about halfway down the list of headers): Received: from hypatia.math.ethz.ch ([129.132.145.15]) by deimos.mcc.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69 (FreeBSD)) (envelope-from r-help-boun...@r-project.org) id 1LndwT-000A37-TR for ted.hard...@manchester.ac.uk; Sat, 28 Mar 2009 19:11:42 + showing (in the for ... clause) that the R-help list server (hypatia.math.ethz.ch) addressed it to ted.hard...@manchester.ac.uk If you find that out, then you could work round the problem by using that address to post to R-help. Alternatively, you can simply visit the R-help web page https://stat.ethz.ch/mailman/listinfo/r-help and there subscribe your other email address (the one from which you wish to post). This will then mean that you will receive the messages from R-help at both addresses, unless yoou either use the above web-page to disable sending of mail to one of the addresses, or use it to unsubscribe the one you do not wish to post from. Though a moderator, I cannot check what addresses are subscribed (only the list owner can do that), so that is as far as I can go to help. And I hope it helps! Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 29-Mar-09 Time: 15:52:39 -- XFMail -- __ 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.
[R] Odp: Request: Most repeated sequence considering combinations at each row
Hi not sure if this is what you want. It does not do fuzzy matching but make a exact evaluation equal row sums of arrays. rle(do.call(c,lapply(lapply(l, rowSums), function(x) paste(x, collapse= Maybe something similar can be done without conversion to character. Regards Petr [EMAIL PROTECTED] napsal dne 24.10.2008 12:34:15: Dear friends Hope you all are fine. Suppose we have a list of arrays. a1=c(4,4,4,4,0,4,4,4,0,3,3,0,0,0,0,0); a1=array(a1,dim=c(4,4)); a2=c(4,4,4, 4,0,4,4,4,0,3,3,0,0,0,0,0); a2=array(a2,dim=c(4,4)); a3=c(4,4,4,4,0,3,3,4,0,4,4,0,0,0,0,0); a3=array(a3,dim=c(4,4)); a4=c(4,4,4,4, 4,0,3,3,3,3,0,4,4,4,0,0,0,0,0,0); a4=array(a4,dim=c(5,4)); a5=c(4,4,4,4,4,0,4, 4,4,4,0,3,3,3,0,0,1,1,0,0); a5=array(a5,dim=c(5,4)); a6=c(4,4,4,4,4,0,1,1,1,1, 0,4,4,4,0,0,3,3,0,0); a6=array(a6,dim=c(5,4)); a7=c(1,1,1,1,1,0,4,4,4,4,0,3,3, 3,0,0,4,4,0,0); a7=array(a7,dim=c(5,4)); a8=c(4,4,4,4,4,0,3,3,3,3,0,1,1,1,0,0, 4,4,0,0); a8=array(a8,dim=c(5,4)); l=list(a1,a2,a3,a4,a5,a6,a7,a8); x - sapply(1:length(l), function(x) { sum(sapply(l, function(y) { if ( nrow(l[[x]]) != nrow(y) | ncol(l[[x]]) != ncol(y) ) FALSE else sum(y != l[[x]]) == 0 })) } ); l; x Using the above function, we are able to get frequency of each most repeated similar components of the list. For example, [[1]] and [[2]] are most repeated similar out of all. But if we consider the combinations at each row of each array. Then [[3]] will be included with [[1]] and [[2]]. Also [[5]], [[6]] and [[8]] will be similar. How can we modify the above function to get the desired most repeated sequence in this case? Any help in this regard is needed. best regards M.Azam [[alternative HTML version deleted]] __ 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. __ 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.
Re: [R] Odp: Request: Most repeated sequence considering combinations at each row
Dear Petr Thanks for the response. Hope it will now help me to proceed. best regards M.Azam From: Petr PIKAL [EMAIL PROTECTED] Cc: R Help r-help@r-project.org; [EMAIL PROTECTED] Sent: Monday, October 27, 2008 8:43:27 AM Subject: Odp: [R] Request: Most repeated sequence considering combinations at each row Hi not sure if this is what you want. It does not do fuzzy matching but make a exact evaluation equal row sums of arrays. rle(do.call(c,lapply(lapply(l, rowSums), function(x) paste(x, collapse= Maybe something similar can be done without conversion to character. Regards Petr [EMAIL PROTECTED] napsal dne 24.10.2008 12:34:15: Dear friends Hope you all are fine. Suppose we have a list of arrays. a1=c(4,4,4,4,0,4,4,4,0,3,3,0,0,0,0,0); a1=array(a1,dim=c(4,4)); a2=c(4,4,4, 4,0,4,4,4,0,3,3,0,0,0,0,0); a2=array(a2,dim=c(4,4)); a3=c(4,4,4,4,0,3,3,4,0,4,4,0,0,0,0,0); a3=array(a3,dim=c(4,4)); a4=c(4,4,4,4, 4,0,3,3,3,3,0,4,4,4,0,0,0,0,0,0); a4=array(a4,dim=c(5,4)); a5=c(4,4,4,4,4,0,4, 4,4,4,0,3,3,3,0,0,1,1,0,0); a5=array(a5,dim=c(5,4)); a6=c(4,4,4,4,4,0,1,1,1,1, 0,4,4,4,0,0,3,3,0,0); a6=array(a6,dim=c(5,4)); a7=c(1,1,1,1,1,0,4,4,4,4,0,3,3, 3,0,0,4,4,0,0); a7=array(a7,dim=c(5,4)); a8=c(4,4,4,4,4,0,3,3,3,3,0,1,1,1,0,0, 4,4,0,0); a8=array(a8,dim=c(5,4)); l=list(a1,a2,a3,a4,a5,a6,a7,a8); x - sapply(1:length(l), function(x) { sum(sapply(l, function(y) { if ( nrow(l[[x]]) != nrow(y) | ncol(l[[x]]) != ncol(y) ) FALSE else sum(y != l[[x]]) == 0 })) } ); l; x Using the above function, we are able to get frequency of each most repeated similar components of the list. For example, [[1]] and [[2]] are most repeated similar out of all. But if we consider the combinations at each row of each array. Then [[3]] will be included with [[1]] and [[2]]. Also [[5]], [[6]] and [[8]] will be similar. How can we modify the above function to get the desired most repeated sequence in this case? Any help in this regard is needed. best regards M.Azam [[alternative HTML version deleted]] __ 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. [[alternative HTML version deleted]] __ 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.
[R] Displaying number of Y/N affected by tree in rule form RE: R question/request on rules from rpart
Hi Prof. Williams, thanks for your suggestion. The updated code is below. It turns out it was a matter of displaying the second column in yval to get the number of N and subtracting it from the n column in the frame to get the number of Y remaining in a binary example. once this is added now the function returns the rules along with Y and N count affected by the resulting rule. I am ccing the r-help post in case anyone wants to reuse this updated version as well. This is a great little function. Thanks for developing it and suggesting how to make the enhancement. Regards, Dhruv listrules-function(model) { if (!inherits(model, rpart)) stop(Not a legitimate rpart tree) # # Get some information. # frm - model$frame names - row.names(frm) ylevels - attr(model, ylevels) ds.size - model$frame[1,]$n # # Print each leaf node as a rule. # for (i in 1:nrow(frm)) { if (frm[i,1] == leaf) { # The following [,5] is hardwired - needs work! cat(\n) cat(sprintf( Rule number: %s , names[i])) cat(sprintf([yval=%s cover=%d N=%.0f Y=%.0f (%.0f%%) prob=%0.2f]\n, ylevels[frm[i,]$yval], frm[i,]$n, formatC(frm[i,]$yval2[,2], format = f, digits = 2), formatC(frm[i,]$n-frm[i,]$yval2[,2], format = f, digits = 2), round(100*frm[i,]$n/ds.size), frm[i,]$yval2[,5])) pth - path.rpart(model, nodes=as.numeric(names[i]), print.it=FALSE) cat(sprintf( %s\n, unlist(pth)[-1]), sep=) } } } listrules(fit) Copyright (c) 2004-2008 Togaware Pty Ltd -Original Message- From: Graham Williams [mailto:[EMAIL PROTECTED] Sent: Friday, October 24, 2008 5:59 PM To: Sharma, Dhruv Subject: Re: R question/request on rules from rpart Hi Dhruv, I would think what you propose is possible, and probably even simple. Would need to explore through the model structure. Might need to multiply the proportions by the total to get the numbers. Regards, Graham Received Sat 25 Oct 2008 5:08am +1100 from Sharma, Dhruv: Hi Prof. Williams. I wanted to use your code to convert trees into rules and had a question. Is there anyway to get the code below to print out the number of Y and N resulting by the rule? Currently the code prints cover=49 (0%) prob=0.91 but not the number of Y or N being affected by the rule. When I plot large trees using use.n it is hard to read the numbers and found your rule function to be very neat. It would be great if it could be enhanced to print the number of Y and N affected by the rule. thanks Dhruv http://datamining.togaware.com/survivor/Convert_Tree.html list.rules.rpart - function(model) { if (!inherits(model, rpart)) stop(Not a legitimate rpart tree) # # Get some information. # frm - model$frame names - row.names(frm) ylevels - attr(model, ylevels) ds.size - model$frame[1,]$n # # Print each leaf node as a rule. # for (i in 1:nrow(frm)) { if (frm[i,1] == leaf) { # The following [,5] is hardwired - needs work! cat(\n) cat(sprintf( Rule number: %s , names[i])) cat(sprintf([yval=%s cover=%d (%.0f%%) prob=%0.2f]\n, ylevels[frm[i,]$yval], frm[i,]$n, round(100*frm[i,]$n/ds.size), frm[i,]$yval2[,5])) pth - path.rpart(model, nodes=as.numeric(names[i]), print.it=FALSE) cat(sprintf( %s\n, unlist(pth)[-1]), sep=) } } } Copyright (c) 2004-2008 Togaware Pty Ltd __ 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.
[R] Fwd: request: most repeated sequnce
-- Forwarded message -- From: jim holtman [EMAIL PROTECTED] Date: Sun, Sep 7, 2008 at 11:42 AM Subject: Re: [R] request: most repeated sequnce To: Muhammad Azam [EMAIL PROTECTED] This should do it for you: x=c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,3,3,3,4,4,4,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4, + 0,0,0,0,0,0,1,2,2,2,2,2,0,3,3,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) x=array(x,dim=c(3,6,7)) apply(x,3,function(.mat){ + + rows - table(apply(.mat,1,function(z){ + # remove the zeros + z - z[z != 0] + + paste(z,collapse=' ') + })) + # remove empty strings + rows - rows[names(rows) != ] + + if (!is.null(rows)){ + return(names(rows)[which.max(rows)]) + } else return(NULL) + }) [[1]] [1] 1 [[2]] [1] 1 2 3 [[3]] [1] 1 2 3 4 [[4]] [1] 1 2 3 4 [[5]] [1] 2 2 3 4 [[6]] character(0) [[7]] [1] 1 On Sun, Sep 7, 2008 at 8:08 AM, Muhammad Azam [EMAIL PROTECTED] wrote: Dear Jim Holtman Thanks a lot for your help. The problem is still there. Please consider this set of values x=c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,3,3,3,4,4,4,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4, 0,0,0,0,0,0,1,2,2,2,2,2,0,3,3,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) x=array(x,dim=c(3,6,7)) apply(x,3,function(.mat){ rows - table(apply(.mat,1,function(z){ # remove the zeros z - z[z != 0] if (length(z) == 0) return(NULL) paste(z,collapse=' ') })) names(rows[which.max(rows)]) }) output is: Error in as.vector(x, mode) : invalid argument 'mode' Note: the obtained rows consist of all zeros should not take part in most repeated sequence process. best regards Muhammad Azam - Original Message From: jim holtman [EMAIL PROTECTED] To: Muhammad Azam [EMAIL PROTECTED] Cc: R-help request [EMAIL PROTECTED]; R Help r-help@r-project.org Sent: Sunday, September 7, 2008 12:36:18 AM Subject: Re: [R] request: most repeated sequnce This may come closer since it removes the zeros before comparison: x=c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,3,3,3,4,4,4,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4, + 0,0,0,0,0,0,1,2,2,2,2,2,0,3,3,0,4,4,0,0,0,0,0,0) x=array(x,dim=c(3,6,5)) apply(x,3,function(.mat){ +rows - table(apply(.mat,1,function(z){ +# remove the zeros +z - z[z != 0] +if (length(z) == 0) return(NULL) +paste(z,collapse=' ') +})) +names(rows[which.max(rows)]) + }) [1] 1 1 2 3 1 2 3 4 1 2 3 4 2 2 3 4 On Sat, Sep 6, 2008 at 12:48 PM, Muhammad Azam [EMAIL PROTECTED] wrote: Dear R community Initially i thought my problem has been solved but one thing which i found e.g. if 1. All the elements of a sector are zero e.g , , 7 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]0000000000 [2,]0000000000 [3,]0000000000 [4,]0000000000 [5,]0000000000 2. Majority of the rows consist of zeros e.g. , , 5 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]4400000000 [2,]4400000000 [3,]0000000000 [4,]0000000000 [5,]0000000000 Actually zeros are not my values. I get values and fill the remaining parts with zeros like x=array(0,dim=c(3,6,5)). Now according to first strategy 0000000000 are most repeated sequence of rows in both of above cases. But i don't want to consider cases where all elements are zeros and interested to get 44 00000000 or just 4 4 in case 2. Thanks and best regards Muhammad Azam - Original Message From: jim holtman [EMAIL PROTECTED] To: Muhammad Azam [EMAIL PROTECTED] Cc: R Help r-help@r-project.org; R-help request [EMAIL PROTECTED] Sent: Saturday, September 6, 2008 2:39:19 PM Subject: Re: [R] request: most repeated sequnce Here is a start. You can delete the zeros: x=c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,3,3,3,4,4,4,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4, + 0,0,0,0,0,0,1,2,2,2,2,2,0,3,3,0,4,4,0,0,0,0,0,0) x=array(x,dim=c(3,6,5)) apply(x,3,function(.mat){ +rows - table(apply(.mat,1,function(z){ +paste(z,collapse=' ') +})) +names(rows[which.max(rows)]) + }) [1] 1 0 0 0 0 0 1 2 3 0 0 0 1 2 3 4 0 0 1 2 3 4 0 0 2 2 3 4 0 0 On Sat, Sep 6, 2008 at 4:54 AM, Muhammad Azam [EMAIL PROTECTED] wrote
[R] Enhancement request for bringToTop()
Currently (R-2.7.1 on Windows) bringToTop(stay=TRUE) when run before a device is opened, gives the error message bringToTop(stay=TRUE) Error in bringToTop(stay = TRUE) : can only bring windows devices to the front In the same circumstances, a call to par() opens a device. My request is to modify bringToTop(). If bringToTop() determines that it is running in an interactive environment, then it could open a graphics window and honor the request to put the newly opened window on Top. Thanks Rich __ 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.
Re: [R] Enhancement request for bringToTop()
R-devel is the list for enhancement requests. On Tue, 19 Aug 2008, Richard M. Heiberger wrote: Currently (R-2.7.1 on Windows) bringToTop(stay=TRUE) when run before a device is opened, gives the error message bringToTop(stay=TRUE) Error in bringToTop(stay = TRUE) : can only bring windows devices to the front In the same circumstances, a call to par() opens a device. But not necessarily a windows() device. My request is to modify bringToTop(). If bringToTop() determines that it is running in an interactive environment, then it could open a graphics window and honor the request to put the newly opened window on Top. Only if the default graphics device were windows(). It could be Cairo(), for example. bringToTop() applies to a device number, which defaults to dev.cur() which defaults to 1. Unlike par() it is not confined to the current device. You can very easily program what you seem to want. E.g. if(.Device == null device) windows() else bringToTop() or perhaps if(.Device != windows) windows() else bringToTop() Normally opening a device brings it to the top: for Rterm users it might not but then bringToTop() may not either. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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.