Re: [R] Matching multiple search criteria (Unlisting a nested dataset, take 2)

2018-10-16 Thread Bert Gunter
OK, as no one else has offered a solution, I'll take a whack at it. Caveats: This is a brute force attempt using R's basic regular expression engine. It is inelegant and barely tested, so likely to be at best incomplete and buggy, and at worst, incorrect. But maybe Nathan or someone else on the li

Re: [R] Matching multiple search criteria (Unlisting a nested dataset, take 2)

2018-10-16 Thread Bert Gunter
The problem wasn't the data tibbles. You posted in html -- which you were explictly warned against -- and that corrupted your text (e.g. some quotes became "smart quotes", which cannot be properly cut and pasted into R). Bert On Tue, Oct 16, 2018 at 2:47 PM Nathan Parsons wrote: > Argh! Here a

Re: [R] Matching multiple search criteria (Unlisting a nested dataset, take 2)

2018-10-16 Thread Nathan Parsons
Argh! Here are those two example datasets as data frames (not tibbles). Sorry again. This apparently is just not my day. th <- structure(list(status_id = c("x1047841705729306624", "x1046966595610927105", "x1047094786610552832", "x1046988542818308097", "x1046934493553221632", "x10472274428997754

[R] Matching multiple search criteria (Unlisting a nested dataset, take 2)

2018-10-16 Thread Nathan Parsons
Thanks all for your patience. Here’s a second go that is perhaps more explicative of what it is I am trying to accomplish (and hopefully in plain text form)... I’m using the following packages: tidyverse, purrr, tidytext I have a number of tweets in the following form: th <- structure(list(st

Re: [R] year and week to date - before 1/1 and after 12/31

2018-10-16 Thread peter salzman
hi, thanks for replying, it has taken some time to understand i have year+week and i need to find the 1st day and the last day of that week i can decide when week starts for example these 3 examples: df <- data.frame(id = 1:3, year = c(2018, 2018, 2018), week=c(0,1,52)) ## now run for all 3 ro

Re: [R] Unlisting a nested dataset

2018-10-16 Thread Jeff Newmiller
> >Not sure what else I can provide to make this more clear. You can address this deficiency of awareness by using the reprex package to generate the example+errors you are concerned about. Combined with the use of dput described in the link Ista provided (or use of example data from your decla

Re: [R] Unlisting a nested dataset

2018-10-16 Thread Nathan Parsons
Ista - I provided data, code, and the error being returned as per reproducible r protocol. I did not include packages, however. unnest_tokens is from the TidyText package, map/map_chr are from purrr, and everything else is from tidyverse(dplyr/tidyr/etc.) Not sure what else I can provide to mak

Re: [R] Unlisting a nested dataset

2018-10-16 Thread Ista Zahn
Hi Nate, You've made it pretty difficult to answer your question. Please see https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and follow some of the suggestions you find there to make it easier on those who want to help you. Best, Ista On Mon, Oct 15, 2018 at

[R] DNAbin

2018-10-16 Thread Alfredo Cortell
Dear all, Is it possible to convert a data frame with variables (columns) and the number of persons for each variable at a given time at the day (rows) to DNAbin object type, so that I can calculate Tajima's divergence? I've been trying, but I just can't find the way. Thank you very much, V1 V2

Re: [R] year and week to date - before 1/1 and after 12/31

2018-10-16 Thread Jeff Newmiller
Er, my mistake, you are using %U not %W... but now I am really confused, because the first Sunday is trivial with %U/%u. Can you clarify what your actual upstream input is? Is it an invalid date string as you say below, or is it year number? On October 16, 2018 10:22:10 AM PDT, Jeff Newmiller

Re: [R] DNAbin

2018-10-16 Thread David Winsemius
> On Oct 16, 2018, at 7:55 AM, Alfredo Cortell > wrote: > > Hola, buenos dias. > > Escribo porque me gustaría saber si puedo convertir un data frame que > consiste en variables (indicadas por columnas) y en filas (el número de > personas que tienen cada variable en determinada hora del dia.)

Re: [R] year and week to date - before 1/1 and after 12/31

2018-10-16 Thread Jeff Newmiller
If the date in your character representation does not exist then there is no requirement for a POSIX function to give any reliable answer... including NA. Using 00 as the week number won't always work. The first week/weekday combination that is guaranteed to exist by POSIX is 1/1 (first Monday)

Re: [R] GLM Model Summary

2018-10-16 Thread Marc Schwartz via R-help
> On Oct 16, 2018, at 12:33 PM, Neslin, Scott A. > wrote: > > R-Help: > > We are working with your GLM R package. The Summary(Model) now gets printed > by the program as one object and we want to put the coefficient columns into > Excel. We took an initial stab at this by counting the nu

Re: [R] GLM Model Summary

2018-10-16 Thread Amit Mittal
You can just use 'slotNames(modelname) This will return sub objects for which names can be extracted Eg slotNames(modelname) [1] "mfit" "model" names(modelname@mfit) names(modelname@model) Will return all objects within the model including coed car R cover vcov as applicable and you can store pe

Re: [R] GLM Model Summary

2018-10-16 Thread Peter Langfelder
The coefficients are best obtained as summary(Model)$coefficients. This is a matrix can than be saved as a csv file and opened in excel or other spreadsheet software. HTH, Peter On Tue, Oct 16, 2018 at 9:44 AM Neslin, Scott A. wrote: > > R-Help: > > We are working with your GLM R package. The S

Re: [R] GLM Model Summary

2018-10-16 Thread Duncan Murdoch
On 16/10/2018 12:33 PM, Neslin, Scott A. wrote: R-Help: We are working with your GLM R package. The Summary(Model) now gets printed by the program as one object and we want to put the coefficient columns into Excel. We took an initial stab at this by counting the number of characters occupi

[R] GLM Model Summary

2018-10-16 Thread Neslin, Scott A.
R-Help: We are working with your GLM R package. The Summary(Model) now gets printed by the program as one object and we want to put the coefficient columns into Excel. We took an initial stab at this by counting the number of characters occupied by each column. But we have now learned that t

[R] DNAbin

2018-10-16 Thread Alfredo Cortell
Hola, buenos dias. Escribo porque me gustaría saber si puedo convertir un data frame que consiste en variables (indicadas por columnas) y en filas (el número de personas que tienen cada variable en determinada hora del dia.) en un tipo de objeto DNAbin para poder calcular la divergencia de Tajima.

Re: [R] Fw: inconsistency in pbmclapply...

2018-10-16 Thread Bert Gunter
As I think you hve been told before, most attachments don't make it through the mail server. Use ?dput instead to include data. Also, post in plain text, not html. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkel

Re: [R] year and week to date - before 1/1 and after 12/31

2018-10-16 Thread peter salzman
it is simpler than i thought first day of given week is the last day minus 6days in other words: d1 = as.Date('2018 00 Sat',format="%Y %U %a") - 6 d2 = as.Date('2018 00 Sun',format="%Y %U %a") are the same as long both are not NA therefore to get the one that is not NA one can do max( c(d1,d2),

[R] year and week to date - before 1/1 and after 12/31

2018-10-16 Thread peter salzman
hi, to turn year and week into the date one can do the following: as.Date('2018 05 Sun', "%Y %W %a") however, when we want the Sunday (1st day of week) of the 1st week of 2018 we get NA because 1/1/2018 was on Monday as.Date('2018 00 Mon',format="%Y %U %a") ## 2018-01-01 as.Date('2018 00 Sun',f

Re: [R] Finding unique terms

2018-10-16 Thread roslinazairimah zakaria
Yes you are right, I want the sum. I wll change the formula accordingly. On Fri, Oct 12, 2018 at 10:36 AM Jeff Newmiller wrote: > You said "add up"... so you did not mean to say that? Denes computed the > mean... > > On October 11, 2018 3:56:23 PM PDT, roslinazairimah zakaria < > roslina...@gmai

Re: [R] regexp mystery

2018-10-16 Thread PIKAL Petr
Hi Thanks a lot for your insightful answer. I will need to study it in detail, gregexpr and regexpr seems to be quite handy for what I need. Cheers Petr > -Original Message- > From: Ivan Krylov > Sent: Tuesday, October 16, 2018 11:08 AM > To: PIKAL Petr > Cc: r-help@r-project.org > Su

Re: [R] regexp mystery

2018-10-16 Thread Ivan Krylov
On Tue, 16 Oct 2018 08:36:27 + PIKAL Petr wrote: > > dput(x[11]) > "et odYezko: 3 \fas odYezku: 15 s" > gsub("^.*: (\\d+).*$", "\\1", x[11]) > works for 3 This regular expression only matches one space between the colon and the number, but you have more than one of t

[R] Fw: inconsistency in pbmclapply...

2018-10-16 Thread akshay kulkarni
dear members, however, "ts must have more than one observation" error is only found for the first entry of LYG1 ( LYG1[[20]], LYG1[[200]], LYG1[[1000]]..etc are all well defined! From: R-help on behalf of akshay kulkarni S

[R] regexp mystery

2018-10-16 Thread PIKAL Petr
Dear all I have text file with lines like this. > dput(x[9]) "PYedehYev: 300 sZáva~í: 2.160 kg" > dput(x[11]) "et odYezko: 3 \fas odYezku: 15 s" I am able to extract some numbers but others give me headache. gsub("^.*[^:] (\\d+.\\d+).*$", "\\1", x[9])