Re: [R] Reading a datetime vector

2016-02-23 Thread Jim Lemon
Hi Doug,
It is difficult for us to work out what is happening as we don't have
access to a toy data set that we can play with. Excel spreadsheets are one
of those things that you can't just attach to your email to the help list.
If there is somewhere you can leave a _small_ Excel sample file (take the
first 10 rows, say) that we can download (Google Drive, Dropbox?) and
include the URL in your email, maybe someone can offer more than guesses.

Jim

[[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] Reading a datetime vector

2016-02-23 Thread peter dalgaard

On 22 Feb 2016, at 18:30 , Jeff Newmiller  wrote:

> .. read the Excel documentation for representing dates... it is days since 
> December 30, 1899 on Windows.

I seem to recall that that is actually only true for dates after March 1, 1900. 
(The reason that it is not counting December 31st being that someone thought 
that 1900 was a leap year.) 



-pd

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] multiple linear regression with quadratic function

2016-02-23 Thread james.foadi
Dear R community,
this is probably a well-known topic to some of you, but I am not well into it
and would like some clarifications or even jus some suggestions.

I have a quadratic scalar field:

F(x,y)=K*exp(-(a*x^2+b*y^2+c*x*y))

I also have a random set of positive x,y values and related F(x,y) values.
It seems reasonable to estimate the parameters K, a, b, c with a linear 
regression,
using the log of both sides of the equation.

What worries me, though, is the interaction term, c*x*y.

Are there well-known issues on the application of linear regression to cases 
like this one?

Thanks in advance for your answers.

James

-- 
This e-mail and any attachments may contain confidential...{{dropped:16}}

__
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] multiple linear regression with quadratic function

2016-02-23 Thread peter dalgaard
That's pretty standard. Some call it "response surface analysis". Of course you 
need to check assumptions like homoscedasticity on the log scale, etc.

It's not really an R question, specifically; so stats.stackexchange.com is a 
better avenue for more detailed discussions. As far as R goes, you just need to 
be aware that, due to an ancien misfeature, terms like x^2 need to be protected 
by writing I(x^2). 

-pd

On 23 Feb 2016, at 11:42 ,  
 wrote:

> Dear R community,
> this is probably a well-known topic to some of you, but I am not well into it
> and would like some clarifications or even jus some suggestions.
> 
> I have a quadratic scalar field:
> 
>F(x,y)=K*exp(-(a*x^2+b*y^2+c*x*y))
> 
> I also have a random set of positive x,y values and related F(x,y) values.
> It seems reasonable to estimate the parameters K, a, b, c with a linear 
> regression,
> using the log of both sides of the equation.
> 
> What worries me, though, is the interaction term, c*x*y.
> 
> Are there well-known issues on the application of linear regression to cases 
> like this one?
> 
> Thanks in advance for your answers.
> 
> James
> 
> -- 
> This e-mail and any attachments may contain confidential...{{dropped:16}}
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] GIS Analyses for Economics and Marketing

2016-02-23 Thread Roger Bivand
Domagoj Culinovic  gmail.com> writes:

> 
> I am Phdoctorate Candidate at Faculty of economics.
> Also i am using GIS last 26 years, but lat 3 year i am focused on QGIS.
> My earea of interests are GIS in Economics and marketing, and now i am
> combine R and QGIS to have results.

It may be more relevant to post in R-sig-geo than here, given the specific
nature of your question.

You might also look at materials used in connection with GEOSTAT courses:

http://geostat-course.org/

The next course is in Albacete, Spain (the host of the useR! 2013
conference). These materials are mostly related to environmental questions,
but the techniques used are similar.

Roger

> Can someone help me with some tutorials, training materials or course
> examples in area GIS for Marketing or Economics based on QGIS (with Grass
> or any other plugins), and some examples of financial analyses based on
> historical data in using GIS(for exaple to analyse comunity budget spends
> in last 15 years based on GIS data).

__
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] .Internal(La_rs(x, FALSE)) crashes R after long (reproducible) script on windows only

2016-02-23 Thread Anthony Damico
hi, does anybody have a clue why .Internal(La_rs(x,FALSE)) is getting
corrupted (actual detonation occurs within La_solve_cmplx within Lapack.c)
on windows but not mac/unix?

i have provided two (long) scripts that reproduce the problem and a third
script modified to trigger the crash that unfortunately does not reproduce
the problem

http://stackoverflow.com/questions/35447971/internalla-rsx-false-crashes-r-after-long-reproducible-script-on-windows

thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Password-Shiny

2016-02-23 Thread boB Rudis
What would cause you to think this mailing list is a free code-writing
service? Perhaps post your question on Amazon's Mechanical Turk
service?

Alternatively: purchase a license for Shiny Server Pro.

On Tue, Feb 23, 2016 at 12:45 AM, Venky  wrote:
> Hi R users,
>
> Please anyone help me how to create password access in shiny
>
>
> Thanks and Regards
> Venkatesan
>
> [[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] .Internal(La_rs(x, FALSE)) crashes R after long (reproducible) script on windows only

2016-02-23 Thread Duncan Murdoch

On 23/02/2016 7:49 AM, Anthony Damico wrote:

hi, does anybody have a clue why .Internal(La_rs(x,FALSE)) is getting
corrupted (actual detonation occurs within La_solve_cmplx within Lapack.c)
on windows but not mac/unix?

i have provided two (long) scripts that reproduce the problem and a third
script modified to trigger the crash that unfortunately does not reproduce
the problem

http://stackoverflow.com/questions/35447971/internalla-rsx-false-crashes-r-after-long-reproducible-script-on-windows


Just two comments:

 - Your post suggests you're calling .Internal() yourself, but that's 
not the case.  So your question should be about why eigen() crashes R.


 - If you need a long script to trigger the error, I'd assume there's 
something wrong in that script. Your script uses several contributed 
packages, so the problem could be there. Shorten it to a minimal 
reproducible example that doesn't use any contributed packages.  If you 
can't leave out the packages, try to reduce it to just one, and ask the 
maintainer of that package about it.


Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Password-Shiny

2016-02-23 Thread Michael Sumner
On Wed, 24 Feb 2016 at 00:18 boB Rudis  wrote:

> What would cause you to think this mailing list is a free code-writing
> service? Perhaps post your question on Amazon's Mechanical Turk
> service?
>
> Alternatively: purchase a license for Shiny Server Pro.
>
> On Tue, Feb 23, 2016 at 12:45 AM, Venky  wrote:
> > Hi R users,
> >
> > Please anyone help me how to create password access in shiny
> >
>

It's not clear to me if you are asking about a "Pro" service specifically
(though if so I have learnt something), or just this:

http://shiny.rstudio.com/reference/shiny/latest/passwordInput.html

Either way r-help is not yet the place for extensions as way out as Shiny,
try here:

http://shiny.rstudio.com/help/

Cheers, Mike.


> >
> > Thanks and Regards
> > Venkatesan
> >
> > [[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.
>
-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

[[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] How to merge two tables

2016-02-23 Thread Michael Friendly

Hi Xiyan,

You don't show your original data, so
* If you produced `cross` and `age` tables by summing the counts from a 
single larger data set, go back to that and do it again. but now include 
age/


* Otherwise, you can use vcdeExtra::expand.dft()` on both of these data 
sets to expand to individual observations, and merge those.


In general, you'll get better replies by including a reproducible 
example, rather than summary output from the console.


-Michael


On 2/22/2016 1:46 PM, Xiyan Lon wrote:

Dear all,
I am currently studying categorical data analysis, if I have two tables:

R> cross
   sex cross death count
1  FEMALE   WEF   YES26
2MALE   WEF   YES14
3  FEMALE   OGG   YES32
4MALE   OGG   YES43
5  FEMALE   TGA   YES 8
6MALE   TGA   YES10
7  FEMALE   WEFNO 6
8MALE   WEFNO 7
9  FEMALE   OGGNO26
10   MALE   OGGNO12
11 FEMALE   TGANO16
12   MALE   TGANO26

R> age
  sex age death count
1 FEMALE 17Y   YES16
2   MALE 17Y   YES 4
3 FEMALE 18Y   YES40
4   MALE 18Y   YES51
5 FEMALE 17YNO32
6   MALE 17YNO42
7 FEMALE 18YNO26
8   MALE 18YNO15

- How to merge two tables.
- How to expand both tables such as:

sex age cross death
FEMALE 17Y WEF YES
...
FEMALE 18Y TGA NO


Warm regards,
Xiyan Lon

This email has been sent from a virus-free computer protected by Avast.
www.avast.com 
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

[[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] Warning Message With WordCloud

2016-02-23 Thread SHIVI BHATIA
Dear Team,

 

I am working on Wordcloud package for one of my projects. While it running
fine it is not showing the top most values in the output as it should. I
have ran it earlier and it was fine but now there seems to be an issue. 

 

The wordcloud image shows the values which are appearing only once or twice.
Below is the code I have used:

 

wordcloud(nnn,freq,random.order =F,colors=brewer.pal(8,"Dark2"),

  scale = c(5.5,0.5),min.freq = 50,

  max.words = Inf) 

 

There are words which are repetitive like 1000 times but none of those
appear. Not sure where I doing it wrong have checked multiple stats exchange
forum and help in r on wordcloud. 

 

This is really urgent. I have tried installing tm package. 

 

Thanks, Shivi

Mb: 9891002021

 

This e-mail is confidential. It may also be legally privileged. If you are not 
the addressee you may not copy, forward, disclose or use any part of it. If you 
have received this message in error, please delete it and all copies from your 
system and notify the sender immediately by return e-mail. Internet 
communications cannot be guaranteed to be timely, secure, error or virus-free. 
The sender does not accept liability for any errors or omissions.
__
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] Code for finding successive mean

2016-02-23 Thread Kwabena Fosu-Amankwah
Hi am Kwabena,

I would be very grateful if someone can help me with the code or script on
how to find successive mean at 30 minutes interval for the set of data
below:

Date/Time PR SW TP  SM SHF CO2
28.11.2011 17:39:49 978.4 13.15 30.5 20 NA NA
28.11.2011 17:50:00 978.5 13.11 30.4 20 NA NA
28.11.2011 18:00:00 978.8 13.14 30.3 20 NA NA
28.11.2011 18:10:00 979 13.07 30.1 20 NA NA
28.11.2011 18:20:00 979.2 13.1 30 20 NA NA
28.11.2011 18:30:00 979.4 13.09 29.8 20 NA NA
28.11.2011 18:40:00 979.5 13.08 29.6 20 NA NA
28.11.2011 18:50:00 979.5 13.06 29.5 20 NA NA
28.11.2011 19:00:00 979.6 13.06 29.4 20 NA NA
28.11.2011 19:10:00 979.7 13.05 29.3 20 NA NA
28.11.2011 19:20:00 979.9 13.03 29.2 20 NA NA
28.11.2011 19:30:00 980 13 29.1 20 NA NA
28.11.2011 19:40:00 980 13.03 29 20 NA NA
28.11.2011 19:50:00 980.1 13.03 28.9 20 NA NA
28.11.2011 20:00:00 980.3 13  28.8 20 NA NA
28.11.2011 20:10:00 980.5 12.97 28.7 20 NA NA
28.11.2011 20:20:00 980.8 12.96 28.6 20 NA NA
28.11.2011 20:30:00 981.1 12.95 28.5 20 NA NA
28.11.2011 20:40:00 981.1 12.95 28.4 20 NA NA
28.11.2011 20:50:00 981.2 12.94 28.3 20 NA NA
28.11.2011 21:00:00 981.3 12.93 28.2 20 NA NA
28.11.2011 21:10:00 981.3 12.92 28.1 20 NA NA
28.11.2011 21:20:00 981.5 12.9 28 20 NA NA
28.11.2011 21:30:00 981.6 12.927.9 20 NA NA
28.11.2011 21:40:00 981.7 12.88 27.9 20 NA NA
28.11.2011 21:50:00 981.7 12.87 27.8 20 NA NA
28.11.2011 22:00:00 981.7 12.86 27.7 20 NA NA
28.11.2011 22:10:00 981.8 12.85 27.6 20 NA NA
28.11.2011 22:20:00 981.8 12.84 27.5 20 NA NA
28.11.2011 22:30:00 981.8 12.83 27.5 20 NA NA

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] Password-Shiny

2016-02-23 Thread Paweł Broda
You could try methods from this blog post: 
http://ipub.com/shiny-password-protect/ 
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] New Package: lrequire v0.1.3 - use modules to encapsulate and cache your R scripts

2016-02-23 Thread Rick Wargo
Dear R Users,

I am happy to announce the initial release (v0.1.3) of 
lrequire, now available on 
CRAN.

https://cran.r-project.org/web/packages/lrequire/

lrequire supports modularization of R Scripts, enabling encapsulation of 
information and caching of scripts. This is very similar to the 
require() support in 
node.js.

Use of lrequire encourages separation of responsibility and using modules to 
encapsulate specific functionality. This leads to more easily-maintained 
scripts and encourages reuse.
lrequire also cache loaded modules (scripts) such that the next load (source) 
of the script does not execute its contents, unless specified. For example, if 
a module is built around sourcing a slowly-changing dataset that is 
time-consuming to retrieve, frequent reloads of the module will only return the 
cached copy of the data, saving the time expense. I found this very useful for 
developing dashboard components – lrequire permitted me the freedom to keep 
tweaking the UI without having to wait for the live reload of the data.

How It Works

Goal: build a reusable module to welcome an individual. Any environment 
artifacts necessary to build that module are encapsulated in the lrequire() 
call and only the functionality is returned.

For example:



File: welcome.R

data.that.will.not.be.exposed <- 'some work'

hello <- function(person.name) {
  return (paste0('Hello, ', person.name, '!'))
}

module.exports = hello



File: main.R

hello <- lrequire(welcome)

hello('Rick')



Note that the variable declared in welcome.R will not be visible in main.R only 
the hello() function. Multiple pieces of information can be exposed by 
returning a list() object in module.exports. Refer to the documentation for 
details.

All the best,
Rick Wargo
https://linkedin.com/in/rickwargo/
https://www.rickwargo.com/
@rickwargo


[[alternative HTML version deleted]]

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Query in R.

2016-02-23 Thread Rachana Bagde
Can anyone please solve this query.

http://stackoverflow.com/questions/35577484/cpquery-of-bnlearn-gives-0-for-every-event-and-evidence-in-r

Thanks.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Query in R.

2016-02-23 Thread Duncan Murdoch

On 23/02/2016 7:38 AM, Rachana Bagde wrote:

Can anyone please solve this query.

http://stackoverflow.com/questions/35577484/cpquery-of-bnlearn-gives-0-for-every-event-and-evidence-in-r



This is just spam.  If you want to ask a question here, please take the 
time to formulate it properly.


Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] mvProbit error message

2016-02-23 Thread PIKAL Petr
Hi

It shall work, I do not see any problem in the code. So you have to persuade us 
that you checked your data properly e.g. by posting result of

str(mydata)

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Betty
> Betty
> Sent: Tuesday, February 23, 2016 9:37 AM
> To: r-help@r-project.org
> Subject: [R] mvProbit error message
>
> Dear All,
> I am running the mvProbit model to estimate five equation probit
> models. In my data all the dependent variables are dichotomous with
> values 0/1 and lables TRUE/FALSE. The explanatory variables are
> composed of catagorical and countinous variables. I specified the model
> as follows
>
> Result<-mvProbit( cbind(y1,y2,y3,y4,y5) ~
> x1+x2+x3+..+.x11,data=mydata)
> summary(Result)
>
> However, i get an error message "...Error in
> mvProbit(cbind(y1,y2,y3,y4,y5) ~:all dependent variables must be either
> 0,1,TRUE, or FALSE)
>
> I have checked all the dependent variables and it is coded 0/1 and
> lables TRUE/FALSE.
> Ofcourse there are two missing observation and I attempted to handle
> that with na.action=na.omit but even that didnt solve the problem. My
> second attempt was to tell r that the dichotomous dependent variables
> and the catagorical independent variables as factor as follows
>
> mydata$y1<-factor(mydata$y1)
> ...
> ...
> ..
> .
> mydata$x3<-factor(mydata$x3)
> But still problem not solved. How would I solve this problem?
> 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.


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

Re: [R] .Internal(La_rs(x, FALSE)) crashes R after long (reproducible) script on windows only

2016-02-23 Thread Anthony Damico
hi, thank you,

at the point that the corruption exists, the line
`.Internal(La_rs(x,FALSE))` actually breaks without needing `eigen`

i have provided a reproducible example but agree it might not be minimal --
i did try removing various sections, each time the bug unfortunately
vanished.  note the february 22nd edit: even interspersing the script with
the line that triggers the crash prevents the crash in the first place!

i think this occurs in C and not R, and would appreciate pointers about how
one might do that?  the only advice i've have is rebuilding R with a debug
build and gdb, but this seems like a huge lift --  are there any shortcuts
here for someone mostly unfamiliar with C code and even setup?  general
advice on this thread might also help me crack this case  :)

stackoverflow.com/questions/35455135/general-suggestions-on-debugging-internal-in-r

thanks for your time

On Tue, Feb 23, 2016 at 8:22 AM, Duncan Murdoch 
wrote:

> On 23/02/2016 7:49 AM, Anthony Damico wrote:
>
>> hi, does anybody have a clue why .Internal(La_rs(x,FALSE)) is getting
>> corrupted (actual detonation occurs within La_solve_cmplx within Lapack.c)
>> on windows but not mac/unix?
>>
>> i have provided two (long) scripts that reproduce the problem and a third
>> script modified to trigger the crash that unfortunately does not reproduce
>> the problem
>>
>>
>> http://stackoverflow.com/questions/35447971/internalla-rsx-false-crashes-r-after-long-reproducible-script-on-windows
>>
>
> Just two comments:
>
>  - Your post suggests you're calling .Internal() yourself, but that's not
> the case.  So your question should be about why eigen() crashes R.
>
>  - If you need a long script to trigger the error, I'd assume there's
> something wrong in that script. Your script uses several contributed
> packages, so the problem could be there. Shorten it to a minimal
> reproducible example that doesn't use any contributed packages.  If you
> can't leave out the packages, try to reduce it to just one, and ask the
> maintainer of that package about it.
>
> Duncan Murdoch
>

[[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] Code for finding successive mean

2016-02-23 Thread PIKAL Petr
Hi

see ?cutPOSIXt help page.

something like

aggregate(yourdata, list(cut(datetime, "30 mins")), mean)

shall do the trick.

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kwabena
> Fosu-Amankwah
> Sent: Tuesday, February 23, 2016 7:24 AM
> To: r-help@r-project.org
> Subject: [R] Code for finding successive mean
>
> Hi am Kwabena,
>
> I would be very grateful if someone can help me with the code or script
> on how to find successive mean at 30 minutes interval for the set of
> data
> below:
>
> Date/Time PR SW TP  SM SHF CO2
> 28.11.2011 17:39:49 978.4 13.15 30.5 20 NA NA
> 28.11.2011 17:50:00 978.5 13.11 30.4 20 NA NA
> 28.11.2011 18:00:00 978.8 13.14 30.3 20 NA NA
> 28.11.2011 18:10:00 979 13.07 30.1 20 NA NA
> 28.11.2011 18:20:00 979.2 13.1 30 20 NA NA
> 28.11.2011 18:30:00 979.4 13.09 29.8 20 NA NA
> 28.11.2011 18:40:00 979.5 13.08 29.6 20 NA NA
> 28.11.2011 18:50:00 979.5 13.06 29.5 20 NA NA
> 28.11.2011 19:00:00 979.6 13.06 29.4 20 NA NA
> 28.11.2011 19:10:00 979.7 13.05 29.3 20 NA NA
> 28.11.2011 19:20:00 979.9 13.03 29.2 20 NA NA
> 28.11.2011 19:30:00 980 13 29.1 20 NA NA
> 28.11.2011 19:40:00 980 13.03 29 20 NA NA
> 28.11.2011 19:50:00 980.1 13.03 28.9 20 NA NA
> 28.11.2011 20:00:00 980.3 13  28.8 20 NA NA
> 28.11.2011 20:10:00 980.5 12.97 28.7 20 NA NA
> 28.11.2011 20:20:00 980.8 12.96 28.6 20 NA NA
> 28.11.2011 20:30:00 981.1 12.95 28.5 20 NA NA
> 28.11.2011 20:40:00 981.1 12.95 28.4 20 NA NA
> 28.11.2011 20:50:00 981.2 12.94 28.3 20 NA NA
> 28.11.2011 21:00:00 981.3 12.93 28.2 20 NA NA
> 28.11.2011 21:10:00 981.3 12.92 28.1 20 NA NA
> 28.11.2011 21:20:00 981.5 12.9 28 20 NA NA
> 28.11.2011 21:30:00 981.6 12.927.9 20 NA NA
> 28.11.2011 21:40:00 981.7 12.88 27.9 20 NA NA
> 28.11.2011 21:50:00 981.7 12.87 27.8 20 NA NA
> 28.11.2011 22:00:00 981.7 12.86 27.7 20 NA NA
> 28.11.2011 22:10:00 981.8 12.85 27.6 20 NA NA
> 28.11.2011 22:20:00 981.8 12.84 27.5 20 NA NA
> 28.11.2011 22:30:00 981.8 12.83 27.5 20 NA NA
>
> 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.


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

Re: [R] multiple linear regression with quadratic function

2016-02-23 Thread Bert Gunter
Inline.

-- Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Tue, Feb 23, 2016 at 2:42 AM,   wrote:
> Dear R community,
> this is probably a well-known topic to some of you, but I am not well into it
> and would like some clarifications or even jus some suggestions.
>
> I have a quadratic scalar field:
>
> F(x,y)=K*exp(-(a*x^2+b*y^2+c*x*y))
>
> I also have a random set of positive x,y values and related F(x,y) values.
> It seems reasonable to estimate the parameters K, a, b, c with a linear 
> regression,
> using the log of both sides of the equation.

Not necessarily. It depends on how the error term enters the model.

I suggest you consult with a local statistician or post as Peter
suggested. You appear to be out of your statistical depth here.


>
> What worries me, though, is the interaction term, c*x*y.
>
> Are there well-known issues on the application of linear regression to cases 
> like this one?
>
> Thanks in advance for your answers.
>
> James
>
> --
> This e-mail and any attachments may contain confidenti...{{dropped:8}}

__
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] lme() - MEEM error (singularity in Backsolve) due to user-specified contrasts amount

2016-02-23 Thread Bert Gunter
You are probably overfitting.

This *IS* a statistical and not an R issue, and so does not belong
here. You MAY get useful help by posting on the R-SIG-mixed-models
list, however. But PLEASE post in *plain text*, not HTML, as the
posting guide asks.

Cheers,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Tue, Feb 23, 2016 at 2:34 AM, Daniel Preciado  wrote:
> Hello all,
>
> I posted this question also in Stackoverflow, but in hindsight I realise it 
> probably fits better here. I am trying to use lme() to fit and compare 
> different models to data from an experiment in a repeated measures design. My 
> dependent variable is response time (RT, in milliseconds); and I have 2 
> factors: F_A (2 levels) and F_B (3 Levels). For F_B, I have specified the 
> following contrasts:
> F_B_C1 <- c(1, -1, 0)  # Contrast prize 1 and 2 levels
> F_B_C2 <- c(1, 0, -1)  # Contrast prize 1 with Neutral (no prize)
> F_B_C3 <- c(1, 0, -1)  # Contrast prize 2 with Neutral (no prize)
> F_B_C4 <- c(1, 1, -2)  # Contrast prize with Neutral
> contrasts(Data$F_B, how.many=4) <- cbind(F_B_C1, F_B_C2, F_B_C3, F_B_C4)
> Conditions 1 and 2 are 2 levels of the same manipulation, condition 3 is a 
> neutral control. I am interested in the effect of each level (individually) 
> on RT, and overall in the difference between the experimental manipulation 
> (pooling the first 2 conditions of factor B) and the control condition (final 
> condition of factor B).
>
> I defined the lme() models step-wise, starting with a Baseline model, and 
> then updating that one to include each factor individually, and finally the 
> interaction:
> RT_Base <- lme(RT ~ 1, random = ~1|SubjID/F_A/F_B, data=Data, method="ML")  
> #Baseline model
> RT_F_A <- update(RT_Base, .~. + F_A)#Baseline + F_A
> RT_F_B <- update(RT_F_A, .~. + F_B) #(Baseline+F_A) + F_B
> RT_Full <- update(RT_F_B, .~. + F_A:F_B)#Full model (+ interaction)
> However, when I execute the code involving F_B, I get an
> "Error in MEEM (...): Singularity in Backsolve at level 0, block 1).
> I can still inspect the results of the model, but I would like to understand 
> where is this error coming from, what does it mean, and how to avoid it. 
> Furthermore, I realized that if I reduce the amount of contrasts to the 
> default 2, the code runs without any error, so I can only assume that it has 
> something to do with the user-specified comparison pairs. Also, the specified 
> contrasts are not displayed (only the default first 2).
>
> I also read in some answer that the intercept needed to be suppressed in 
> order to prevent this error (by adding RT ~ 0+Factors to the model formulae). 
> I tried that, but it produces the same error.
>
> I would appreciate any feedback regarding this, Thanks!
>
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
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] Warning Message With WordCloud

2016-02-23 Thread Boris Steipe
Assuming you have confirmed that your function parameters are correct, the 
problem likely lies with your data. Therefore a good strategy is to revert to a 
known good state and systematically work from there. Start from your working 
example and gradually change that into your real data, evaluating each step in 
turn.


B.


On Feb 23, 2016, at 2:34 AM, SHIVI BHATIA  wrote:

> Dear Team,
> 
> 
> 
> I am working on Wordcloud package for one of my projects. While it running
> fine it is not showing the top most values in the output as it should. I
> have ran it earlier and it was fine but now there seems to be an issue. 
> 
> 
> 
> The wordcloud image shows the values which are appearing only once or twice.
> Below is the code I have used:
> 
> 
> 
> wordcloud(nnn,freq,random.order =F,colors=brewer.pal(8,"Dark2"),
> 
>  scale = c(5.5,0.5),min.freq = 50,
> 
>  max.words = Inf) 
> 
> 
> 
> There are words which are repetitive like 1000 times but none of those
> appear. Not sure where I doing it wrong have checked multiple stats exchange
> forum and help in r on wordcloud. 
> 
> 
> 
> This is really urgent. I have tried installing tm package. 
> 
> 
> 
> Thanks, Shivi
> 
> Mb: 9891002021
> 
> 
> 
> This e-mail is confidential. It may also be legally privileged. If you are 
> not the addressee you may not copy, forward, disclose or use any part of it. 
> If you have received this message in error, please delete it and all copies 
> from your system and notify the sender immediately by return e-mail. Internet 
> communications cannot be guaranteed to be timely, secure, error or 
> virus-free. The sender does not accept liability for any errors or omissions.
> __
> 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] mvProbit error message

2016-02-23 Thread Betty Betty
Dear All,
I am running the mvProbit model to estimate five equation probit models. In
my data all the dependent variables are dichotomous with values 0/1 and
lables TRUE/FALSE. The explanatory variables are composed of catagorical
and countinous variables. I specified the model as follows

Result<-mvProbit( cbind(y1,y2,y3,y4,y5) ~ x1+x2+x3+..+.x11,data=mydata)
summary(Result)

However, i get an error message "...Error in mvProbit(cbind(y1,y2,y3,y4,y5)
~:all dependent variables must be either 0,1,TRUE, or FALSE)

I have checked all the dependent variables and it is coded 0/1 and lables
TRUE/FALSE.
Ofcourse there are two missing observation and I attempted to handle that
with na.action=na.omit but even that didnt solve the problem. My second
attempt was to tell r that the dichotomous dependent variables and the
catagorical independent variables as factor as follows

mydata$y1<-factor(mydata$y1)
...
...
..
.
mydata$x3<-factor(mydata$x3)
But still problem not solved. How would I solve this problem?
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.


[R] R Software Program Help

2016-02-23 Thread Ashley Porter
Good Morning,

I wanted to reach out as I am looking to learn more about the R Project / R
Statistical Programming software, particularly as it's been utilizing in
power plant industries. I work in the energy industry and my clients are
starting to look for Risk Analysts proficient in this tool, and I find
myself unaware of what this tool is. Any information or help would be
greatly appreciated.

Warmly,


*Ashley Porter | Director of Recruiting*
D: 708-505-4087 *|* C: 708-705-0802* |* apor...@theplanetforward.com
888-845-2539 *|* F: 708-682-3073 *|* www.theplanetforward.com
800 Hillgrove Avenue, Suite 200, Western Springs, IL 60558
http://www.linkedin.com/in/ashleymarieporter

*Follow Us*:




*Planet Forward Jobs*: http://www.theplanetforward.com/jobs/

Chicago | Cleveland | San Francisco | Pensacola | London



Sent with MailTrack


[[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] axis break in R

2016-02-23 Thread Eike Marie Thaysen
Hello,
I want to break the y-axis on one of my plots. I read this is possible- but
apparently only with the plotrix package that requieres R version 3.6-1? I
cannot seem to find that version on the R homepage.. it is a version you
have to pay for? Are there any other possebilities to do it (I am currently
running (for R version 3.1.2) )
Thank you,
Eike

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Software Program Help

2016-02-23 Thread Nordlund, Dan (DSHS/RDA)
If you google "R Statistical Programming software" you will find all the 
information you could possibly want.  In particular, for your purposes you 
should probably start with 

https://www.r-project.org/

and read the "About" section.  Then follow other links as needed. 

Dan

Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ashley
> Porter
> Sent: Tuesday, February 23, 2016 8:02 AM
> To: r-help@r-project.org
> Subject: [R] R Software Program Help
> 
> Good Morning,
> 
> I wanted to reach out as I am looking to learn more about the R Project / R
> Statistical Programming software, particularly as it's been utilizing in power
> plant industries. I work in the energy industry and my clients are starting to
> look for Risk Analysts proficient in this tool, and I find myself unaware of
> what this tool is. Any information or help would be greatly appreciated.
> 
> Warmly,
> 
> 
> *Ashley Porter | Director of Recruiting*
> D: 708-505-4087 *|* C: 708-705-0802* |* apor...@theplanetforward.com
> 888-845-2539 *|* F: 708-682-3073 *|* www.theplanetforward.com
> 800 Hillgrove Avenue, Suite 200, Western Springs, IL 60558
> http://www.linkedin.com/in/ashleymarieporter
> 
> *Follow Us*:
>  forward?trk=company_name>
> 
> 
> 
> *Planet Forward Jobs*: http://www.theplanetforward.com/jobs/
> 
> Chicago | Cleveland | San Francisco | Pensacola | London
> 
> 
> 
> Sent with MailTrack
>  heplanetforward.com&idSignature=22>
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R packages for Mac Users

2016-02-23 Thread Scott Colwell

Hello,

Does anyone know if all the R packages that are available for Windows users are 
also available for Mac users? 

Thank you,

Scott

-- 
Scott R. Colwell, Ph.D.
Associate Professor, Dept. of Mkt/Cons Studies
Adjunct Professor, Dept. of Psychology
University of Guelph
Guelph, Ontario, Canada, N1G 2W1

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Software Program Help

2016-02-23 Thread John McKown
On Tue, Feb 23, 2016 at 10:02 AM, Ashley Porter <
apor...@theplanetforward.com> wrote:

> Good Morning,
>
> I wanted to reach out as I am looking to learn more about the R Project / R
> Statistical Programming software, particularly as it's been utilizing in
> power plant industries. I work in the energy industry and my clients are
> starting to look for Risk Analysts proficient in this tool, and I find
> myself unaware of what this tool is. Any information or help would be
> greatly appreciated.
>
> Warmly,
>
>
> *Ashley Porter | Director of Recruiting*
>

​In a nutshell, it is a algorithmic programming language​ with an emphasis
on statistics. If you have heard of the SAS language, R is used for similar
needs. One of the main pluses of R is CRAN - The Comprehensive R Archive
Network. This is a large set of statistical packages, which can be used as
a library. A good web site is https://cran.revolutionanalytics.com/ to
start. A search of "r language review" will get you some good hits from
sites such as InfoWorld and NY Times as well as the usual "geek" sites.


-- 
The man has the intellect of a lobotomized turtle.

Maranatha! <><
John McKown

[[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] axis break in R

2016-02-23 Thread Federman, Douglas

The current version of R is 3.2.3 and is available on the website.  You should 
update.  The current version of plotrix is 3.6-1

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Eike Marie 
Thaysen
Sent: Tuesday, February 23, 2016 11:00 AM
To: r-help@r-project.org
Subject: [R] axis break in R

Hello,
I want to break the y-axis on one of my plots. I read this is possible- but
apparently only with the plotrix package that requieres R version 3.6-1? I
cannot seem to find that version on the R homepage.. it is a version you
have to pay for? Are there any other possebilities to do it (I am currently
running (for R version 3.1.2) )
Thank you,
Eike

[[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] R packages for Mac Users

2016-02-23 Thread Marc Schwartz

> On Feb 23, 2016, at 11:10 AM, Scott Colwell  wrote:
> 
> 
> Hello,
> 
> Does anyone know if all the R packages that are available for Windows users 
> are also available for Mac users? 
> 
> Thank you,
> 
> Scott


Hi,

In general, yes, if the package is available from CRAN, but there are some 
exceptions, where you may have to install a package from source, rather than 
from a pre-compiled binary. In that case, if the package is "pure R", there 
should not be any issues. If there is C/C++ or FORTRAN source code in the 
package, you will need to have additional tools installed on your Mac (e.g. 
XCode, etc.) to install the package.

You can check the CRAN page for a particular package and see what is available.

Some packages are not on CRAN and may be available via other sources, like 
GitHub, etc. You would have to look at each, to get a sense for any issues 
there.

There are also two Mac specific resources that you should be aware of, if not 
already:

  R for Mac OS X FAQ:
  https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html

  R-SIG-Mac:
  https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Software Program Help

2016-02-23 Thread peter dalgaard

On 23 Feb 2016, at 17:02 , Ashley Porter  wrote:

> Good Morning,
> 
> I wanted to reach out as I am looking to learn more about the R Project / R
> Statistical Programming software, particularly as it's been utilizing in
> power plant industries. I work in the energy industry and my clients are
> starting to look for Risk Analysts proficient in this tool, and I find
> myself unaware of what this tool is. Any information or help would be
> greatly appreciated.
> 

Well, from your perspective, R is basically like SAS or Stata, just more 
flexible; maybe more challenging to master, but also quite a bit more fun. 

R is gaining quite some traction in the Data Science and Machine Learning 
areas, mainly due to visualization tools and data munging facilities, but also 
due to availability of a wide variety of modern statistical procedures. It has 
for quite some time been the weapon of choice when attacking methodology issues 
in Statistics at the research level.

- Peter D.


> Warmly,
> 
> 
> *Ashley Porter | Director of Recruiting*
> D: 708-505-4087 *|* C: 708-705-0802* |* apor...@theplanetforward.com
> 888-845-2539 *|* F: 708-682-3073 *|* www.theplanetforward.com
> 800 Hillgrove Avenue, Suite 200, Western Springs, IL 60558
> http://www.linkedin.com/in/ashleymarieporter
> 
> *Follow Us*:
> 
> 
> 
> 
> *Planet Forward Jobs*: http://www.theplanetforward.com/jobs/
> 
> Chicago | Cleveland | San Francisco | Pensacola | London
> 
> 
> 
> Sent with MailTrack
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R packages for Mac Users

2016-02-23 Thread peter dalgaard

On 23 Feb 2016, at 18:10 , Scott Colwell  wrote:

> 
> Hello,
> 
> Does anyone know if all the R packages that are available for Windows users 
> are also available for Mac users? 
> 

In a word: Yes.

In two words: Yes, mostly.

As long as a package doesn't rely on Windows-specific features, or on 
interfacing to programs that are only available for Windows, it will usually 
work on Mac or Linux or ... as well.

-pd


> Thank you,
> 
> Scott
> 
> -- 
> Scott R. Colwell, Ph.D.
> Associate Professor, Dept. of Mkt/Cons Studies
> Adjunct Professor, Dept. of Psychology
> University of Guelph
> Guelph, Ontario, Canada, N1G 2W1
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R packages for Mac Users

2016-02-23 Thread Jeff Newmiller
"All" is a pretty stringent test for a herd of cats.  If you constrain to 
packages on CRAN, there are currently about 300 binaries for Windows that don't 
show up in the Mac list, and about 40 that are in the Mac list but not the 
Windows list. There are about 8000 total.  Many times the non matched packages 
are OS specific and it would not make sense for them to be on both systems. 
-- 
Sent from my phone. Please excuse my brevity.

On February 23, 2016 9:10:07 AM PST, Scott Colwell  wrote:
>
>Hello,
>
>Does anyone know if all the R packages that are available for Windows
>users are also available for Mac users? 
>
>Thank you,
>
>Scott
>
>-- 
>Scott R. Colwell, Ph.D.
>Associate Professor, Dept. of Mkt/Cons Studies
>Adjunct Professor, Dept. of Psychology
>University of Guelph
>Guelph, Ontario, Canada, N1G 2W1
>
>__
>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] R packages for Mac Users

2016-02-23 Thread peter dalgaard

> On 23 Feb 2016, at 19:12 , Jeff Newmiller  wrote:
> 
> "All" is a pretty stringent test for a herd of cats.

Hehehe...

[Fades to a grin, leaving only a paw print.]

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Torvon
Hi,

I want to load a dataset into R. This dataset is available in two formats:
.XPT and .ASC. The dataset is available at
http://www.cdc.gov/brfss/annual_data/annual_2006.htm.

They are about 40mb zipped, and about 500mb unzipped.

I can get the .xpt data to load, using:

> library(hmisc)
> data <- sasxport.get("CDBRFS06.XPT")

The data look fine, no error messages. However, the data only contains 302
columns, which is less than it should have (according to the
documentation). It does not contain my variables of interest, so either the
documentation or the data file is wrong, and I want to make sure it's not
the data file.

Hence I wanted to see if I get the same results loading the .ASC file.
However, multiple ways to do so have failed.

> library(adehabitat)
> import.asc("CDBRFS06.asc")

Results in:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
: scan() expected 'a real', got '1191.8808943.38209868648.960119'

> library(SDMTools)
> read.asc("CDBRFS06.asc")

Results in:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
: scan() expected 'a real', got '1191.8808943.38209868648.960119' In
addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote,
skip, nlines, na.strings, : number of items read is not a multiple of the
number of columns 2: In scan(file, what, nmax, sep, dec, quote, skip,
nlines, na.strings, : number of items read is not a multiple of the number
of columns 3: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
na.strings, : number of items read is not a multiple of the number of
columns 4: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
na.strings, : number of items read is not a multiple of the number of
columns 5: In scan(file, nmax = nl * nc, skip = 6, quiet = TRUE) : NAs
introduced by coercion to integer range

Thank you for your help.
   Eiko

[[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] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Jan van der Laan
First, the file does contain 302 columns; the variable layout 
(http://www.cdc.gov/brfss/annual_data/2006/varlayout_table_06.htm) 
contains 302 columns. So, reading the SASS file probably works correctly.


Second, the read.asc function you use is for reading geographic raster 
files, not fixed width files.


Below, I show how you could read the file using the LaF package (sorry 
for the long dump of variable files; copy-pasted them from the page 
linked to above):


columns <- "StartingColumn  VariableNameFieldLength
1_STATE2
3_GEOSTR2
5_DENSTR21
6PRECALL1
7REPNUM5
12REPDEPTH2
14FMONTH2
16IDATE8
16IMONTH2
18IDAY2
20IYEAR4
24INTVID3
27DISPCODE3
30SEQNO10
30_PSU10
40NATTMPTS2
42NRECSEL6
48NRECSTR9
57CTELENUM1
58CELLFON11
59PVTRESID1
60NUMADULT2
62NUMMEN2
64NUMWOMEN2
73GENHLTH1
74PHYSHLTH2
76MENTHLTH2
78POORHLTH2
80HLTHPLAN1
81PERSDOC21
82MEDCOST1
83CHECKUP1
84EXERANY21
85DIABETE21
86LASTDEN31
87RMVTETH31
88DENCLEAN1
89CVDINFR31
90CVDCRHD31
91CVDSTRK31
92ASTHMA21
93ASTHNOW1
94QLACTLM21
95USEEQUIP1
96SMOKE1001
97SMOKDAY21
98STOPSMK21
99AGE2
101HISPANC21
102MRACE6
108ORACE21
109MARITAL1
110CHILDREN2
112EDUCA1
113EMPLOY1
114INCOME22
116WEIGHT24
120HEIGHT34
124CTYCODE3
132NUMHHOL21
133NUMPHON21
134TELSERV21
135SEX1
136PREGNANT1
137VETERAN1
138DRNKANY41
139ALCDAY43
142AVEDRNK22
144DRNK3GE52
146MAXDRNKS2
148FLUSHOT31
149FLUSPRY21
162PNEUVAC31
163HEPBVAC1
164HEPBRSN1
165FALL3MN22
167FALLINJ22
169SEATBELT1
170DRINKDRI2
172HADMAM1
173HOWLONG1
174PROFEXAM1
175LENGEXAM1
176HADPAP21
177LASTPAP21
178HADHYST21
179PSATEST1
180PSATIME1
181DIGRECEX1
182DRETIME1
183PROSTATE1
184BLDSTOOL1
185LSTBLDS21
186HADSIGM31
187LASTSIG21
188HIVTST51
189HIVTSTD26
195WHRTST72
197HIVRDTST1
198EMTSUPRT1
199LSATISFY1
200RCSBIRTH6
206RCSGENDR1
207RCHISLAT1
208RCSRACE6
214RCSBRACE1
215RCSRELN11
216DRHPCH1
217HAVHPCH1
218CIFLUSH21
219RCVFVCH26
225RNOFVCH22
227CASTHDX21
228CASTHNO21
229DIABAGE22
231INSULIN1
232DIABPILL1
233BLDSUGAR3
236FEETCHK23
239FEETSORE1
240DOCTDIAB2
242CHKHEMO32
244FEETCHK2
246EYEEXAM1
247DIABEYE1
248DIABEDU1
249VIDFCLT21
250VIREDIF21
251VIPRFVS21
252VINOCRE22
254VIEYEXM21
255VIINSUR21
256VICTRCT21
257VIGLUMA21
258VIMACDG21
259VIATWRK21
260PAINACT22
262QLMENTL22
264QLSTRES22
266QLREST22
268QLHLTH22
270ASTHMAGE2
272ASATTACK1
273ASERVIST2
275ASDRVIST2
277ASRCHKUP2
279ASACTLIM3
282ASYMPTOM1
283ASNOSLEP1
284ASTHMED21
285ASINHALR1
286BRTHCNT31
287TYPCNTR42
289NOBCUSE22
291FPCHLDFT1
292FPCHLDHS1
293VITAMINS1
294MULTIVIT1
295FOLICACD1
296TAKEVIT3
299RECOMMEN1
300HOUSESMK1
301INDOORS1
302SMKPUBLC1
303SMKWORK1
304IAQHTSRC1
305IAQGASAP1
306IAQHTDYS3
309IAQCODTR1
310IAQMOLD1
311HEWTRSRC1
312HEWTRDRK1
313HECHMHOM3
316HECHMYRD3
319RRCLASS21
320RRCOGNT21
321RRATWORK1
322RRHCARE21
323RRPHYSM11
324RREMTSM11
325ADPLEASR2
327ADDOWN2
329ADSLEEP2
331ADENERGY2
333ADEAT2
335ADFAIL2
337ADTHINK2
339ADMOVE2
341ADANXEV1
342ADDEPEV1
343SVSAFE1
344SVSEXTCH1
345SVNOTCH1
346SVEHDSE11
347SVHDSX121
348SVEANOS11
349SVNOSX121
350SVRELAT22
352SVGENDER1
353IPVSAFE1
354IPVTHRAT1
355IPVPHYV11
356IPVPHHRT1
357IPVUWSEX1
358IPVPVL121
359IPVSXINJ1
360IPVRELT12
362GPWELPRD1
363GPVACPLN1
364GP3DYWTR1
365GP3DYFOD1
366GP3DYPRS1
367GPBATRAD1
368GPFLSLIT1
369GPMNDEVC1
370GPNOTEVC2
372GPEMRCOM1
373GPEMRINF1
741QSTVER1
742QSTLANG2
800_STSTR

Re: [R] axis break in R

2016-02-23 Thread Jim Lemon
Hi Eike,
I think that plotrix v3.6-1 should run on R v 3.1.2.

Jim

On Wed, Feb 24, 2016 at 4:11 AM, Federman, Douglas <
douglas.feder...@utoledo.edu> wrote:

>
> The current version of R is 3.2.3 and is available on the website.  You
> should update.  The current version of plotrix is 3.6-1
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Eike
> Marie Thaysen
> Sent: Tuesday, February 23, 2016 11:00 AM
> To: r-help@r-project.org
> Subject: [R] axis break in R
>
> Hello,
> I want to break the y-axis on one of my plots. I read this is possible- but
> apparently only with the plotrix package that requieres R version 3.6-1? I
> cannot seem to find that version on the R homepage.. it is a version you
> have to pay for? Are there any other possebilities to do it (I am currently
> running (for R version 3.1.2) )
> Thank you,
> Eike
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Federman, Douglas
You might want to look at Anthony Damico's work at

http://www.asdfree.com/search/label/behavioral%20risk%20factor%20surveillance%20system%20%28brfss%29

--
Better name for the general practitioner might be multispecialist. 
~Martin H. Fischer (1879-1962)


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Torvon
Sent: Tuesday, February 23, 2016 2:13 PM
To: r-help@r-project.org
Subject: [R] Loading large .pxt and .asc datasets causes issues.

Hi,

I want to load a dataset into R. This dataset is available in two formats:
.XPT and .ASC. The dataset is available at 
http://www.cdc.gov/brfss/annual_data/annual_2006.htm.

They are about 40mb zipped, and about 500mb unzipped.

I can get the .xpt data to load, using:

> library(hmisc)
> data <- sasxport.get("CDBRFS06.XPT")

The data look fine, no error messages. However, the data only contains 302 
columns, which is less than it should have (according to the documentation). It 
does not contain my variables of interest, so either the documentation or the 
data file is wrong, and I want to make sure it's not the data file.

Hence I wanted to see if I get the same results loading the .ASC file.
However, multiple ways to do so have failed.

> library(adehabitat)
> import.asc("CDBRFS06.asc")

Results in:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
: scan() expected 'a real', got '1191.8808943.38209868648.960119'

> library(SDMTools)
> read.asc("CDBRFS06.asc")

Results in:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
: scan() expected 'a real', got '1191.8808943.38209868648.960119' In
addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote, skip, 
nlines, na.strings, : number of items read is not a multiple of the number of 
columns 2: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: number of items read is not a multiple of the number of columns 3: In 
scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : number of 
items read is not a multiple of the number of columns 4: In scan(file, what, 
nmax, sep, dec, quote, skip, nlines, na.strings, : number of items read is not 
a multiple of the number of columns 5: In scan(file, nmax = nl * nc, skip = 6, 
quiet = TRUE) : NAs introduced by coercion to integer range

Thank you for your help.
   Eiko

[[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] Reading a datetime vector

2016-02-23 Thread Jim Lemon
Doug,
We're getting warm. If we ask really nicely, will you tell us the URL of
the "dropbox folder you are working on"?

Jim


On Wed, Feb 24, 2016 at 9:29 AM, D Wolf  wrote:

> In addition to my previous message, DF_extract_clean.R is the program in
> the dropbox folder that I am currently working on.
>
> Doug
>
>
> On Tuesday, February 23, 2016 4:02 AM, Jim Lemon 
> wrote:
>
>
> Hi Doug,
> It is difficult for us to work out what is happening as we don't have
> access to a toy data set that we can play with. Excel spreadsheets are one
> of those things that you can't just attach to your email to the help list.
> If there is somewhere you can leave a _small_ Excel sample file (take the
> first 10 rows, say) that we can download (Google Drive, Dropbox?) and
> include the URL in your email, maybe someone can offer more than guesses.
>
> Jim
>
>
>
>

[[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] Reading a datetime vector

2016-02-23 Thread Jim Lemon
Hi again,
My apologies - I didn't see the other email.

JIm

On Wed, Feb 24, 2016 at 10:29 AM, Jim Lemon  wrote:

> Doug,
> We're getting warm. If we ask really nicely, will you tell us the URL of
> the "dropbox folder you are working on"?
>
> Jim
>
>
> On Wed, Feb 24, 2016 at 9:29 AM, D Wolf  wrote:
>
>> In addition to my previous message, DF_extract_clean.R is the program in
>> the dropbox folder that I am currently working on.
>>
>> Doug
>>
>>
>> On Tuesday, February 23, 2016 4:02 AM, Jim Lemon 
>> wrote:
>>
>>
>> Hi Doug,
>> It is difficult for us to work out what is happening as we don't have
>> access to a toy data set that we can play with. Excel spreadsheets are one
>> of those things that you can't just attach to your email to the help list.
>> If there is somewhere you can leave a _small_ Excel sample file (take the
>> first 10 rows, say) that we can download (Google Drive, Dropbox?) and
>> include the URL in your email, maybe someone can offer more than guesses.
>>
>> Jim
>>
>>
>>
>>
>

[[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] Order output list od TukeyHSD function by "p adj"

2016-02-23 Thread Sergio Fonda
 Hello, It's already for several hours that I try to order the list
obtained by the function TukeyHSD according to the variable "p adj"
(in ascending order). Unfortunately, without success.
In addition to following two lines of code, that offer the result but
separately so do not correspond to the desired result, I was unable to
go:
DF.5 <-lapply(DF.4, function (x) as.data.frame(x[c("patient:Fold.fac")]))
DF.6 <- DF.5[[1]][order(DF.5[[1]]$patient.Fold.fac.p.adj),]
Please, I ask some help to answer these two questions:
1) is it possible to get directly from the function TukeyHSD sorted
rows by "p adj"?
2) or, may the output list from TukeyHSD() be processed (e.g. by
lapply) to sort its elements according to "p adj"?
I attach at bottom a simulation of a list obtained from TukeyHSD which
should be ordered by "p adj".
Thanks in advance for any suggestion!
Sergio
#
> dput(DF.4)
list(structure(list(patient = structure(c(12289274.0619908, -2380308.48287107,
-14669582.5448618, -4176414.56676197, -18845997.1116238, -31135271.1736146,
28754962.6907435, 14085380.1458817, 1796106.0838909, 0.186808233632622,
0.938592742253258, 0.0922160074633905), .Dim = 3:4, .Dimnames = list(
c("PARTIAL-COMPLETE", "NO-COMPLETE", "NO-PARTIAL"), c("diff",
"lwr", "upr", "p adj"))), Fold.fac = structure(c(-12697325.7957036,
-23938561.4288898, -1456090.1625174, 0.0268617694934425), .Dim = c(1L,
4L), .Dimnames = list("middle-low", c("diff", "lwr", "upr", "p adj"
))), `patient:Fold.fac` = structure(c(15369710.0977205, 6521960.91205235,
-4695802.45257667, 4502968.78925385, -16007472.7140147, -8847749.18566819,
-20065512.5502972, -10866741.3084667, -31377182.8117352, -11217763.364629,
-2018992.12279849, -22529433.626067, 9198771.24183052, -11311670.261438,
-20510441.5032685, -12927630.9811041, -21775380.1667723, -33016252.8378897,
-23817481.5960591, -44327923.0993277, -37145090.2644928, -48385962.9356102,
-39187191.6937797, -59697633.1970482, -39538213.749942, -30339442.5081115,
-50849884.01138, -19144769.6082929, -39655211.1115614, -48853982.353392,
43667051.1765452, 34819301.990877, 23624647.9327363, 32823419.1745669,
12312977.6712983, 19449591.8931564, 8254937.83501579, 17453709.0768463,
-3056732.42642223, 17102687.020684, 26301458.2625145, 5791016.75924596,
37542312.0919539, 17031870.5886854, 7833099.34685487, 0.632098034657304,
0.986399530577416, 0.997064140940244, 0.997595806079891, 0.590366152539712,
0.948510666498818, 0.330512619876425, 0.883673837089478, 0.0198821692150445,
0.868982868764254, 0.52294188371, 0.207190890959777, 0.939934594322161,
0.86529009598038, 0.306625751897378), .Dim = c(15L, 4L), .Dimnames = list(
c("PARTIAL:low-COMPLETE:low", "NO:low-COMPLETE:low",
"COMPLETE:middle-COMPLETE:low",
"PARTIAL:middle-COMPLETE:low", "NO:middle-COMPLETE:low",
"NO:low-PARTIAL:low", "COMPLETE:middle-PARTIAL:low",
"PARTIAL:middle-PARTIAL:low",
"NO:middle-PARTIAL:low", "COMPLETE:middle-NO:low", "PARTIAL:middle-NO:low",
"NO:middle-NO:low", "PARTIAL:middle-COMPLETE:middle",
"NO:middle-COMPLETE:middle",
"NO:middle-PARTIAL:middle"), c("diff", "lwr", "upr", "p adj"
, .Names = c("patient", "Fold.fac", "patient:Fold.fac"
), class = c("TukeyHSD", "multicomp"), orig.call = aov(formula = abundance ~
patient * Fold.fac, data = x), conf.level = 0.95, ordered = FALSE),
structure(list(patient = structure(c(11084928.3849924, -3790273.898858,
-14875202.2838504, -2565656.8579769, -17440859.1418273, -28525787.5268197,
24735513.6279617, 9860311.34411127, -1224617.0408811, 0.137587687259541,
0.791659281224941, 0.028733410253219), .Dim = 3:4, .Dimnames = list(
c("PARTIAL-COMPLETE", "NO-COMPLETE", "NO-PARTIAL"), c("diff",
"lwr", "upr", "p adj"))), Fold.fac = structure(c(25003217.9525667,
15683872.2084017, 34322563.6967316, 1.59282125378191e-07), .Dim = c(1L,
4L), .Dimnames = list("low-high", c("diff", "lwr", "upr",
"p adj"))), `patient:Fold.fac` = structure(c(6786144.11764773,
-14136208.8235292, 15255972.7140153, 30625682.8117357, 21777933.6260674,
-20922352.9411769, 8469828.59636761, 23839538.6940879, 14991789.5084197,
29392181.5375445, 44761891.6352649, 35914142.4495966, 15369710.0977203,
6521960.91205206, -8847749.18566828, -16711562.4882314, -37633915.4294083,
-8222591.1541805, 7147118.94353984, -1700630.24212845, -44420059.547056,
-15008735.2718282, 360974.825892106, -8486774.35977618, 5913617.6693487,
21283327.767069, 12435578.5814008, -8089695.41243546, -16937444.5981037,
-32307154.6958241, 30283850.7235268, 9361497.78234989, 38734536.5822112,
54104246.6799315, 45256497.4942632, 2575353.66470216, 31948392.4645634,
47318102.5622838, 38470353.3766155, 52870745.4057404, 68240455.5034607,
59392706.3177924, 38829115.6078761, 29981366.4222079, 14611656.3244875,
0.963180623746077, 0.521122619371869, 0.431445001590424,
0.00280179326576413, 0.0869916657428951, 0.113173926329674,
0.908231706478258, 0.0441523667992262, 0

Re: [R] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Anthony Damico
hi eiko, LaF is incompatible with survey data, that road is a dead-end.
this code below will painlessly load brfss into R, review the link douglas
sent for analysis examples and change `years.to.download <- ` to 2006 only
if you just want a single year of microdata.  glhf


# install.packages( c("MonetDB.R", "MonetDBLite" , "survey" , "SAScii" ,
"descr" , "downloader" , "digest" ) , repos=c("
http://dev.monetdb.org/Assets/R/";, "http://cran.rstudio.com/";))

# setInternet2( FALSE )# # only windows users need
this line
# options( encoding = "windows-1252" )# # only macintosh and *nix
users need this line
library(downloader)
# setwd( "C:/My Directory/BRFSS/" )
years.to.download <- 1984:2014
source_url( "
https://raw.githubusercontent.com/ajdamico/asdfree/master/Behavioral%20Risk%20Factor%20Surveillance%20System/download%20all%20microdata.R";
, prompt = FALSE , echo = TRUE )





On Tue, Feb 23, 2016 at 4:39 PM, Federman, Douglas <
douglas.feder...@utoledo.edu> wrote:

> You might want to look at Anthony Damico's work at
>
>
> http://www.asdfree.com/search/label/behavioral%20risk%20factor%20surveillance%20system%20%28brfss%29
>
> --
> Better name for the general practitioner might be multispecialist.
> ~Martin H. Fischer (1879-1962)
>
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Torvon
> Sent: Tuesday, February 23, 2016 2:13 PM
> To: r-help@r-project.org
> Subject: [R] Loading large .pxt and .asc datasets causes issues.
>
> Hi,
>
> I want to load a dataset into R. This dataset is available in two formats:
> .XPT and .ASC. The dataset is available at
> http://www.cdc.gov/brfss/annual_data/annual_2006.htm.
>
> They are about 40mb zipped, and about 500mb unzipped.
>
> I can get the .xpt data to load, using:
>
> > library(hmisc)
> > data <- sasxport.get("CDBRFS06.XPT")
>
> The data look fine, no error messages. However, the data only contains 302
> columns, which is less than it should have (according to the
> documentation). It does not contain my variables of interest, so either the
> documentation or the data file is wrong, and I want to make sure it's not
> the data file.
>
> Hence I wanted to see if I get the same results loading the .ASC file.
> However, multiple ways to do so have failed.
>
> > library(adehabitat)
> > import.asc("CDBRFS06.asc")
>
> Results in:
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
> : scan() expected 'a real', got '1191.8808943.38209868648.960119'
>
> > library(SDMTools)
> > read.asc("CDBRFS06.asc")
>
> Results in:
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
> : scan() expected 'a real', got '1191.8808943.38209868648.960119' In
> addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote,
> skip, nlines, na.strings, : number of items read is not a multiple of the
> number of columns 2: In scan(file, what, nmax, sep, dec, quote, skip,
> nlines, na.strings, : number of items read is not a multiple of the number
> of columns 3: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
> na.strings, : number of items read is not a multiple of the number of
> columns 4: In scan(file, what, nmax, sep, dec, quote, skip, nlines,
> na.strings, : number of items read is not a multiple of the number of
> columns 5: In scan(file, nmax = nl * nc, skip = 6, quiet = TRUE) : NAs
> introduced by coercion to integer range
>
> Thank you for your help.
>Eiko
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reading a datetime vector

2016-02-23 Thread Jim Lemon
Hi Doug,
I see what the problem is now. When your Excel file is read in with
read.xlsx2, the DateTimeStamp is read as days since Microsoft's time epoch
(see earlier posts on this). As these values are numeric, they cannot be
converted in the same way as a human readable date/time string. The easiest
way I could think of to get around this is to export the XLSX file as CSV.
Then you will have the date/time strings and can convert them to POSIX
date/time values. Note that your format spec was slightly wrong - day is
first.

# first export the EXCEL file as a CSV file then
df2_TZ = read.csv("/media/KINGSTON/DF_exp2.csv",stringsAsFactors=FALSE)
df2_TZ$DateTimeStamp<-strptime(df2_TZ$DateTimeStamp,"%d/%m/%Y %H:%M")
# and I get
df2_TZ$DateTimeStamp
 [1] "2013-01-01 00:00:00 EST" "2013-01-01 01:00:00 EST"
 [3] "2013-01-02 23:15:00 EST" "2013-01-02 23:30:00 EST"
 [5] "2013-01-02 23:45:00 EST" "2013-01-03 00:00:00 EST"
 [7] "2013-01-03 01:00:00 EST" "2013-01-03 01:15:00 EST"
 [9] "2013-01-04 23:00:00 EST" "2014-11-24 15:04:00 EST"
[11] "2013-01-04 23:15:00 EST" "2013-01-04 23:30:00 EST"
[13] "2013-01-05 00:30:00 EST" "2013-01-05 00:45:00 EST"
[15] "2013-01-26 00:00:00 EST" "2013-07-19 15:42:00 EST"

Jim

[[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] Reading a datetime vector

2016-02-23 Thread Jeff Newmiller
You are overthinking this.  The answer is in the help file for read.xls2.
-- 
Sent from my phone. Please excuse my brevity.

On February 23, 2016 7:19:38 PM PST, Jim Lemon  wrote:
>Hi Doug,
>I see what the problem is now. When your Excel file is read in with
>read.xlsx2, the DateTimeStamp is read as days since Microsoft's time
>epoch
>(see earlier posts on this). As these values are numeric, they cannot
>be
>converted in the same way as a human readable date/time string. The
>easiest
>way I could think of to get around this is to export the XLSX file as
>CSV.
>Then you will have the date/time strings and can convert them to POSIX
>date/time values. Note that your format spec was slightly wrong - day
>is
>first.
>
># first export the EXCEL file as a CSV file then
>df2_TZ = read.csv("/media/KINGSTON/DF_exp2.csv",stringsAsFactors=FALSE)
>df2_TZ$DateTimeStamp<-strptime(df2_TZ$DateTimeStamp,"%d/%m/%Y %H:%M")
># and I get
>df2_TZ$DateTimeStamp
> [1] "2013-01-01 00:00:00 EST" "2013-01-01 01:00:00 EST"
> [3] "2013-01-02 23:15:00 EST" "2013-01-02 23:30:00 EST"
> [5] "2013-01-02 23:45:00 EST" "2013-01-03 00:00:00 EST"
> [7] "2013-01-03 01:00:00 EST" "2013-01-03 01:15:00 EST"
> [9] "2013-01-04 23:00:00 EST" "2014-11-24 15:04:00 EST"
>[11] "2013-01-04 23:15:00 EST" "2013-01-04 23:30:00 EST"
>[13] "2013-01-05 00:30:00 EST" "2013-01-05 00:45:00 EST"
>[15] "2013-01-26 00:00:00 EST" "2013-07-19 15:42:00 EST"
>
>Jim
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] RStudio Crashes when using quantmod's chartSeries()

2016-02-23 Thread Hsiao-nan Cheung
Dear All,

  When I use quantmod's chartSeries() function, the RStudio crashes. The
code
  is as below.

  library(quantmod)
  getSymbols("IBM")
  chartSeries(IBM)

  Very simple code... And the same function is working well in R Console
(Rgui.exe), i.e.
  there is a plot in the default graphics device. So maybe it's a graphics
  engine error with RStudio?

  I've tried the plot() function, e.g., plot(chartSeries(IBM)), and it
  crashes, too. Nothing improve.

R version is 3.2.3 (MRO 3.2.3), and RStudio version is 0.99.879, quantmod's
is 0.4-5.

  Yours,
  Hsiao-nan Cheung
  2016/2/24

[[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] RStudio Crashes when using quantmod's chartSeries()

2016-02-23 Thread Uwe Ligges
Thanks, but please report problems with RStudio to the RStudio support. 
Neither this list (to which RStudio emplyees may be listening, though) 
nor R-core can help in this case.


Best,
Uwe Ligges




On 24.02.2016 07:30, Hsiao-nan Cheung wrote:

Dear All,

   When I use quantmod's chartSeries() function, the RStudio crashes. The
code
   is as below.

   library(quantmod)
   getSymbols("IBM")
   chartSeries(IBM)

   Very simple code... And the same function is working well in R Console
(Rgui.exe), i.e.
   there is a plot in the default graphics device. So maybe it's a graphics
   engine error with RStudio?

   I've tried the plot() function, e.g., plot(chartSeries(IBM)), and it
   crashes, too. Nothing improve.

R version is 3.2.3 (MRO 3.2.3), and RStudio version is 0.99.879, quantmod's
is 0.4-5.

   Yours,
   Hsiao-nan Cheung
   2016/2/24

[[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] Order output list od TukeyHSD function by "p adj"

2016-02-23 Thread Jim Lemon
Hi Sergio,
I couldn't get your example data to read in, so I have used the example in
the help page:

fm1 <- aov(breaks ~ wool + tension, data = warpbreaks)
hsd.fit<-TukeyHSD(fm1, "tension", ordered = TRUE)
hsd.fit$tension[order(hsd.fit$tension[,4]),]
difflwr  upr   p adj
L-H 14.72  5.3688015 24.07564 0.001121788
L-M 10.00  0.6465793 19.35342 0.033626219
M-H  4.72 -4.6311985 14.07564 0.447421021

Obviously you would have to examine the output of TukeyHSD with str() to
sort out which column to use for ordering.

Jim


On Wed, Feb 24, 2016 at 11:21 AM, Sergio Fonda 
wrote:

>  Hello, It's already for several hours that I try to order the list
> obtained by the function TukeyHSD according to the variable "p adj"
> (in ascending order). Unfortunately, without success.
> In addition to following two lines of code, that offer the result but
> separately so do not correspond to the desired result, I was unable to
> go:
> DF.5 <-lapply(DF.4, function (x) as.data.frame(x[c("patient:Fold.fac")]))
> DF.6 <- DF.5[[1]][order(DF.5[[1]]$patient.Fold.fac.p.adj),]
> Please, I ask some help to answer these two questions:
> 1) is it possible to get directly from the function TukeyHSD sorted
> rows by "p adj"?
> 2) or, may the output list from TukeyHSD() be processed (e.g. by
> lapply) to sort its elements according to "p adj"?
> I attach at bottom a simulation of a list obtained from TukeyHSD which
> should be ordered by "p adj".
> Thanks in advance for any suggestion!
> Sergio
> #
> > dput(DF.4)
> list(structure(list(patient = structure(c(12289274.0619908,
> -2380308.48287107,
> -14669582.5448618, -4176414.56676197, -18845997.1116238, -31135271.1736146,
> 28754962.6907435, 14085380.1458817, 1796106.0838909, 0.186808233632622,
> 0.938592742253258, 0.0922160074633905), .Dim = 3:4, .Dimnames = list(
> c("PARTIAL-COMPLETE", "NO-COMPLETE", "NO-PARTIAL"), c("diff",
> "lwr", "upr", "p adj"))), Fold.fac = structure(c(-12697325.7957036,
> -23938561.4288898, -1456090.1625174, 0.0268617694934425), .Dim = c(1L,
> 4L), .Dimnames = list("middle-low", c("diff", "lwr", "upr", "p adj"
> ))), `patient:Fold.fac` = structure(c(15369710.0977205, 6521960.91205235,
> -4695802.45257667, 4502968.78925385, -16007472.7140147, -8847749.18566819,
> -20065512.5502972, -10866741.3084667, -31377182.8117352, -11217763.364629,
> -2018992.12279849, -22529433.626067, 9198771.24183052, -11311670.261438,
> -20510441.5032685, -12927630.9811041, -21775380.1667723, -33016252.8378897,
> -23817481.5960591, -44327923.0993277, -37145090.2644928, -48385962.9356102,
> -39187191.6937797, -59697633.1970482, -39538213.749942, -30339442.5081115,
> -50849884.01138, -19144769.6082929, -39655211.1115614, -48853982.353392,
> 43667051.1765452, 34819301.990877, 23624647.9327363, 32823419.1745669,
> 12312977.6712983, 19449591.8931564, 8254937.83501579, 17453709.0768463,
> -3056732.42642223, 17102687.020684, 26301458.2625145, 5791016.75924596,
> 37542312.0919539, 17031870.5886854, 7833099.34685487, 0.632098034657304,
> 0.986399530577416, 0.997064140940244, 0.997595806079891, 0.590366152539712,
> 0.948510666498818, 0.330512619876425, 0.883673837089478,
> 0.0198821692150445,
> 0.868982868764254, 0.52294188371, 0.207190890959777, 0.939934594322161,
> 0.86529009598038, 0.306625751897378), .Dim = c(15L, 4L), .Dimnames = list(
> c("PARTIAL:low-COMPLETE:low", "NO:low-COMPLETE:low",
> "COMPLETE:middle-COMPLETE:low",
> "PARTIAL:middle-COMPLETE:low", "NO:middle-COMPLETE:low",
> "NO:low-PARTIAL:low", "COMPLETE:middle-PARTIAL:low",
> "PARTIAL:middle-PARTIAL:low",
> "NO:middle-PARTIAL:low", "COMPLETE:middle-NO:low",
> "PARTIAL:middle-NO:low",
> "NO:middle-NO:low", "PARTIAL:middle-COMPLETE:middle",
> "NO:middle-COMPLETE:middle",
> "NO:middle-PARTIAL:middle"), c("diff", "lwr", "upr", "p adj"
> , .Names = c("patient", "Fold.fac", "patient:Fold.fac"
> ), class = c("TukeyHSD", "multicomp"), orig.call = aov(formula = abundance
> ~
> patient * Fold.fac, data = x), conf.level = 0.95, ordered = FALSE),
> structure(list(patient = structure(c(11084928.3849924, -3790273.898858,
> -14875202.2838504, -2565656.8579769, -17440859.1418273,
> -28525787.5268197,
> 24735513.6279617, 9860311.34411127, -1224617.0408811,
> 0.137587687259541,
> 0.791659281224941, 0.028733410253219), .Dim = 3:4, .Dimnames = list(
> c("PARTIAL-COMPLETE", "NO-COMPLETE", "NO-PARTIAL"), c("diff",
> "lwr", "upr", "p adj"))), Fold.fac = structure(c(25003217.9525667,
> 15683872.2084017, 34322563.6967316, 1.59282125378191e-07), .Dim = c(1L,
> 4L), .Dimnames = list("low-high", c("diff", "lwr", "upr",
> "p adj"))), `patient:Fold.fac` = structure(c(6786144.11764773,
> -14136208.8235292, 15255972.7140153, 30625682.8117357,
> 21777933.6260674,
> -20922352.9411769, 8469828.59636761, 23839538.6940879,
> 14991789.5084197,
> 29392181.5375445, 44761891.6352649, 35914142.4495966, 15369710.0977203,
> 6521960.91205

[R] issue -- Packages unavailable for R version 3.2.3

2016-02-23 Thread Sandeep Rana
Hi,

I have newly installed R version 3.2.3 and experiencing an issue where the
packages that I had been using in previous release aren't compatible in the
latest release.
I need you help to suggest how we could force the installation even if its
not supported or what is the workaround to move ahead with it.

Right now, I need to install the package 'sentiment'. Please help.

Regards,

Sandeep S. Rana

[[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.