Re: [R] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Sam Albers
Thanks Jeff. And for future readers head here:

https://github.com/eddelbuettel/digest/issues/49

and here:

https://github.com/eddelbuettel/digest/issues/13


Sam

On Fri, Feb 28, 2020 at 3:40 PM Jeff Newmiller  wrote:
>
> Read the closed issues in his digest Github repo first... this discussion has 
> already occurred there.
>
> On February 28, 2020 3:35:09 PM PST, Sam Albers  
> wrote:
> >Great question Will. If it were my code I would definitely do this.
> >However the problem is manifesting itself for my work with Dirk's
> >great digest package here:
> >
> >https://github.com/eddelbuettel/digest/blob/947b77e82b97024a874a808a4644be21fc329275/R/digest.R#L170-L173
> >
> >So because file.access is saying the permissions aren't right, I get
> >an error message from digest and can't create a hash. Knowing full
> >well that this is some weird Windows thing but also knowing I am stuck
> >in that environment, I wanted to figure where I was seeing a
> >difference between those two functions before I went asked Dirk if
> >he'd be interested in a change to that particular bit of code.
> >
> >
> >On Fri, Feb 28, 2020 at 3:28 PM William Dunlap 
> >wrote:
> >>
> >> If file.access() says the file is unreadable but file() says it can
> >be opened, why don't you
> >> just open the file and read it?  You can use tryCatch to deal with
> >problems opening or
> >> reading the file.
> >>
> >> Bill Dunlap
> >> TIBCO Software
> >> wdunlap tibco.com
> >>
> >>
> >> On Fri, Feb 28, 2020 at 2:54 PM Sam Albers
> > wrote:
> >>>
> >>> Thanks Jeff. I am probably not explaining myself very well but my
> >>> question under what circumstances would
> >>>
> >>> summary(file(remote_file, "rb"))$`can read`
> >>>
> >>> be different from:
> >>>
> >>> file.access(remote_file, 4)
> >>>
> >>> If my permissions were different across remote and local should that
> >>> not be reflected in both of these functions?
> >>>
> >>> On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller
> > wrote:
> >>> >
> >>> > Dunno. They agree for me. Maybe look closer at all permissions via
> >Windows File Manager?
> >>> >
> >>> > On February 28, 2020 2:06:34 PM PST, Sam Albers
> > wrote:
> >>> > >Some additional follow-up:
> >>> > >
> >>> > >> summary(file(remote_file, "rb"))$`can read`
> >>> > >[1] "yes"
> >>> > >
> >>> > >> summary(file(local_file, "rb"))$`can read`
> >>> > >[1] "yes"
> >>> > >
> >>> > >compared to:
> >>> > >
> >>> > >> file.access(local_file, 4)
> >>> > >local.R
> >>> > > 0
> >>> > >
> >>> > >> file.access(remote_file, 4)
> >>> > >remote.R
> >>> > >-1
> >>> > >
> >>> > >Can anyone think why file.access and file would be contradicting
> >each
> >>> > >other?
> >>> > >
> >>> > >Sam
> >>> > >
> >>> > >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers
> >>> > > wrote:
> >>> > >>
> >>> > >> Hi there,
> >>> > >>
> >>> > >> Looking for some help in diagnosing or developing a work around
> >to a
> >>> > >> problem I am having on a Windows machine. I am running R 3.6.2.
> >>> > >>
> >>> > >> I have two identical files, one stored locally and the other
> >stored
> >>> > >on
> >>> > >> a network drive.
> >>> > >>
> >>> > >> For access:
> >>> > >>
> >>> > >> > file.access(local_file, 4)
> >>> > >> local.R
> >>> > >>  0
> >>> > >>
> >>> > >> > file.access(remote_file, 4)
> >>> > >> remote.R
> >>> > >> -1
> >>> > >>
> >>> > >> Also for file.info
> >>> > >>
> >>> > >> > file.info(local_file)$mode:
> >>> > >> [1] "666"
> >>> > >>
> >>> > >> > file.info(remote_file)$mode:
> >>> > >> [1] "666"
> >>> > >>
> >>> > >> Ok so I am access issues. Maybe they are ephemeral and I can
> >change
> >>> > >> the permissions:
> >>> > >>
> >>> > >> > Sys.chmod('remote.R', mode = '666')
> >>> > >> > file.access(remote_file, 4)
> >>> > >> remote.R
> >>> > >> -1
> >>> > >>
> >>> > >> Nope. I am thoroughly stumped and maybe can't make it any
> >further
> >>> > >> because of Windows.
> >>> > >>
> >>> > >> Downstream I am trying to use digest::digest to create a hash
> >but
> >>> > >> digest thinks we don't have permission because file.access is
> >>> > >failing.
> >>> > >> Any thoughts on how I can get file.access to return 0 for the
> >>> > >remote.R
> >>> > >> file? Any ideas?
> >>> > >>
> >>> > >> Thanks in advance,
> >>> > >>
> >>> > >> Sam
> >>> > >
> >>> > >__
> >>> > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >>> > >https://stat.ethz.ch/mailman/listinfo/r-help
> >>> > >PLEASE do read the posting guide
> >>> > >http://www.R-project.org/posting-guide.html
> >>> > >and provide commented, minimal, self-contained, reproducible
> >code.
> >>> >
> >>> > --
> >>> > Sent from my phone. Please excuse my brevity.
> >>>
> >>> __
> >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> 

Re: [R] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Jeff Newmiller
Read the closed issues in his digest Github repo first... this discussion has 
already occurred there.

On February 28, 2020 3:35:09 PM PST, Sam Albers  
wrote:
>Great question Will. If it were my code I would definitely do this.
>However the problem is manifesting itself for my work with Dirk's
>great digest package here:
>
>https://github.com/eddelbuettel/digest/blob/947b77e82b97024a874a808a4644be21fc329275/R/digest.R#L170-L173
>
>So because file.access is saying the permissions aren't right, I get
>an error message from digest and can't create a hash. Knowing full
>well that this is some weird Windows thing but also knowing I am stuck
>in that environment, I wanted to figure where I was seeing a
>difference between those two functions before I went asked Dirk if
>he'd be interested in a change to that particular bit of code.
>
>
>On Fri, Feb 28, 2020 at 3:28 PM William Dunlap 
>wrote:
>>
>> If file.access() says the file is unreadable but file() says it can
>be opened, why don't you
>> just open the file and read it?  You can use tryCatch to deal with
>problems opening or
>> reading the file.
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>>
>> On Fri, Feb 28, 2020 at 2:54 PM Sam Albers
> wrote:
>>>
>>> Thanks Jeff. I am probably not explaining myself very well but my
>>> question under what circumstances would
>>>
>>> summary(file(remote_file, "rb"))$`can read`
>>>
>>> be different from:
>>>
>>> file.access(remote_file, 4)
>>>
>>> If my permissions were different across remote and local should that
>>> not be reflected in both of these functions?
>>>
>>> On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller
> wrote:
>>> >
>>> > Dunno. They agree for me. Maybe look closer at all permissions via
>Windows File Manager?
>>> >
>>> > On February 28, 2020 2:06:34 PM PST, Sam Albers
> wrote:
>>> > >Some additional follow-up:
>>> > >
>>> > >> summary(file(remote_file, "rb"))$`can read`
>>> > >[1] "yes"
>>> > >
>>> > >> summary(file(local_file, "rb"))$`can read`
>>> > >[1] "yes"
>>> > >
>>> > >compared to:
>>> > >
>>> > >> file.access(local_file, 4)
>>> > >local.R
>>> > > 0
>>> > >
>>> > >> file.access(remote_file, 4)
>>> > >remote.R
>>> > >-1
>>> > >
>>> > >Can anyone think why file.access and file would be contradicting
>each
>>> > >other?
>>> > >
>>> > >Sam
>>> > >
>>> > >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers
>>> > > wrote:
>>> > >>
>>> > >> Hi there,
>>> > >>
>>> > >> Looking for some help in diagnosing or developing a work around
>to a
>>> > >> problem I am having on a Windows machine. I am running R 3.6.2.
>>> > >>
>>> > >> I have two identical files, one stored locally and the other
>stored
>>> > >on
>>> > >> a network drive.
>>> > >>
>>> > >> For access:
>>> > >>
>>> > >> > file.access(local_file, 4)
>>> > >> local.R
>>> > >>  0
>>> > >>
>>> > >> > file.access(remote_file, 4)
>>> > >> remote.R
>>> > >> -1
>>> > >>
>>> > >> Also for file.info
>>> > >>
>>> > >> > file.info(local_file)$mode:
>>> > >> [1] "666"
>>> > >>
>>> > >> > file.info(remote_file)$mode:
>>> > >> [1] "666"
>>> > >>
>>> > >> Ok so I am access issues. Maybe they are ephemeral and I can
>change
>>> > >> the permissions:
>>> > >>
>>> > >> > Sys.chmod('remote.R', mode = '666')
>>> > >> > file.access(remote_file, 4)
>>> > >> remote.R
>>> > >> -1
>>> > >>
>>> > >> Nope. I am thoroughly stumped and maybe can't make it any
>further
>>> > >> because of Windows.
>>> > >>
>>> > >> Downstream I am trying to use digest::digest to create a hash
>but
>>> > >> digest thinks we don't have permission because file.access is
>>> > >failing.
>>> > >> Any thoughts on how I can get file.access to return 0 for the
>>> > >remote.R
>>> > >> file? Any ideas?
>>> > >>
>>> > >> Thanks in advance,
>>> > >>
>>> > >> Sam
>>> > >
>>> > >__
>>> > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> > >https://stat.ethz.ch/mailman/listinfo/r-help
>>> > >PLEASE do read the posting guide
>>> > >http://www.R-project.org/posting-guide.html
>>> > >and provide commented, minimal, self-contained, reproducible
>code.
>>> >
>>> > --
>>> > Sent from my phone. Please excuse my brevity.
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.

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


Re: [R] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Sam Albers
Great question Will. If it were my code I would definitely do this.
However the problem is manifesting itself for my work with Dirk's
great digest package here:

https://github.com/eddelbuettel/digest/blob/947b77e82b97024a874a808a4644be21fc329275/R/digest.R#L170-L173

So because file.access is saying the permissions aren't right, I get
an error message from digest and can't create a hash. Knowing full
well that this is some weird Windows thing but also knowing I am stuck
in that environment, I wanted to figure where I was seeing a
difference between those two functions before I went asked Dirk if
he'd be interested in a change to that particular bit of code.


On Fri, Feb 28, 2020 at 3:28 PM William Dunlap  wrote:
>
> If file.access() says the file is unreadable but file() says it can be 
> opened, why don't you
> just open the file and read it?  You can use tryCatch to deal with problems 
> opening or
> reading the file.
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Fri, Feb 28, 2020 at 2:54 PM Sam Albers  wrote:
>>
>> Thanks Jeff. I am probably not explaining myself very well but my
>> question under what circumstances would
>>
>> summary(file(remote_file, "rb"))$`can read`
>>
>> be different from:
>>
>> file.access(remote_file, 4)
>>
>> If my permissions were different across remote and local should that
>> not be reflected in both of these functions?
>>
>> On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller  
>> wrote:
>> >
>> > Dunno. They agree for me. Maybe look closer at all permissions via Windows 
>> > File Manager?
>> >
>> > On February 28, 2020 2:06:34 PM PST, Sam Albers 
>> >  wrote:
>> > >Some additional follow-up:
>> > >
>> > >> summary(file(remote_file, "rb"))$`can read`
>> > >[1] "yes"
>> > >
>> > >> summary(file(local_file, "rb"))$`can read`
>> > >[1] "yes"
>> > >
>> > >compared to:
>> > >
>> > >> file.access(local_file, 4)
>> > >local.R
>> > > 0
>> > >
>> > >> file.access(remote_file, 4)
>> > >remote.R
>> > >-1
>> > >
>> > >Can anyone think why file.access and file would be contradicting each
>> > >other?
>> > >
>> > >Sam
>> > >
>> > >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers
>> > > wrote:
>> > >>
>> > >> Hi there,
>> > >>
>> > >> Looking for some help in diagnosing or developing a work around to a
>> > >> problem I am having on a Windows machine. I am running R 3.6.2.
>> > >>
>> > >> I have two identical files, one stored locally and the other stored
>> > >on
>> > >> a network drive.
>> > >>
>> > >> For access:
>> > >>
>> > >> > file.access(local_file, 4)
>> > >> local.R
>> > >>  0
>> > >>
>> > >> > file.access(remote_file, 4)
>> > >> remote.R
>> > >> -1
>> > >>
>> > >> Also for file.info
>> > >>
>> > >> > file.info(local_file)$mode:
>> > >> [1] "666"
>> > >>
>> > >> > file.info(remote_file)$mode:
>> > >> [1] "666"
>> > >>
>> > >> Ok so I am access issues. Maybe they are ephemeral and I can change
>> > >> the permissions:
>> > >>
>> > >> > Sys.chmod('remote.R', mode = '666')
>> > >> > file.access(remote_file, 4)
>> > >> remote.R
>> > >> -1
>> > >>
>> > >> Nope. I am thoroughly stumped and maybe can't make it any further
>> > >> because of Windows.
>> > >>
>> > >> Downstream I am trying to use digest::digest to create a hash but
>> > >> digest thinks we don't have permission because file.access is
>> > >failing.
>> > >> Any thoughts on how I can get file.access to return 0 for the
>> > >remote.R
>> > >> file? Any ideas?
>> > >>
>> > >> Thanks in advance,
>> > >>
>> > >> Sam
>> > >
>> > >__
>> > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > >https://stat.ethz.ch/mailman/listinfo/r-help
>> > >PLEASE do read the posting guide
>> > >http://www.R-project.org/posting-guide.html
>> > >and provide commented, minimal, self-contained, reproducible code.
>> >
>> > --
>> > Sent from my phone. Please excuse my brevity.
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread William Dunlap via R-help
If file.access() says the file is unreadable but file() says it can be
opened, why don't you
just open the file and read it?  You can use tryCatch to deal with problems
opening or
reading the file.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Feb 28, 2020 at 2:54 PM Sam Albers 
wrote:

> Thanks Jeff. I am probably not explaining myself very well but my
> question under what circumstances would
>
> summary(file(remote_file, "rb"))$`can read`
>
> be different from:
>
> file.access(remote_file, 4)
>
> If my permissions were different across remote and local should that
> not be reflected in both of these functions?
>
> On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller 
> wrote:
> >
> > Dunno. They agree for me. Maybe look closer at all permissions via
> Windows File Manager?
> >
> > On February 28, 2020 2:06:34 PM PST, Sam Albers <
> tonightstheni...@gmail.com> wrote:
> > >Some additional follow-up:
> > >
> > >> summary(file(remote_file, "rb"))$`can read`
> > >[1] "yes"
> > >
> > >> summary(file(local_file, "rb"))$`can read`
> > >[1] "yes"
> > >
> > >compared to:
> > >
> > >> file.access(local_file, 4)
> > >local.R
> > > 0
> > >
> > >> file.access(remote_file, 4)
> > >remote.R
> > >-1
> > >
> > >Can anyone think why file.access and file would be contradicting each
> > >other?
> > >
> > >Sam
> > >
> > >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers
> > > wrote:
> > >>
> > >> Hi there,
> > >>
> > >> Looking for some help in diagnosing or developing a work around to a
> > >> problem I am having on a Windows machine. I am running R 3.6.2.
> > >>
> > >> I have two identical files, one stored locally and the other stored
> > >on
> > >> a network drive.
> > >>
> > >> For access:
> > >>
> > >> > file.access(local_file, 4)
> > >> local.R
> > >>  0
> > >>
> > >> > file.access(remote_file, 4)
> > >> remote.R
> > >> -1
> > >>
> > >> Also for file.info
> > >>
> > >> > file.info(local_file)$mode:
> > >> [1] "666"
> > >>
> > >> > file.info(remote_file)$mode:
> > >> [1] "666"
> > >>
> > >> Ok so I am access issues. Maybe they are ephemeral and I can change
> > >> the permissions:
> > >>
> > >> > Sys.chmod('remote.R', mode = '666')
> > >> > file.access(remote_file, 4)
> > >> remote.R
> > >> -1
> > >>
> > >> Nope. I am thoroughly stumped and maybe can't make it any further
> > >> because of Windows.
> > >>
> > >> Downstream I am trying to use digest::digest to create a hash but
> > >> digest thinks we don't have permission because file.access is
> > >failing.
> > >> Any thoughts on how I can get file.access to return 0 for the
> > >remote.R
> > >> file? Any ideas?
> > >>
> > >> Thanks in advance,
> > >>
> > >> Sam
> > >
> > >__
> > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > >https://stat.ethz.ch/mailman/listinfo/r-help
> > >PLEASE do read the posting guide
> > >http://www.R-project.org/posting-guide.html
> > >and provide commented, minimal, self-contained, reproducible code.
> >
> > --
> > Sent from my phone. Please excuse my brevity.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Jeff Newmiller
I don't know.

Windows uses Access Control Lists, while POSIX (e.g. Linux) uses 
user/group/other classification. These two world views do not have a simple 1:1 
correspondence, so you might see some difference between your file security 
configuration in the file properties.

Then again there are some hints online that the problem is not new... there is 
a package called R.utils that may help.


On February 28, 2020 2:53:49 PM PST, Sam Albers  
wrote:
>Thanks Jeff. I am probably not explaining myself very well but my
>question under what circumstances would
>
>summary(file(remote_file, "rb"))$`can read`
>
>be different from:
>
>file.access(remote_file, 4)
>
>If my permissions were different across remote and local should that
>not be reflected in both of these functions?
>
>On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller
> wrote:
>>
>> Dunno. They agree for me. Maybe look closer at all permissions via
>Windows File Manager?
>>
>> On February 28, 2020 2:06:34 PM PST, Sam Albers
> wrote:
>> >Some additional follow-up:
>> >
>> >> summary(file(remote_file, "rb"))$`can read`
>> >[1] "yes"
>> >
>> >> summary(file(local_file, "rb"))$`can read`
>> >[1] "yes"
>> >
>> >compared to:
>> >
>> >> file.access(local_file, 4)
>> >local.R
>> > 0
>> >
>> >> file.access(remote_file, 4)
>> >remote.R
>> >-1
>> >
>> >Can anyone think why file.access and file would be contradicting
>each
>> >other?
>> >
>> >Sam
>> >
>> >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers
>> > wrote:
>> >>
>> >> Hi there,
>> >>
>> >> Looking for some help in diagnosing or developing a work around to
>a
>> >> problem I am having on a Windows machine. I am running R 3.6.2.
>> >>
>> >> I have two identical files, one stored locally and the other
>stored
>> >on
>> >> a network drive.
>> >>
>> >> For access:
>> >>
>> >> > file.access(local_file, 4)
>> >> local.R
>> >>  0
>> >>
>> >> > file.access(remote_file, 4)
>> >> remote.R
>> >> -1
>> >>
>> >> Also for file.info
>> >>
>> >> > file.info(local_file)$mode:
>> >> [1] "666"
>> >>
>> >> > file.info(remote_file)$mode:
>> >> [1] "666"
>> >>
>> >> Ok so I am access issues. Maybe they are ephemeral and I can
>change
>> >> the permissions:
>> >>
>> >> > Sys.chmod('remote.R', mode = '666')
>> >> > file.access(remote_file, 4)
>> >> remote.R
>> >> -1
>> >>
>> >> Nope. I am thoroughly stumped and maybe can't make it any further
>> >> because of Windows.
>> >>
>> >> Downstream I am trying to use digest::digest to create a hash but
>> >> digest thinks we don't have permission because file.access is
>> >failing.
>> >> Any thoughts on how I can get file.access to return 0 for the
>> >remote.R
>> >> file? Any ideas?
>> >>
>> >> Thanks in advance,
>> >>
>> >> Sam
>> >
>> >__
>> >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> >https://stat.ethz.ch/mailman/listinfo/r-help
>> >PLEASE do read the posting guide
>> >http://www.R-project.org/posting-guide.html
>> >and provide commented, minimal, self-contained, reproducible code.
>>
>> --
>> Sent from my phone. Please excuse my brevity.

-- 
Sent from my phone. Please excuse my brevity.

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


Re: [R] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Jim Lemon
Hi Sam,
Just a guess, but your "*.R" files should be text, not binary. Windows
doesn't distinguish between the two locally if I remember correctly,
but may have to when accessing things outside the Windowsphere.

Jim

On Sat, Feb 29, 2020 at 9:07 AM Sam Albers  wrote:
>
> Some additional follow-up:
>
> > summary(file(remote_file, "rb"))$`can read`
> [1] "yes"
>
> > summary(file(local_file, "rb"))$`can read`
> [1] "yes"
>
> compared to:
>
> > file.access(local_file, 4)
> local.R
>  0
>
> > file.access(remote_file, 4)
> remote.R
> -1
>
> Can anyone think why file.access and file would be contradicting each other?
>
> Sam
>
> On Fri, Feb 28, 2020 at 10:47 AM Sam Albers  
> wrote:
> >
> > Hi there,
> >
> > Looking for some help in diagnosing or developing a work around to a
> > problem I am having on a Windows machine. I am running R 3.6.2.
> >
> > I have two identical files, one stored locally and the other stored on
> > a network drive.
> >
> > For access:
> >
> > > file.access(local_file, 4)
> > local.R
> >  0
> >
> > > file.access(remote_file, 4)
> > remote.R
> > -1
> >
> > Also for file.info
> >
> > > file.info(local_file)$mode:
> > [1] "666"
> >
> > > file.info(remote_file)$mode:
> > [1] "666"
> >
> > Ok so I am access issues. Maybe they are ephemeral and I can change
> > the permissions:
> >
> > > Sys.chmod('remote.R', mode = '666')
> > > file.access(remote_file, 4)
> > remote.R
> > -1
> >
> > Nope. I am thoroughly stumped and maybe can't make it any further
> > because of Windows.
> >
> > Downstream I am trying to use digest::digest to create a hash but
> > digest thinks we don't have permission because file.access is failing.
> > Any thoughts on how I can get file.access to return 0 for the remote.R
> > file? Any ideas?
> >
> > Thanks in advance,
> >
> > Sam
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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] qq plot issue with ab line

2020-02-28 Thread Jim Lemon
Hi Ana,
I should clarify what I wrote in the previous email. You are expecting
an approximately square plot with a line running at about an angle of
45 degrees from lower left to upper right. However, the range of x and
y values that you are plotting are not approximately equal. This means
that lines with a slope of 1 will not run from corner to corner or
even parallel such a line. I hope that explains it better.

Jim

On Sat, Feb 29, 2020 at 9:54 AM Jim Lemon  wrote:
>
> Hi Ana,
> I'll do my best. In the attached image, I have placed two green disks
> at (0,0) and (1,1). These points are on a line with intercept 0 and
> slope 1 as are all the other points on that line. When you ask for an
> abline with two unnamed arguments, the first is the intercept and the
> second is the slope. The abline function them draws a line with these
> values across the plot. So it has done what you asked. If you specify
> xlim=c(0,1) in the initial plot, you will get what you expect, but you
> will leave all x values greater than 1.04 off the plot.
>
> Jim
>
> On Sat, Feb 29, 2020 at 8:41 AM Ana Marija  
> wrote:
> >
> > Hi Jim,
> >
> > I have in my code:
> > abline(0,1,col='red')
> >
> > can you please tell me how to change my code to have it indeed running
> > from 0 to 1?
> >
> > Thanks
> > Ana
> >
> > On Fri, Feb 28, 2020 at 3:34 PM Jim Lemon  wrote:
> > >
> > > Hi Ana,
> > > Look carefully at that red line. It goes through (0,0) and scoots off
> > > the plot at (2.5,2.5). As you have specified that intercept and slope
> > > in your code, poor abline is doing the best it can. Do not punish it
> > > for doing what you request.
> > >
> > > Jim
> > >
> > > On Sat, Feb 29, 2020 at 6:10 AM Ana Marija  
> > > wrote:
> > > >
> > > > Hello,
> > > >
> > > > I made the plot in attach with this function:
> > > >
> > > > qqunif = function(p, BH=T, MAIN = " ", SUB=" ")
> > > > {
> > > >   nn = length(p)
> > > >   xx =  -log10((1:nn)/(nn+1))
> > > >   plot( xx,  -sort(log10(p)),
> > > > main = MAIN, sub= SUB, cex.sub=1.3,
> > > > xlab=expression(Expected~~-log[10](italic(p))),
> > > > ylab=expression(Observed~~-log[10](italic(p))),
> > > > cex.lab=1.0,mgp=c(2,1,0))
> > > >   abline(0,1,col='red')
> > > >   if(BH) ## BH = include Benjamini Hochberg FDR
> > > >   {
> > > >
> > > > abline(-log10(0.05),1, col='black',lty=1)
> > > > text(0.5,1.9 , "FDR=0.05", col = "gray60",srt=20, cex=1)
> > > > abline(-log10(0.10),1, col='black',lty=1)
> > > > text(0.5, 1.6, "FDR=0.10", col = "gray60",srt=20, cex=1)
> > > > abline(-log10(0.25),1, col='black',lty=1)
> > > > text(0.5, 1.2, "FDR=0.25", col = "gray60",srt=20, cex=1)
> > > > #legend('topleft', c("FDR = 0.05","FDR = 0.10","FDR = 0.25"),
> > > >#col=c('black','black','black'),lty=c(1,1,1), cex=0.8)
> > > > if (BF)
> > > > {
> > > >   abline(h=-log10(0.05/nn), col='black') ## bonferroni
> > > > }
> > > >   }
> > > > }
> > > >
> > > >
> > > > biob272=read.table("/Users/ams/Desktop/biobank272LD.txt")
> > > > qqunif(biob272$V2)
> > > >
> > > >
> > > > > head(biob272)
> > > >  V1   V2
> > > > 1 rs2089177 0.581204
> > > > 2 rs4360974 0.418456
> > > > 3 rs6502526 0.416670
> > > > 4 rs8069906 0.568030
> > > > 5 rs9895995 0.266746
> > > > 6 rs9905280 0.510032
> > > >
> > > > But the red, abline doesn't look like it is 1:1 line.
> > > >
> > > > Can you please advise?
> > > >
> > > > Thanks
> > > > Ana
> > > > __
> > > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > > https://stat.ethz.ch/mailman/listinfo/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] qq plot issue with ab line

2020-02-28 Thread Jim Lemon
Hi Ana,
I'll do my best. In the attached image, I have placed two green disks
at (0,0) and (1,1). These points are on a line with intercept 0 and
slope 1 as are all the other points on that line. When you ask for an
abline with two unnamed arguments, the first is the intercept and the
second is the slope. The abline function them draws a line with these
values across the plot. So it has done what you asked. If you specify
xlim=c(0,1) in the initial plot, you will get what you expect, but you
will leave all x values greater than 1.04 off the plot.

Jim

On Sat, Feb 29, 2020 at 8:41 AM Ana Marija  wrote:
>
> Hi Jim,
>
> I have in my code:
> abline(0,1,col='red')
>
> can you please tell me how to change my code to have it indeed running
> from 0 to 1?
>
> Thanks
> Ana
>
> On Fri, Feb 28, 2020 at 3:34 PM Jim Lemon  wrote:
> >
> > Hi Ana,
> > Look carefully at that red line. It goes through (0,0) and scoots off
> > the plot at (2.5,2.5). As you have specified that intercept and slope
> > in your code, poor abline is doing the best it can. Do not punish it
> > for doing what you request.
> >
> > Jim
> >
> > On Sat, Feb 29, 2020 at 6:10 AM Ana Marija  
> > wrote:
> > >
> > > Hello,
> > >
> > > I made the plot in attach with this function:
> > >
> > > qqunif = function(p, BH=T, MAIN = " ", SUB=" ")
> > > {
> > >   nn = length(p)
> > >   xx =  -log10((1:nn)/(nn+1))
> > >   plot( xx,  -sort(log10(p)),
> > > main = MAIN, sub= SUB, cex.sub=1.3,
> > > xlab=expression(Expected~~-log[10](italic(p))),
> > > ylab=expression(Observed~~-log[10](italic(p))),
> > > cex.lab=1.0,mgp=c(2,1,0))
> > >   abline(0,1,col='red')
> > >   if(BH) ## BH = include Benjamini Hochberg FDR
> > >   {
> > >
> > > abline(-log10(0.05),1, col='black',lty=1)
> > > text(0.5,1.9 , "FDR=0.05", col = "gray60",srt=20, cex=1)
> > > abline(-log10(0.10),1, col='black',lty=1)
> > > text(0.5, 1.6, "FDR=0.10", col = "gray60",srt=20, cex=1)
> > > abline(-log10(0.25),1, col='black',lty=1)
> > > text(0.5, 1.2, "FDR=0.25", col = "gray60",srt=20, cex=1)
> > > #legend('topleft', c("FDR = 0.05","FDR = 0.10","FDR = 0.25"),
> > >#col=c('black','black','black'),lty=c(1,1,1), cex=0.8)
> > > if (BF)
> > > {
> > >   abline(h=-log10(0.05/nn), col='black') ## bonferroni
> > > }
> > >   }
> > > }
> > >
> > >
> > > biob272=read.table("/Users/ams/Desktop/biobank272LD.txt")
> > > qqunif(biob272$V2)
> > >
> > >
> > > > head(biob272)
> > >  V1   V2
> > > 1 rs2089177 0.581204
> > > 2 rs4360974 0.418456
> > > 3 rs6502526 0.416670
> > > 4 rs8069906 0.568030
> > > 5 rs9895995 0.266746
> > > 6 rs9905280 0.510032
> > >
> > > But the red, abline doesn't look like it is 1:1 line.
> > >
> > > Can you please advise?
> > >
> > > Thanks
> > > Ana
> > > __
> > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/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] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Sam Albers
Thanks Jeff. I am probably not explaining myself very well but my
question under what circumstances would

summary(file(remote_file, "rb"))$`can read`

be different from:

file.access(remote_file, 4)

If my permissions were different across remote and local should that
not be reflected in both of these functions?

On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller  wrote:
>
> Dunno. They agree for me. Maybe look closer at all permissions via Windows 
> File Manager?
>
> On February 28, 2020 2:06:34 PM PST, Sam Albers  
> wrote:
> >Some additional follow-up:
> >
> >> summary(file(remote_file, "rb"))$`can read`
> >[1] "yes"
> >
> >> summary(file(local_file, "rb"))$`can read`
> >[1] "yes"
> >
> >compared to:
> >
> >> file.access(local_file, 4)
> >local.R
> > 0
> >
> >> file.access(remote_file, 4)
> >remote.R
> >-1
> >
> >Can anyone think why file.access and file would be contradicting each
> >other?
> >
> >Sam
> >
> >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers
> > wrote:
> >>
> >> Hi there,
> >>
> >> Looking for some help in diagnosing or developing a work around to a
> >> problem I am having on a Windows machine. I am running R 3.6.2.
> >>
> >> I have two identical files, one stored locally and the other stored
> >on
> >> a network drive.
> >>
> >> For access:
> >>
> >> > file.access(local_file, 4)
> >> local.R
> >>  0
> >>
> >> > file.access(remote_file, 4)
> >> remote.R
> >> -1
> >>
> >> Also for file.info
> >>
> >> > file.info(local_file)$mode:
> >> [1] "666"
> >>
> >> > file.info(remote_file)$mode:
> >> [1] "666"
> >>
> >> Ok so I am access issues. Maybe they are ephemeral and I can change
> >> the permissions:
> >>
> >> > Sys.chmod('remote.R', mode = '666')
> >> > file.access(remote_file, 4)
> >> remote.R
> >> -1
> >>
> >> Nope. I am thoroughly stumped and maybe can't make it any further
> >> because of Windows.
> >>
> >> Downstream I am trying to use digest::digest to create a hash but
> >> digest thinks we don't have permission because file.access is
> >failing.
> >> Any thoughts on how I can get file.access to return 0 for the
> >remote.R
> >> file? Any ideas?
> >>
> >> Thanks in advance,
> >>
> >> Sam
> >
> >__
> >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> --
> Sent from my phone. Please excuse my brevity.

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


Re: [R] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Jeff Newmiller
Dunno. They agree for me. Maybe look closer at all permissions via Windows File 
Manager?

On February 28, 2020 2:06:34 PM PST, Sam Albers  
wrote:
>Some additional follow-up:
>
>> summary(file(remote_file, "rb"))$`can read`
>[1] "yes"
>
>> summary(file(local_file, "rb"))$`can read`
>[1] "yes"
>
>compared to:
>
>> file.access(local_file, 4)
>local.R
> 0
>
>> file.access(remote_file, 4)
>remote.R
>-1
>
>Can anyone think why file.access and file would be contradicting each
>other?
>
>Sam
>
>On Fri, Feb 28, 2020 at 10:47 AM Sam Albers
> wrote:
>>
>> Hi there,
>>
>> Looking for some help in diagnosing or developing a work around to a
>> problem I am having on a Windows machine. I am running R 3.6.2.
>>
>> I have two identical files, one stored locally and the other stored
>on
>> a network drive.
>>
>> For access:
>>
>> > file.access(local_file, 4)
>> local.R
>>  0
>>
>> > file.access(remote_file, 4)
>> remote.R
>> -1
>>
>> Also for file.info
>>
>> > file.info(local_file)$mode:
>> [1] "666"
>>
>> > file.info(remote_file)$mode:
>> [1] "666"
>>
>> Ok so I am access issues. Maybe they are ephemeral and I can change
>> the permissions:
>>
>> > Sys.chmod('remote.R', mode = '666')
>> > file.access(remote_file, 4)
>> remote.R
>> -1
>>
>> Nope. I am thoroughly stumped and maybe can't make it any further
>> because of Windows.
>>
>> Downstream I am trying to use digest::digest to create a hash but
>> digest thinks we don't have permission because file.access is
>failing.
>> Any thoughts on how I can get file.access to return 0 for the
>remote.R
>> file? Any ideas?
>>
>> Thanks in advance,
>>
>> Sam
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.

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


Re: [R] [FORGED] Re: Help to solve modeling problem with gamm

2020-02-28 Thread Rolf Turner



On 29/02/20 8:11 am, Abby Spurdle wrote:


There was clearly a non-linear growth pattern such that an additive
mixed effects model was proposed to model the behavior of biomass
as a function of time and treatments.


The presence of non-linearity (in x) does not necessarily mean that 
you can't use a "linear model". In general, linear models work well

for biological growth curves with small to medium sized data.

Technically, this is off topic, however, the notion of what is
linear and what is not linear, is a recurring theme on this mailing
list.


When plotting the residuals a clear cone-shaped pattern was
observed


Based on classical statistics, the obvious approach is to transform
your data. This is easy to do, however, some expertise is required
to back-transform parameters/estimates and interpret them.


Although it is indeed off topic I would like to emphasise a point that a 
lot of people don't seem to get.  A linear model is


*linear in the parameters*

not in the predictors.  For example

y = beta_0 + beta_1 * x + beta_2 * x^2 + E

is a linear model.  It is linear in (beta_0,beta_1,beta_2).  It is not 
of course "linear in x".


cheers,

Rolf Turner

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Sam Albers
Some additional follow-up:

> summary(file(remote_file, "rb"))$`can read`
[1] "yes"

> summary(file(local_file, "rb"))$`can read`
[1] "yes"

compared to:

> file.access(local_file, 4)
local.R
 0

> file.access(remote_file, 4)
remote.R
-1

Can anyone think why file.access and file would be contradicting each other?

Sam

On Fri, Feb 28, 2020 at 10:47 AM Sam Albers  wrote:
>
> Hi there,
>
> Looking for some help in diagnosing or developing a work around to a
> problem I am having on a Windows machine. I am running R 3.6.2.
>
> I have two identical files, one stored locally and the other stored on
> a network drive.
>
> For access:
>
> > file.access(local_file, 4)
> local.R
>  0
>
> > file.access(remote_file, 4)
> remote.R
> -1
>
> Also for file.info
>
> > file.info(local_file)$mode:
> [1] "666"
>
> > file.info(remote_file)$mode:
> [1] "666"
>
> Ok so I am access issues. Maybe they are ephemeral and I can change
> the permissions:
>
> > Sys.chmod('remote.R', mode = '666')
> > file.access(remote_file, 4)
> remote.R
> -1
>
> Nope. I am thoroughly stumped and maybe can't make it any further
> because of Windows.
>
> Downstream I am trying to use digest::digest to create a hash but
> digest thinks we don't have permission because file.access is failing.
> Any thoughts on how I can get file.access to return 0 for the remote.R
> file? Any ideas?
>
> Thanks in advance,
>
> Sam

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] qq plot issue with ab line

2020-02-28 Thread Ana Marija
Hi Jim,

I have in my code:
abline(0,1,col='red')

can you please tell me how to change my code to have it indeed running
from 0 to 1?

Thanks
Ana

On Fri, Feb 28, 2020 at 3:34 PM Jim Lemon  wrote:
>
> Hi Ana,
> Look carefully at that red line. It goes through (0,0) and scoots off
> the plot at (2.5,2.5). As you have specified that intercept and slope
> in your code, poor abline is doing the best it can. Do not punish it
> for doing what you request.
>
> Jim
>
> On Sat, Feb 29, 2020 at 6:10 AM Ana Marija  
> wrote:
> >
> > Hello,
> >
> > I made the plot in attach with this function:
> >
> > qqunif = function(p, BH=T, MAIN = " ", SUB=" ")
> > {
> >   nn = length(p)
> >   xx =  -log10((1:nn)/(nn+1))
> >   plot( xx,  -sort(log10(p)),
> > main = MAIN, sub= SUB, cex.sub=1.3,
> > xlab=expression(Expected~~-log[10](italic(p))),
> > ylab=expression(Observed~~-log[10](italic(p))),
> > cex.lab=1.0,mgp=c(2,1,0))
> >   abline(0,1,col='red')
> >   if(BH) ## BH = include Benjamini Hochberg FDR
> >   {
> >
> > abline(-log10(0.05),1, col='black',lty=1)
> > text(0.5,1.9 , "FDR=0.05", col = "gray60",srt=20, cex=1)
> > abline(-log10(0.10),1, col='black',lty=1)
> > text(0.5, 1.6, "FDR=0.10", col = "gray60",srt=20, cex=1)
> > abline(-log10(0.25),1, col='black',lty=1)
> > text(0.5, 1.2, "FDR=0.25", col = "gray60",srt=20, cex=1)
> > #legend('topleft', c("FDR = 0.05","FDR = 0.10","FDR = 0.25"),
> >#col=c('black','black','black'),lty=c(1,1,1), cex=0.8)
> > if (BF)
> > {
> >   abline(h=-log10(0.05/nn), col='black') ## bonferroni
> > }
> >   }
> > }
> >
> >
> > biob272=read.table("/Users/ams/Desktop/biobank272LD.txt")
> > qqunif(biob272$V2)
> >
> >
> > > head(biob272)
> >  V1   V2
> > 1 rs2089177 0.581204
> > 2 rs4360974 0.418456
> > 3 rs6502526 0.416670
> > 4 rs8069906 0.568030
> > 5 rs9895995 0.266746
> > 6 rs9905280 0.510032
> >
> > But the red, abline doesn't look like it is 1:1 line.
> >
> > Can you please advise?
> >
> > Thanks
> > Ana
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/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] qq plot issue with ab line

2020-02-28 Thread Jim Lemon
Hi Ana,
Look carefully at that red line. It goes through (0,0) and scoots off
the plot at (2.5,2.5). As you have specified that intercept and slope
in your code, poor abline is doing the best it can. Do not punish it
for doing what you request.

Jim

On Sat, Feb 29, 2020 at 6:10 AM Ana Marija  wrote:
>
> Hello,
>
> I made the plot in attach with this function:
>
> qqunif = function(p, BH=T, MAIN = " ", SUB=" ")
> {
>   nn = length(p)
>   xx =  -log10((1:nn)/(nn+1))
>   plot( xx,  -sort(log10(p)),
> main = MAIN, sub= SUB, cex.sub=1.3,
> xlab=expression(Expected~~-log[10](italic(p))),
> ylab=expression(Observed~~-log[10](italic(p))),
> cex.lab=1.0,mgp=c(2,1,0))
>   abline(0,1,col='red')
>   if(BH) ## BH = include Benjamini Hochberg FDR
>   {
>
> abline(-log10(0.05),1, col='black',lty=1)
> text(0.5,1.9 , "FDR=0.05", col = "gray60",srt=20, cex=1)
> abline(-log10(0.10),1, col='black',lty=1)
> text(0.5, 1.6, "FDR=0.10", col = "gray60",srt=20, cex=1)
> abline(-log10(0.25),1, col='black',lty=1)
> text(0.5, 1.2, "FDR=0.25", col = "gray60",srt=20, cex=1)
> #legend('topleft', c("FDR = 0.05","FDR = 0.10","FDR = 0.25"),
>#col=c('black','black','black'),lty=c(1,1,1), cex=0.8)
> if (BF)
> {
>   abline(h=-log10(0.05/nn), col='black') ## bonferroni
> }
>   }
> }
>
>
> biob272=read.table("/Users/ams/Desktop/biobank272LD.txt")
> qqunif(biob272$V2)
>
>
> > head(biob272)
>  V1   V2
> 1 rs2089177 0.581204
> 2 rs4360974 0.418456
> 3 rs6502526 0.416670
> 4 rs8069906 0.568030
> 5 rs9895995 0.266746
> 6 rs9905280 0.510032
>
> But the red, abline doesn't look like it is 1:1 line.
>
> Can you please advise?
>
> Thanks
> Ana
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Help with ggplot plot

2020-02-28 Thread Bill Poling
Hello Rui, this is it, thank you very much, sorry if my request was confusing.

WHP


From: Rui Barradas 
Sent: Friday, February 28, 2020 2:15 PM
To: Bill Poling ; r-help (r-help@r-project.org) 

Subject: Re: [R] Help with ggplot plot

[External Email]
Hello,

Now I'm not understanding, you want the values in the bars? The numbers?


ggplot(tmp, aes(x = Region, y = ProductLineID, fill = ProductLineFlag)) +
geom_col() +
geom_text(aes(label = ProductLineID),
position = position_stack(vjust = 0.5), size = 3) +
facet_grid(~InOutFlagAlpha)



Hope this helps,

Rui Barradas

Às 17:38 de 28/02/20, Bill Poling escreveu:
> Hi Rui, thank you this is helpful, however, I would like the values in the or 
> above the bars.
>
> I have tried 'dodge' but not working correctly.
>
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Getting 
> worse again
> geom_bar(stat ="identity") +
> geom_col(position = 'dodge') +
> facet_grid("InOutFlagAlpha")
>
> Thoughts?
>
> WHP
>
> From: Rui Barradas 
> Sent: Friday, February 28, 2020 11:06 AM
> To: Bill Poling ; r-help 
> (mailto:r-help@r-project.org) 
> Subject: Re: [R] Help with ggplot plot
>
> [External Email]
> Hello,
>
> If you want faceting, a square grid can do it.
>
>
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
> geom_bar(stat = "identity") +
> facet_grid(InOutFlagAlpha ~ ProductLineFlag)
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 16:50 de 28/02/20, Bill Poling escreveu:
>> #RStudio Version 1.2.5019
>> sessionInfo()
>> # R version 3.6.2 (2019-12-12)
>> #Platform: x86_64-w64-mingw32/x64 (64-bit)
>> #Running under: Windows 10 x64 (build 17134)
>>
>> Hello, I am sure I am missing something simple.
>>
>> Here is my data, its aggregated and if need be I can unaggregate I guess:
>>
>> dput(tmp)
>> structure(list(InOutFlagAlpha = c("NO ", "YES", "NO ", "YES",
>> "NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ",
>> "YES", "NO ", "YES", "NO ", "YES", "NO ", "YES"), ProductLineFlag = 
>> structure(c(1L,
>> 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L,
>> 1L, 2L, 2L), .Label = c("ACH", "CARD"), class = "factor"), Region = 
>> structure(c(1L,
>> 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L,
>> 5L, 5L, 5L), .Label = c("Frontier", "Midwest", "Northeast", "Pacific",
>> "South"), class = "factor"), ProductLineID = c(7163L, 34212L,
>> 35891L, 54177L, 8873L, 34008L, 52017L, 67881L, 7408L, 29430L,
>> 64108L, 70532L, 5984L, 21720L, 49030L, 60211L, 7330L, 34876L,
>> 46387L, 75893L)), row.names = c(NA, -20L), class = "data.frame")
>>
>> |InOutFlagAlpha |ProductLineFlag | Region| ProductLineID|
>> |:--|:---|-:|-:|
>> |NO |ACH | Frontier| 7163|
>> |YES |ACH | Frontier| 34212|
>> |NO |CARD | Frontier| 35891|
>> |YES |CARD | Frontier| 54177|
>> |NO |ACH | Midwest| 8873|
>> |YES |ACH | Midwest| 34008|
>> |NO |CARD | Midwest| 52017|
>> |YES |CARD | Midwest| 67881|
>> |NO |ACH | Northeast| 7408|
>> |YES |ACH | Northeast| 29430|
>> |NO |CARD | Northeast| 64108|
>> |YES |CARD | Northeast| 70532|
>> |NO |ACH | Pacific| 5984|
>> |YES |ACH | Pacific| 21720|
>> |NO |CARD | Pacific| 49030|
>> |YES |CARD | Pacific| 60211|
>> |NO |ACH | South| 7330|
>> |YES |ACH | South| 34876|
>> |NO |CARD | South| 46387|
>> |YES |CARD | South| 75893|
>>
>> I am trying to get the value from ProductLineID into the bars
>>
>> I have slowly stepped through to the point of having everything but the 
>> values.
>>
>> Appreciate any advice, thank you.
>>
>> WHP
>>
>> #1
>> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
>> geom_bar(stat = "identity")
>> #2
>> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
>> geom_bar(stat = "identity") +
>> facet_grid("InOutFlagAlpha")
>> #3
>> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
>> geom_bar(stat ="identity") +
>> facet_grid("InOutFlagAlpha")
>> #4
>> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
>> geom_bar(stat ="identity",position = 'dodge') +
>> facet_grid("InOutFlagAlpha")
>> #5
>> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) +
>> geom_bar(stat ="identity",position = 'dodge') +
>> facet_grid("InOutFlagAlpha")
>> #6
>> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Best so 
>> far
>> geom_bar(stat ="identity") +
>> geom_col() +
>> facet_grid("InOutFlagAlpha")
>> #7
>> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Not 
>> working
>> geom_bar(stat ="identity") +
>> geom_col(position = 'dodge') +
>> facet_grid("InOutFlagAlpha")
>>
>> WHP
>>
>>
>> Confidentiality Notice\ \ This email and the attachments...{{dropped:11}}
>>
>> __
>> mailto:R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 

Re: [R] Help with ggplot plot

2020-02-28 Thread Rui Barradas

Hello,

Now I'm not understanding, you want the values in the bars? The numbers?


ggplot(tmp, aes(x = Region, y = ProductLineID, fill = ProductLineFlag)) +
  geom_col() +
  geom_text(aes(label = ProductLineID),
position = position_stack(vjust = 0.5), size = 3) +
  facet_grid(~InOutFlagAlpha)



Hope this helps,

Rui Barradas

Às 17:38 de 28/02/20, Bill Poling escreveu:

Hi Rui, thank you this is helpful, however, I would like the values in the or 
above the bars.

I have tried 'dodge' but not working correctly.

ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Getting 
worse again
 geom_bar(stat ="identity")  +
 geom_col(position = 'dodge')  +
 facet_grid("InOutFlagAlpha")

Thoughts?

WHP

From: Rui Barradas 
Sent: Friday, February 28, 2020 11:06 AM
To: Bill Poling ; r-help (r-help@r-project.org) 

Subject: Re: [R] Help with ggplot plot

[External Email]
Hello,

If you want faceting, a square grid can do it.


ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat = "identity") +
facet_grid(InOutFlagAlpha ~ ProductLineFlag)


Hope this helps,

Rui Barradas

Às 16:50 de 28/02/20, Bill Poling escreveu:

#RStudio Version 1.2.5019
sessionInfo()
# R version 3.6.2 (2019-12-12)
#Platform: x86_64-w64-mingw32/x64 (64-bit)
#Running under: Windows 10 x64 (build 17134)

Hello, I am sure I am missing something simple.

Here is my data, its aggregated and if need be I can unaggregate I guess:

dput(tmp)
structure(list(InOutFlagAlpha = c("NO ", "YES", "NO ", "YES",
"NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ",
"YES", "NO ", "YES", "NO ", "YES", "NO ", "YES"), ProductLineFlag = 
structure(c(1L,
1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L,
1L, 2L, 2L), .Label = c("ACH", "CARD"), class = "factor"), Region = 
structure(c(1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L,
5L, 5L, 5L), .Label = c("Frontier", "Midwest", "Northeast", "Pacific",
"South"), class = "factor"), ProductLineID = c(7163L, 34212L,
35891L, 54177L, 8873L, 34008L, 52017L, 67881L, 7408L, 29430L,
64108L, 70532L, 5984L, 21720L, 49030L, 60211L, 7330L, 34876L,
46387L, 75893L)), row.names = c(NA, -20L), class = "data.frame")

|InOutFlagAlpha |ProductLineFlag | Region| ProductLineID|
|:--|:---|-:|-:|
|NO |ACH | Frontier| 7163|
|YES |ACH | Frontier| 34212|
|NO |CARD | Frontier| 35891|
|YES |CARD | Frontier| 54177|
|NO |ACH | Midwest| 8873|
|YES |ACH | Midwest| 34008|
|NO |CARD | Midwest| 52017|
|YES |CARD | Midwest| 67881|
|NO |ACH | Northeast| 7408|
|YES |ACH | Northeast| 29430|
|NO |CARD | Northeast| 64108|
|YES |CARD | Northeast| 70532|
|NO |ACH | Pacific| 5984|
|YES |ACH | Pacific| 21720|
|NO |CARD | Pacific| 49030|
|YES |CARD | Pacific| 60211|
|NO |ACH | South| 7330|
|YES |ACH | South| 34876|
|NO |CARD | South| 46387|
|YES |CARD | South| 75893|

I am trying to get the value from ProductLineID into the bars

I have slowly stepped through to the point of having everything but the values.

Appreciate any advice, thank you.

WHP

#1
ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat = "identity")
#2
ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat = "identity") +
facet_grid("InOutFlagAlpha")
#3
ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat ="identity") +
facet_grid("InOutFlagAlpha")
#4
ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat ="identity",position = 'dodge') +
facet_grid("InOutFlagAlpha")
#5
ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) +
geom_bar(stat ="identity",position = 'dodge') +
facet_grid("InOutFlagAlpha")
#6
ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Best so far
geom_bar(stat ="identity") +
geom_col() +
facet_grid("InOutFlagAlpha")
#7
ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Not working
geom_bar(stat ="identity") +
geom_col(position = 'dodge') +
facet_grid("InOutFlagAlpha")

WHP


Confidentiality Notice\ \ This email and the attachments...{{dropped:11}}

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



Confidentiality Notice

This email and the attachments may contain information which is privileged 
and/or confidential and is intended for the business and/or confidential use of 
the recipient only. Such information may be protected by applicable State 
and/or Federal laws from disclosure or unauthorized use. If you are not the 
intended recipient, you are hereby notified that any disclosure is strictly 
prohibited. If you have received this email in error, please contact the sender 
immediately.



__

Re: [R] Help to solve modeling problem with gamm

2020-02-28 Thread Abby Spurdle
> There was clearly a non-linear growth pattern such that an additive mixed 
> effects model was proposed to model the behavior of biomass as a function of 
> time and treatments.

The presence of non-linearity (in x) does not necessarily mean that
you can't use a "linear model".
In general, linear models work well for biological growth curves with
small to medium sized data.

Technically, this is off topic, however, the notion of what is linear
and what is not linear, is a recurring theme on this mailing list.

> When plotting the residuals a clear cone-shaped pattern was observed

Based on classical statistics, the obvious approach is to transform your data.
This is easy to do, however, some expertise is required to
back-transform parameters/estimates and interpret them.

While you're welcome to seek advice on mailing lists, I'd recommend
you consult a biostatistician.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] qq plot issue with ab line

2020-02-28 Thread Ana Marija
Hello,

I made the plot in attach with this function:

qqunif = function(p, BH=T, MAIN = " ", SUB=" ")
{
  nn = length(p)
  xx =  -log10((1:nn)/(nn+1))
  plot( xx,  -sort(log10(p)),
main = MAIN, sub= SUB, cex.sub=1.3,
xlab=expression(Expected~~-log[10](italic(p))),
ylab=expression(Observed~~-log[10](italic(p))),
cex.lab=1.0,mgp=c(2,1,0))
  abline(0,1,col='red')
  if(BH) ## BH = include Benjamini Hochberg FDR
  {

abline(-log10(0.05),1, col='black',lty=1)
text(0.5,1.9 , "FDR=0.05", col = "gray60",srt=20, cex=1)
abline(-log10(0.10),1, col='black',lty=1)
text(0.5, 1.6, "FDR=0.10", col = "gray60",srt=20, cex=1)
abline(-log10(0.25),1, col='black',lty=1)
text(0.5, 1.2, "FDR=0.25", col = "gray60",srt=20, cex=1)
#legend('topleft', c("FDR = 0.05","FDR = 0.10","FDR = 0.25"),
   #col=c('black','black','black'),lty=c(1,1,1), cex=0.8)
if (BF)
{
  abline(h=-log10(0.05/nn), col='black') ## bonferroni
}
  }
}


biob272=read.table("/Users/ams/Desktop/biobank272LD.txt")
qqunif(biob272$V2)


> head(biob272)
 V1   V2
1 rs2089177 0.581204
2 rs4360974 0.418456
3 rs6502526 0.416670
4 rs8069906 0.568030
5 rs9895995 0.266746
6 rs9905280 0.510032

But the red, abline doesn't look like it is 1:1 line.

Can you please advise?

Thanks
Ana
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] file.access returning -1 for a file on remote Windows drive.

2020-02-28 Thread Sam Albers
Hi there,

Looking for some help in diagnosing or developing a work around to a
problem I am having on a Windows machine. I am running R 3.6.2.

I have two identical files, one stored locally and the other stored on
a network drive.

For access:

> file.access(local_file, 4)
local.R
 0

> file.access(remote_file, 4)
remote.R
-1

Also for file.info

> file.info(local_file)$mode:
[1] "666"

> file.info(remote_file)$mode:
[1] "666"

Ok so I am access issues. Maybe they are ephemeral and I can change
the permissions:

> Sys.chmod('remote.R', mode = '666')
> file.access(remote_file, 4)
remote.R
-1

Nope. I am thoroughly stumped and maybe can't make it any further
because of Windows.

Downstream I am trying to use digest::digest to create a hash but
digest thinks we don't have permission because file.access is failing.
Any thoughts on how I can get file.access to return 0 for the remote.R
file? Any ideas?

Thanks in advance,

Sam

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] dir and pattern = ".r"

2020-02-28 Thread Patrick Giraudoux
Ups... Thank you both. Indeed I must repeat lessons on regular 
expression... obviously forgotten...



Le 28/02/2020 à 18:32, Jeremie Juste a écrit :

Hello,

you need

dir(pattern="\\.r$",ignore.case=TRUE)

remember that the pattern is a regular expression.
so ".r" is [any single character]r. So basically it will give you any
file that contains r (but not that starts with r)


so you got what you expected with

  dir(pattern=".txt")

just by chance. as  or   would have been printed as well

HTH,

Jeremie



I have this directory contain listed at the page bottom

Can somebody tell me why with

dir(pattern = ".txt")

dir(pattern = ".dbf")

etc.

I get exactly what I want (a vector with the file names correctly
suffixed), but with

dir(pattern = ".r")

I get this:


dir(pattern=".r") [1] "Article Predation" "BD Carto" [3] "broma1.txt"

"broma3.txt" [5] "BromaBusesMilanMicha.xlsx" "Bromadiolone" [7]
"BufferRenard.dbf" "BufferRenard.prj" [9] "BufferRenard.shp"
"BufferRenard.shx" [11] "clpboard" "DatesDiurnes.txt" [13]
"DatesDiurnes_plus.txt" "DatesDiurnes_plus.xlsx" [15]
"DatesDiurnesFREDON" "DatesDiurnesFREDON_plus.txt" [17]
"DatesDiurnesFREDON_plus.xlsx" "DatesDiurnesRegis.txt" [19]
"DatesDiurnesRegis_plus.txt" "DatesDiurnesRegis_plus.xlsx" [21]
"DatesNocturnes.txt" "DatesNocturnes_plus.txt" [23]
"DatesNocturnes_plus.xlsx" "DatesNocturnesFREDON" [25]
"DatesNocturnesFREDON_plus.txt" "DatesNocturnesFREDON_plus.xlsx" [27]
"DatesNocturnesRegis.txt" "DatesNocturnesRegis_plus.txt" [29]
"DatesNocturnesRegis_plus.xlsx" "Figures" [31] "ParcBuf300n.dbf"
"ParcBuf300n.prj" [33] "ParcBuf300n.shp" "ParcBuf300n.shx" [35]
"ParcBuf350n.dbf" "ParcBuf350n.prj" [37] "ParcBuf350n.shp"
"ParcBuf350n.shx" [39] "Script_190517_preparation.r"
"Script_190518_scores_AT.r" [41] "Script_190519_1430_cinetiques_IKA.r"
"Script_190519_1622_transects_camp.r" [43]
"Script_190530_1700_preparation2.r"
"Script_190530_1903_cinetiques_IKA2.r" [45]
"Script_190531_0922_scores_AT2.r" "Script_190531_1729_prey_resource.r"
[47] "Script_190601_1509_graphIKAd.r"
"Script_190601_1509_graphIKAd_old.r" [49]
"Script_190601_1509_graphIKAn.r" "Script_190601_1509_graphIKAn_old.r"
[51] "Script_190601_1955_spatial.r" "Script_190708_0930_distance.r" [53]
"Script_190709_0930_impact renard.r"
"Script_200117_cinetiques_article.r" [55]
"Script_200119_source_stats_explore_diurne.r" "Script_200119_stats.r"
[57] "Script_200122_spatial_distribution.r" "Script_200124_distance.r"
[59] "Script_200124_distance_source_d.r"
"Script_200124_distance_source_n.r" [61]
"Script_200201_impacts_on_prey.R" "ScriptCompteLignes.r" [63]
"Scripts_avant_200112.zip" "shinyPred" [65] "StudyArea.dbf"
"StudyArea.prj" [67] "StudyArea.shp" "StudyArea.shx" [69]
"SurfaceZoneEtude.dbf" "SurfaceZoneEtude.prj" [71]
"SurfaceZoneEtude.shp" "SurfaceZoneEtude.shx" [73] "transects_camp.Rdata"

How can I get all the files, only these files, suffixed with ".r" ?

Thanks in advance,




dir() [1] "Analyse_190523_baseline_190523_1506.docx"

"Analyse_190523_baseline_190531_2110.docx" [3]
"Analyse_190523_baseline_190531_2110.Rmd" "Analyse_190531_baseline.docx"
[5] "Analyse_190531_baseline.Rmd" "Analyse_190531_baseline_cache" [7]
"Analyse_190531_baseline_files" "Analyse_190603_spatial.docx" [9]
"Analyse_190603_spatial.Rmd" "Analyse_190603_spatial_cache" [11]
"Analyse_190603_spatial_files" "Article Predation" [13] "BD Carto"
"Biblio" [15] "broma1.txt" "broma3.txt" [17] "BromaBusesMilanMicha.xlsx"
"Bromadiolone" [19] "BufferRenard.dbf" "BufferRenard.prj" [21]
"BufferRenard.shp" "BufferRenard.shx" [23] "clpboard" "DatesDiurnes.txt"
[25] "DatesDiurnes_plus.txt" "DatesDiurnes_plus.xlsx" [27]
"DatesDiurnesFREDON" "DatesDiurnesFREDON_plus.txt" [29]
"DatesDiurnesFREDON_plus.xlsx" "DatesDiurnesRegis.txt" [31]
"DatesDiurnesRegis_plus.txt" "DatesDiurnesRegis_plus.xlsx" [33]
"DatesNocturnes.txt" "DatesNocturnes_plus.txt" [35]
"DatesNocturnes_plus.xlsx" "DatesNocturnesFREDON" [37]
"DatesNocturnesFREDON_plus.txt" "DatesNocturnesFREDON_plus.xlsx" [39]
"DatesNocturnesRegis.txt" "DatesNocturnesRegis_plus.txt" [41]
"DatesNocturnesRegis_plus.xlsx" "Figures" [43] "IKAZ_old.zip"
"IKAZ1999.txt" [45] "IKAZ2000.txt" "IKAZ2007.txt" [47] "IKAZ2008.txt"
"IKAZ2009.txt" [49] "IKAZ2010.txt" "IKAZ2011.txt" [51] "IKAZ2012.txt"
"IKAZ2013.txt" [53] "IKAZ2014.txt" "IKAZ2015.txt" [55] "IKAZ2016.txt"
"IKAZ2017.txt" [57] "IKAZ2018.txt" "ParcBuf300n.dbf" [59]
"ParcBuf300n.prj" "ParcBuf300n.shp" [61] "ParcBuf300n.shx"
"ParcBuf350n.dbf" [63] "ParcBuf350n.prj" "ParcBuf350n.shp" [65]
"ParcBuf350n.shx" "Photos ZELAC" [67] "plot.ds.R" "plot.dsmodel.R" [69]
"RData" "Script_190517_preparation.r" [71] "Script_190518_scores_AT.r"
"Script_190519_1430_cinetiques_IKA.r" [73]
"Script_190519_1622_transects_camp.r"
"Script_190530_1700_preparation2.r" [75]
"Script_190530_1903_cinetiques_IKA2.r" "Script_190531_0922_scores_AT2.r"
[77] "Script_190531_1729_prey_resource.r"

Re: [R] dir and pattern = ".r"

2020-02-28 Thread Jeff Newmiller
You _need_ to learn how regular expressions work. There are many dozens of ways 
to learn this topic... web tutorials, YouTube videos, reading the ?regex help 
page in R. Start at the beginning, and look for special characters like ".", 
"$", and "\." (which has to be "\\." in R). It shouldn't take long to pick up 
enough skill to solve this yourself, and you will be a more complete data 
analyst for it.

On February 28, 2020 9:23:02 AM PST, Patrick Giraudoux 
 wrote:
>I have this directory contain listed at the page bottom
>
>Can somebody tell me why with
>
>dir(pattern = ".txt")
>
>dir(pattern = ".dbf")
>
>etc.
>
>I get exactly what I want (a vector with the file names correctly 
>suffixed), but with
>
>dir(pattern = ".r")
>
>I get this:
>
>> dir(pattern=".r") [1] "Article Predation" "BD Carto" [3] "broma1.txt"
>
>"broma3.txt" [5] "BromaBusesMilanMicha.xlsx" "Bromadiolone" [7] 
>"BufferRenard.dbf" "BufferRenard.prj" [9] "BufferRenard.shp" 
>"BufferRenard.shx" [11] "clpboard" "DatesDiurnes.txt" [13] 
>"DatesDiurnes_plus.txt" "DatesDiurnes_plus.xlsx" [15] 
>"DatesDiurnesFREDON" "DatesDiurnesFREDON_plus.txt" [17] 
>"DatesDiurnesFREDON_plus.xlsx" "DatesDiurnesRegis.txt" [19] 
>"DatesDiurnesRegis_plus.txt" "DatesDiurnesRegis_plus.xlsx" [21] 
>"DatesNocturnes.txt" "DatesNocturnes_plus.txt" [23] 
>"DatesNocturnes_plus.xlsx" "DatesNocturnesFREDON" [25] 
>"DatesNocturnesFREDON_plus.txt" "DatesNocturnesFREDON_plus.xlsx" [27] 
>"DatesNocturnesRegis.txt" "DatesNocturnesRegis_plus.txt" [29] 
>"DatesNocturnesRegis_plus.xlsx" "Figures" [31] "ParcBuf300n.dbf" 
>"ParcBuf300n.prj" [33] "ParcBuf300n.shp" "ParcBuf300n.shx" [35] 
>"ParcBuf350n.dbf" "ParcBuf350n.prj" [37] "ParcBuf350n.shp" 
>"ParcBuf350n.shx" [39] "Script_190517_preparation.r" 
>"Script_190518_scores_AT.r" [41] "Script_190519_1430_cinetiques_IKA.r" 
>"Script_190519_1622_transects_camp.r" [43] 
>"Script_190530_1700_preparation2.r" 
>"Script_190530_1903_cinetiques_IKA2.r" [45] 
>"Script_190531_0922_scores_AT2.r" "Script_190531_1729_prey_resource.r" 
>[47] "Script_190601_1509_graphIKAd.r" 
>"Script_190601_1509_graphIKAd_old.r" [49] 
>"Script_190601_1509_graphIKAn.r" "Script_190601_1509_graphIKAn_old.r" 
>[51] "Script_190601_1955_spatial.r" "Script_190708_0930_distance.r"
>[53] 
>"Script_190709_0930_impact renard.r" 
>"Script_200117_cinetiques_article.r" [55] 
>"Script_200119_source_stats_explore_diurne.r" "Script_200119_stats.r" 
>[57] "Script_200122_spatial_distribution.r" "Script_200124_distance.r" 
>[59] "Script_200124_distance_source_d.r" 
>"Script_200124_distance_source_n.r" [61] 
>"Script_200201_impacts_on_prey.R" "ScriptCompteLignes.r" [63] 
>"Scripts_avant_200112.zip" "shinyPred" [65] "StudyArea.dbf" 
>"StudyArea.prj" [67] "StudyArea.shp" "StudyArea.shx" [69] 
>"SurfaceZoneEtude.dbf" "SurfaceZoneEtude.prj" [71] 
>"SurfaceZoneEtude.shp" "SurfaceZoneEtude.shx" [73]
>"transects_camp.Rdata"
>
>
>How can I get all the files, only these files, suffixed with ".r" ?
>
>Thanks in advance,
>
>
>
>
>> dir() [1] "Analyse_190523_baseline_190523_1506.docx" 
>"Analyse_190523_baseline_190531_2110.docx" [3] 
>"Analyse_190523_baseline_190531_2110.Rmd"
>"Analyse_190531_baseline.docx" 
>[5] "Analyse_190531_baseline.Rmd" "Analyse_190531_baseline_cache" [7] 
>"Analyse_190531_baseline_files" "Analyse_190603_spatial.docx" [9] 
>"Analyse_190603_spatial.Rmd" "Analyse_190603_spatial_cache" [11] 
>"Analyse_190603_spatial_files" "Article Predation" [13] "BD Carto" 
>"Biblio" [15] "broma1.txt" "broma3.txt" [17]
>"BromaBusesMilanMicha.xlsx" 
>"Bromadiolone" [19] "BufferRenard.dbf" "BufferRenard.prj" [21] 
>"BufferRenard.shp" "BufferRenard.shx" [23] "clpboard"
>"DatesDiurnes.txt" 
>[25] "DatesDiurnes_plus.txt" "DatesDiurnes_plus.xlsx" [27] 
>"DatesDiurnesFREDON" "DatesDiurnesFREDON_plus.txt" [29] 
>"DatesDiurnesFREDON_plus.xlsx" "DatesDiurnesRegis.txt" [31] 
>"DatesDiurnesRegis_plus.txt" "DatesDiurnesRegis_plus.xlsx" [33] 
>"DatesNocturnes.txt" "DatesNocturnes_plus.txt" [35] 
>"DatesNocturnes_plus.xlsx" "DatesNocturnesFREDON" [37] 
>"DatesNocturnesFREDON_plus.txt" "DatesNocturnesFREDON_plus.xlsx" [39] 
>"DatesNocturnesRegis.txt" "DatesNocturnesRegis_plus.txt" [41] 
>"DatesNocturnesRegis_plus.xlsx" "Figures" [43] "IKAZ_old.zip" 
>"IKAZ1999.txt" [45] "IKAZ2000.txt" "IKAZ2007.txt" [47] "IKAZ2008.txt" 
>"IKAZ2009.txt" [49] "IKAZ2010.txt" "IKAZ2011.txt" [51] "IKAZ2012.txt" 
>"IKAZ2013.txt" [53] "IKAZ2014.txt" "IKAZ2015.txt" [55] "IKAZ2016.txt" 
>"IKAZ2017.txt" [57] "IKAZ2018.txt" "ParcBuf300n.dbf" [59] 
>"ParcBuf300n.prj" "ParcBuf300n.shp" [61] "ParcBuf300n.shx" 
>"ParcBuf350n.dbf" [63] "ParcBuf350n.prj" "ParcBuf350n.shp" [65] 
>"ParcBuf350n.shx" "Photos ZELAC" [67] "plot.ds.R" "plot.dsmodel.R" [69]
>
>"RData" "Script_190517_preparation.r" [71] "Script_190518_scores_AT.r" 
>"Script_190519_1430_cinetiques_IKA.r" [73] 
>"Script_190519_1622_transects_camp.r" 
>"Script_190530_1700_preparation2.r" [75] 

Re: [R] Help with ggplot plot

2020-02-28 Thread Bill Poling
Hi Rui, thank you this is helpful, however, I would like the values in the or 
above the bars.

I have tried 'dodge' but not working correctly.

ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Getting 
worse again
geom_bar(stat ="identity")  +
geom_col(position = 'dodge')  +
facet_grid("InOutFlagAlpha")

Thoughts?

WHP

From: Rui Barradas 
Sent: Friday, February 28, 2020 11:06 AM
To: Bill Poling ; r-help (r-help@r-project.org) 

Subject: Re: [R] Help with ggplot plot

[External Email]
Hello,

If you want faceting, a square grid can do it.


ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat = "identity") +
facet_grid(InOutFlagAlpha ~ ProductLineFlag)


Hope this helps,

Rui Barradas

Às 16:50 de 28/02/20, Bill Poling escreveu:
> #RStudio Version 1.2.5019
> sessionInfo()
> # R version 3.6.2 (2019-12-12)
> #Platform: x86_64-w64-mingw32/x64 (64-bit)
> #Running under: Windows 10 x64 (build 17134)
>
> Hello, I am sure I am missing something simple.
>
> Here is my data, its aggregated and if need be I can unaggregate I guess:
>
> dput(tmp)
> structure(list(InOutFlagAlpha = c("NO ", "YES", "NO ", "YES",
> "NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ",
> "YES", "NO ", "YES", "NO ", "YES", "NO ", "YES"), ProductLineFlag = 
> structure(c(1L,
> 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L,
> 1L, 2L, 2L), .Label = c("ACH", "CARD"), class = "factor"), Region = 
> structure(c(1L,
> 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L,
> 5L, 5L, 5L), .Label = c("Frontier", "Midwest", "Northeast", "Pacific",
> "South"), class = "factor"), ProductLineID = c(7163L, 34212L,
> 35891L, 54177L, 8873L, 34008L, 52017L, 67881L, 7408L, 29430L,
> 64108L, 70532L, 5984L, 21720L, 49030L, 60211L, 7330L, 34876L,
> 46387L, 75893L)), row.names = c(NA, -20L), class = "data.frame")
>
> |InOutFlagAlpha |ProductLineFlag | Region| ProductLineID|
> |:--|:---|-:|-:|
> |NO |ACH | Frontier| 7163|
> |YES |ACH | Frontier| 34212|
> |NO |CARD | Frontier| 35891|
> |YES |CARD | Frontier| 54177|
> |NO |ACH | Midwest| 8873|
> |YES |ACH | Midwest| 34008|
> |NO |CARD | Midwest| 52017|
> |YES |CARD | Midwest| 67881|
> |NO |ACH | Northeast| 7408|
> |YES |ACH | Northeast| 29430|
> |NO |CARD | Northeast| 64108|
> |YES |CARD | Northeast| 70532|
> |NO |ACH | Pacific| 5984|
> |YES |ACH | Pacific| 21720|
> |NO |CARD | Pacific| 49030|
> |YES |CARD | Pacific| 60211|
> |NO |ACH | South| 7330|
> |YES |ACH | South| 34876|
> |NO |CARD | South| 46387|
> |YES |CARD | South| 75893|
>
> I am trying to get the value from ProductLineID into the bars
>
> I have slowly stepped through to the point of having everything but the 
> values.
>
> Appreciate any advice, thank you.
>
> WHP
>
> #1
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
> geom_bar(stat = "identity")
> #2
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
> geom_bar(stat = "identity") +
> facet_grid("InOutFlagAlpha")
> #3
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
> geom_bar(stat ="identity") +
> facet_grid("InOutFlagAlpha")
> #4
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
> geom_bar(stat ="identity",position = 'dodge') +
> facet_grid("InOutFlagAlpha")
> #5
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) +
> geom_bar(stat ="identity",position = 'dodge') +
> facet_grid("InOutFlagAlpha")
> #6
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Best so 
> far
> geom_bar(stat ="identity") +
> geom_col() +
> facet_grid("InOutFlagAlpha")
> #7
> ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Not 
> working
> geom_bar(stat ="identity") +
> geom_col(position = 'dodge') +
> facet_grid("InOutFlagAlpha")
>
> WHP
>
>
> Confidentiality Notice\ \ This email and the attachments...{{dropped:11}}
>
> __
> mailto:R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Confidentiality Notice

This email and the attachments may contain information which is privileged 
and/or confidential and is intended for the business and/or confidential use of 
the recipient only. Such information may be protected by applicable State 
and/or Federal laws from disclosure or unauthorized use. If you are not the 
intended recipient, you are hereby notified that any disclosure is strictly 
prohibited. If you have received this email in error, please contact the sender 
immediately.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, 

Re: [R] dir and pattern = ".r"

2020-02-28 Thread Jeremie Juste


Hello,

you need
> dir(pattern="\\.r$",ignore.case=TRUE)
remember that the pattern is a regular expression.
so ".r" is [any single character]r. So basically it will give you any
file that contains r (but not that starts with r)


so you got what you expected with
>  dir(pattern=".txt")
just by chance. as  or   would have been printed as well

HTH,

Jeremie


> I have this directory contain listed at the page bottom
>
> Can somebody tell me why with
>
> dir(pattern = ".txt")
>
> dir(pattern = ".dbf")
>
> etc.
>
> I get exactly what I want (a vector with the file names correctly 
> suffixed), but with
>
> dir(pattern = ".r")
>
> I get this:
>
>> dir(pattern=".r") [1] "Article Predation" "BD Carto" [3] "broma1.txt" 
> "broma3.txt" [5] "BromaBusesMilanMicha.xlsx" "Bromadiolone" [7] 
> "BufferRenard.dbf" "BufferRenard.prj" [9] "BufferRenard.shp" 
> "BufferRenard.shx" [11] "clpboard" "DatesDiurnes.txt" [13] 
> "DatesDiurnes_plus.txt" "DatesDiurnes_plus.xlsx" [15] 
> "DatesDiurnesFREDON" "DatesDiurnesFREDON_plus.txt" [17] 
> "DatesDiurnesFREDON_plus.xlsx" "DatesDiurnesRegis.txt" [19] 
> "DatesDiurnesRegis_plus.txt" "DatesDiurnesRegis_plus.xlsx" [21] 
> "DatesNocturnes.txt" "DatesNocturnes_plus.txt" [23] 
> "DatesNocturnes_plus.xlsx" "DatesNocturnesFREDON" [25] 
> "DatesNocturnesFREDON_plus.txt" "DatesNocturnesFREDON_plus.xlsx" [27] 
> "DatesNocturnesRegis.txt" "DatesNocturnesRegis_plus.txt" [29] 
> "DatesNocturnesRegis_plus.xlsx" "Figures" [31] "ParcBuf300n.dbf" 
> "ParcBuf300n.prj" [33] "ParcBuf300n.shp" "ParcBuf300n.shx" [35] 
> "ParcBuf350n.dbf" "ParcBuf350n.prj" [37] "ParcBuf350n.shp" 
> "ParcBuf350n.shx" [39] "Script_190517_preparation.r" 
> "Script_190518_scores_AT.r" [41] "Script_190519_1430_cinetiques_IKA.r" 
> "Script_190519_1622_transects_camp.r" [43] 
> "Script_190530_1700_preparation2.r" 
> "Script_190530_1903_cinetiques_IKA2.r" [45] 
> "Script_190531_0922_scores_AT2.r" "Script_190531_1729_prey_resource.r" 
> [47] "Script_190601_1509_graphIKAd.r" 
> "Script_190601_1509_graphIKAd_old.r" [49] 
> "Script_190601_1509_graphIKAn.r" "Script_190601_1509_graphIKAn_old.r" 
> [51] "Script_190601_1955_spatial.r" "Script_190708_0930_distance.r" [53] 
> "Script_190709_0930_impact renard.r" 
> "Script_200117_cinetiques_article.r" [55] 
> "Script_200119_source_stats_explore_diurne.r" "Script_200119_stats.r" 
> [57] "Script_200122_spatial_distribution.r" "Script_200124_distance.r" 
> [59] "Script_200124_distance_source_d.r" 
> "Script_200124_distance_source_n.r" [61] 
> "Script_200201_impacts_on_prey.R" "ScriptCompteLignes.r" [63] 
> "Scripts_avant_200112.zip" "shinyPred" [65] "StudyArea.dbf" 
> "StudyArea.prj" [67] "StudyArea.shp" "StudyArea.shx" [69] 
> "SurfaceZoneEtude.dbf" "SurfaceZoneEtude.prj" [71] 
> "SurfaceZoneEtude.shp" "SurfaceZoneEtude.shx" [73] "transects_camp.Rdata"
>
> How can I get all the files, only these files, suffixed with ".r" ?
>
> Thanks in advance,
>
> 
>
>> dir() [1] "Analyse_190523_baseline_190523_1506.docx" 
> "Analyse_190523_baseline_190531_2110.docx" [3] 
> "Analyse_190523_baseline_190531_2110.Rmd" "Analyse_190531_baseline.docx" 
> [5] "Analyse_190531_baseline.Rmd" "Analyse_190531_baseline_cache" [7] 
> "Analyse_190531_baseline_files" "Analyse_190603_spatial.docx" [9] 
> "Analyse_190603_spatial.Rmd" "Analyse_190603_spatial_cache" [11] 
> "Analyse_190603_spatial_files" "Article Predation" [13] "BD Carto" 
> "Biblio" [15] "broma1.txt" "broma3.txt" [17] "BromaBusesMilanMicha.xlsx" 
> "Bromadiolone" [19] "BufferRenard.dbf" "BufferRenard.prj" [21] 
> "BufferRenard.shp" "BufferRenard.shx" [23] "clpboard" "DatesDiurnes.txt" 
> [25] "DatesDiurnes_plus.txt" "DatesDiurnes_plus.xlsx" [27] 
> "DatesDiurnesFREDON" "DatesDiurnesFREDON_plus.txt" [29] 
> "DatesDiurnesFREDON_plus.xlsx" "DatesDiurnesRegis.txt" [31] 
> "DatesDiurnesRegis_plus.txt" "DatesDiurnesRegis_plus.xlsx" [33] 
> "DatesNocturnes.txt" "DatesNocturnes_plus.txt" [35] 
> "DatesNocturnes_plus.xlsx" "DatesNocturnesFREDON" [37] 
> "DatesNocturnesFREDON_plus.txt" "DatesNocturnesFREDON_plus.xlsx" [39] 
> "DatesNocturnesRegis.txt" "DatesNocturnesRegis_plus.txt" [41] 
> "DatesNocturnesRegis_plus.xlsx" "Figures" [43] "IKAZ_old.zip" 
> "IKAZ1999.txt" [45] "IKAZ2000.txt" "IKAZ2007.txt" [47] "IKAZ2008.txt" 
> "IKAZ2009.txt" [49] "IKAZ2010.txt" "IKAZ2011.txt" [51] "IKAZ2012.txt" 
> "IKAZ2013.txt" [53] "IKAZ2014.txt" "IKAZ2015.txt" [55] "IKAZ2016.txt" 
> "IKAZ2017.txt" [57] "IKAZ2018.txt" "ParcBuf300n.dbf" [59] 
> "ParcBuf300n.prj" "ParcBuf300n.shp" [61] "ParcBuf300n.shx" 
> "ParcBuf350n.dbf" [63] "ParcBuf350n.prj" "ParcBuf350n.shp" [65] 
> "ParcBuf350n.shx" "Photos ZELAC" [67] "plot.ds.R" "plot.dsmodel.R" [69] 
> "RData" "Script_190517_preparation.r" [71] "Script_190518_scores_AT.r" 
> "Script_190519_1430_cinetiques_IKA.r" [73] 
> "Script_190519_1622_transects_camp.r" 
> "Script_190530_1700_preparation2.r" [75] 
> "Script_190530_1903_cinetiques_IKA2.r" 

[R] dir and pattern = ".r"

2020-02-28 Thread Patrick Giraudoux
I have this directory contain listed at the page bottom

Can somebody tell me why with

dir(pattern = ".txt")

dir(pattern = ".dbf")

etc.

I get exactly what I want (a vector with the file names correctly 
suffixed), but with

dir(pattern = ".r")

I get this:

> dir(pattern=".r") [1] "Article Predation" "BD Carto" [3] "broma1.txt" 
"broma3.txt" [5] "BromaBusesMilanMicha.xlsx" "Bromadiolone" [7] 
"BufferRenard.dbf" "BufferRenard.prj" [9] "BufferRenard.shp" 
"BufferRenard.shx" [11] "clpboard" "DatesDiurnes.txt" [13] 
"DatesDiurnes_plus.txt" "DatesDiurnes_plus.xlsx" [15] 
"DatesDiurnesFREDON" "DatesDiurnesFREDON_plus.txt" [17] 
"DatesDiurnesFREDON_plus.xlsx" "DatesDiurnesRegis.txt" [19] 
"DatesDiurnesRegis_plus.txt" "DatesDiurnesRegis_plus.xlsx" [21] 
"DatesNocturnes.txt" "DatesNocturnes_plus.txt" [23] 
"DatesNocturnes_plus.xlsx" "DatesNocturnesFREDON" [25] 
"DatesNocturnesFREDON_plus.txt" "DatesNocturnesFREDON_plus.xlsx" [27] 
"DatesNocturnesRegis.txt" "DatesNocturnesRegis_plus.txt" [29] 
"DatesNocturnesRegis_plus.xlsx" "Figures" [31] "ParcBuf300n.dbf" 
"ParcBuf300n.prj" [33] "ParcBuf300n.shp" "ParcBuf300n.shx" [35] 
"ParcBuf350n.dbf" "ParcBuf350n.prj" [37] "ParcBuf350n.shp" 
"ParcBuf350n.shx" [39] "Script_190517_preparation.r" 
"Script_190518_scores_AT.r" [41] "Script_190519_1430_cinetiques_IKA.r" 
"Script_190519_1622_transects_camp.r" [43] 
"Script_190530_1700_preparation2.r" 
"Script_190530_1903_cinetiques_IKA2.r" [45] 
"Script_190531_0922_scores_AT2.r" "Script_190531_1729_prey_resource.r" 
[47] "Script_190601_1509_graphIKAd.r" 
"Script_190601_1509_graphIKAd_old.r" [49] 
"Script_190601_1509_graphIKAn.r" "Script_190601_1509_graphIKAn_old.r" 
[51] "Script_190601_1955_spatial.r" "Script_190708_0930_distance.r" [53] 
"Script_190709_0930_impact renard.r" 
"Script_200117_cinetiques_article.r" [55] 
"Script_200119_source_stats_explore_diurne.r" "Script_200119_stats.r" 
[57] "Script_200122_spatial_distribution.r" "Script_200124_distance.r" 
[59] "Script_200124_distance_source_d.r" 
"Script_200124_distance_source_n.r" [61] 
"Script_200201_impacts_on_prey.R" "ScriptCompteLignes.r" [63] 
"Scripts_avant_200112.zip" "shinyPred" [65] "StudyArea.dbf" 
"StudyArea.prj" [67] "StudyArea.shp" "StudyArea.shx" [69] 
"SurfaceZoneEtude.dbf" "SurfaceZoneEtude.prj" [71] 
"SurfaceZoneEtude.shp" "SurfaceZoneEtude.shx" [73] "transects_camp.Rdata"


How can I get all the files, only these files, suffixed with ".r" ?

Thanks in advance,




> dir() [1] "Analyse_190523_baseline_190523_1506.docx" 
"Analyse_190523_baseline_190531_2110.docx" [3] 
"Analyse_190523_baseline_190531_2110.Rmd" "Analyse_190531_baseline.docx" 
[5] "Analyse_190531_baseline.Rmd" "Analyse_190531_baseline_cache" [7] 
"Analyse_190531_baseline_files" "Analyse_190603_spatial.docx" [9] 
"Analyse_190603_spatial.Rmd" "Analyse_190603_spatial_cache" [11] 
"Analyse_190603_spatial_files" "Article Predation" [13] "BD Carto" 
"Biblio" [15] "broma1.txt" "broma3.txt" [17] "BromaBusesMilanMicha.xlsx" 
"Bromadiolone" [19] "BufferRenard.dbf" "BufferRenard.prj" [21] 
"BufferRenard.shp" "BufferRenard.shx" [23] "clpboard" "DatesDiurnes.txt" 
[25] "DatesDiurnes_plus.txt" "DatesDiurnes_plus.xlsx" [27] 
"DatesDiurnesFREDON" "DatesDiurnesFREDON_plus.txt" [29] 
"DatesDiurnesFREDON_plus.xlsx" "DatesDiurnesRegis.txt" [31] 
"DatesDiurnesRegis_plus.txt" "DatesDiurnesRegis_plus.xlsx" [33] 
"DatesNocturnes.txt" "DatesNocturnes_plus.txt" [35] 
"DatesNocturnes_plus.xlsx" "DatesNocturnesFREDON" [37] 
"DatesNocturnesFREDON_plus.txt" "DatesNocturnesFREDON_plus.xlsx" [39] 
"DatesNocturnesRegis.txt" "DatesNocturnesRegis_plus.txt" [41] 
"DatesNocturnesRegis_plus.xlsx" "Figures" [43] "IKAZ_old.zip" 
"IKAZ1999.txt" [45] "IKAZ2000.txt" "IKAZ2007.txt" [47] "IKAZ2008.txt" 
"IKAZ2009.txt" [49] "IKAZ2010.txt" "IKAZ2011.txt" [51] "IKAZ2012.txt" 
"IKAZ2013.txt" [53] "IKAZ2014.txt" "IKAZ2015.txt" [55] "IKAZ2016.txt" 
"IKAZ2017.txt" [57] "IKAZ2018.txt" "ParcBuf300n.dbf" [59] 
"ParcBuf300n.prj" "ParcBuf300n.shp" [61] "ParcBuf300n.shx" 
"ParcBuf350n.dbf" [63] "ParcBuf350n.prj" "ParcBuf350n.shp" [65] 
"ParcBuf350n.shx" "Photos ZELAC" [67] "plot.ds.R" "plot.dsmodel.R" [69] 
"RData" "Script_190517_preparation.r" [71] "Script_190518_scores_AT.r" 
"Script_190519_1430_cinetiques_IKA.r" [73] 
"Script_190519_1622_transects_camp.r" 
"Script_190530_1700_preparation2.r" [75] 
"Script_190530_1903_cinetiques_IKA2.r" "Script_190531_0922_scores_AT2.r" 
[77] "Script_190531_1729_prey_resource.r" 
"Script_190601_1509_graphIKAd.r" [79] 
"Script_190601_1509_graphIKAd_old.r" "Script_190601_1509_graphIKAn.r" 
[81] "Script_190601_1509_graphIKAn_old.r" "Script_190601_1955_spatial.r" 
[83] "Script_190708_0930_distance.r" "Script_190709_0930_impact 
renard.r" [85] "Script_200117_cinetiques_article.r" 
"Script_200119_source_stats_explore_diurne.r" [87] 
"Script_200119_stats.r" "Script_200122_spatial_distribution.r" [89] 
"Script_200124_distance.r" 

Re: [R] Help with ggplot plot

2020-02-28 Thread Rui Barradas

Hello,

If you want faceting, a square grid can do it.


ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
  geom_bar(stat = "identity") +
  facet_grid(InOutFlagAlpha ~ ProductLineFlag)


Hope this helps,

Rui Barradas

Às 16:50 de 28/02/20, Bill Poling escreveu:

#RStudio Version 1.2.5019
sessionInfo()
# R version 3.6.2 (2019-12-12)
#Platform: x86_64-w64-mingw32/x64 (64-bit)
#Running under: Windows 10 x64 (build 17134)

Hello, I am sure I am missing something simple.

Here is my data, its aggregated and if need be I can unaggregate I guess:

dput(tmp)
structure(list(InOutFlagAlpha = c("NO ", "YES", "NO ", "YES",
"NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ",
"YES", "NO ", "YES", "NO ", "YES", "NO ", "YES"), ProductLineFlag = 
structure(c(1L,
1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L,
1L, 2L, 2L), .Label = c("ACH", "CARD"), class = "factor"), Region = 
structure(c(1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L,
5L, 5L, 5L), .Label = c("Frontier", "Midwest", "Northeast", "Pacific",
"South"), class = "factor"), ProductLineID = c(7163L, 34212L,
35891L, 54177L, 8873L, 34008L, 52017L, 67881L, 7408L, 29430L,
64108L, 70532L, 5984L, 21720L, 49030L, 60211L, 7330L, 34876L,
46387L, 75893L)), row.names = c(NA, -20L), class = "data.frame")

|InOutFlagAlpha |ProductLineFlag |Region| ProductLineID|
|:--|:---|-:|-:|
|NO |ACH |  Frontier|  7163|
|YES|ACH |  Frontier| 34212|
|NO |CARD|  Frontier| 35891|
|YES|CARD|  Frontier| 54177|
|NO |ACH |   Midwest|  8873|
|YES|ACH |   Midwest| 34008|
|NO |CARD|   Midwest| 52017|
|YES|CARD|   Midwest| 67881|
|NO |ACH | Northeast|  7408|
|YES|ACH | Northeast| 29430|
|NO |CARD| Northeast| 64108|
|YES|CARD| Northeast| 70532|
|NO |ACH |   Pacific|  5984|
|YES|ACH |   Pacific| 21720|
|NO |CARD|   Pacific| 49030|
|YES|CARD|   Pacific| 60211|
|NO |ACH | South|  7330|
|YES|ACH | South| 34876|
|NO |CARD| South| 46387|
|YES|CARD| South| 75893|

I am trying to get the value from ProductLineID into the bars

I have slowly stepped through to the point of having everything but the values.

Appreciate any advice, thank you.

WHP

#1
   ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
 geom_bar(stat = "identity")
#2
   ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
 geom_bar(stat = "identity")  +
 facet_grid("InOutFlagAlpha")
#3
   ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
 geom_bar(stat ="identity")  +
 facet_grid("InOutFlagAlpha")
#4
   ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
 geom_bar(stat ="identity",position = 'dodge')  +
 facet_grid("InOutFlagAlpha")
#5
   ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) +
 geom_bar(stat ="identity",position = 'dodge')  +
 facet_grid("InOutFlagAlpha")
#6
   ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Best so 
far
 geom_bar(stat ="identity")  +
 geom_col()  +
 facet_grid("InOutFlagAlpha")
#7
   ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Not 
working
 geom_bar(stat ="identity")  +
 geom_col(position = 'dodge')  +
 facet_grid("InOutFlagAlpha")

WHP


Confidentiality Notice\ \ This email and the attachments...{{dropped:11}}

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



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


[R] Help with ggplot plot

2020-02-28 Thread Bill Poling
#RStudio Version 1.2.5019
sessionInfo()
# R version 3.6.2 (2019-12-12)
#Platform: x86_64-w64-mingw32/x64 (64-bit)
#Running under: Windows 10 x64 (build 17134)

Hello, I am sure I am missing something simple.

Here is my data, its aggregated and if need be I can unaggregate I guess:

dput(tmp)
structure(list(InOutFlagAlpha = c("NO ", "YES", "NO ", "YES",
"NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ", "YES", "NO ",
"YES", "NO ", "YES", "NO ", "YES", "NO ", "YES"), ProductLineFlag = 
structure(c(1L,
1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L,
1L, 2L, 2L), .Label = c("ACH", "CARD"), class = "factor"), Region = 
structure(c(1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L,
5L, 5L, 5L), .Label = c("Frontier", "Midwest", "Northeast", "Pacific",
"South"), class = "factor"), ProductLineID = c(7163L, 34212L,
35891L, 54177L, 8873L, 34008L, 52017L, 67881L, 7408L, 29430L,
64108L, 70532L, 5984L, 21720L, 49030L, 60211L, 7330L, 34876L,
46387L, 75893L)), row.names = c(NA, -20L), class = "data.frame")

|InOutFlagAlpha |ProductLineFlag |Region| ProductLineID|
|:--|:---|-:|-:|
|NO |ACH |  Frontier|  7163|
|YES|ACH |  Frontier| 34212|
|NO |CARD|  Frontier| 35891|
|YES|CARD|  Frontier| 54177|
|NO |ACH |   Midwest|  8873|
|YES|ACH |   Midwest| 34008|
|NO |CARD|   Midwest| 52017|
|YES|CARD|   Midwest| 67881|
|NO |ACH | Northeast|  7408|
|YES|ACH | Northeast| 29430|
|NO |CARD| Northeast| 64108|
|YES|CARD| Northeast| 70532|
|NO |ACH |   Pacific|  5984|
|YES|ACH |   Pacific| 21720|
|NO |CARD|   Pacific| 49030|
|YES|CARD|   Pacific| 60211|
|NO |ACH | South|  7330|
|YES|ACH | South| 34876|
|NO |CARD| South| 46387|
|YES|CARD| South| 75893|

I am trying to get the value from ProductLineID into the bars

I have slowly stepped through to the point of having everything but the values.

Appreciate any advice, thank you.

WHP

#1
  ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat = "identity")
#2
  ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat = "identity")  +
facet_grid("InOutFlagAlpha")
#3
  ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat ="identity")  +
facet_grid("InOutFlagAlpha")
#4
  ggplot(tmp, aes(x=Region, y=ProductLineID, fill=Region)) +
geom_bar(stat ="identity",position = 'dodge')  +
facet_grid("InOutFlagAlpha")
#5
  ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) +
geom_bar(stat ="identity",position = 'dodge')  +
facet_grid("InOutFlagAlpha")
#6
  ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Best so 
far
geom_bar(stat ="identity")  +
geom_col()  +
facet_grid("InOutFlagAlpha")
#7
  ggplot(tmp, aes(x=Region, y=ProductLineID, fill=ProductLineFlag)) + #Not 
working
geom_bar(stat ="identity")  +
geom_col(position = 'dodge')  +
facet_grid("InOutFlagAlpha")

WHP


Confidentiality Notice\ \ This email and the attachments...{{dropped:11}}

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


Re: [R] Help to solve modeling problem with gamm

2020-02-28 Thread Bert Gunter
Wrong list.

Post here:
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

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 Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Feb 28, 2020 at 12:25 AM José Antonio García Pérez <
garc...@hotmail.com> wrote:

> I conducted an experiment where earthworms were subjected to two
> treatments, with and without herbicide in the soil. Biomass measurements
> were taken every 12 days for 398 days and the biomass growth curves as a
> function of time were plotted.
>
> There was clearly a non-linear growth pattern such that an additive mixed
> effects model was proposed to model the behavior of biomass as a function
> of time and treatments.
>
> When plotting the residuals a clear cone-shaped pattern was observed,
> therefore a series of additive models were proposed sequentially to deal
> with violations of the assumption of homogeneity. Below we can see the
> models with the following names: M.1; M.2; M.3; M.4
>
>
>
> lmc <- lmeControl (niterEM = 5000, msMaxIter = 1000)
>
> f1 <- formula (Biomass ~ Treat + s (Time, by = Treat))
>
>
>
> M.1 <-gamm (f1, random = list (fcajita = ~ 1), method = "REML", control =
> lmc, data = Acorticis)
>
>
>
> #This first model uses the experimental box factor (i.e. fcajita) as the
> random element of the model. This random effects model assumes homogeneity
> between the experimental boxes and within them over time
>
>
>
> M.2 <-gamm (f1, random = list (fcajita = ~ 1), method = "REML", control =
> lmc, data = Acorticis, weights = varIdent (form = ~ 1 | fcajita))
>
>
>
> #This second model assumes heterogeneity between boxes, but homogeneity
> within each box over time
>
>
>
> M.3 <- gamm (f1, random = list (fcajita = ~ 1), method = "REML", control =
> lmc, data = Acorticis, weights = varExp (form = ~ Time10))
>
>
>
> #The third model assumes homogeneity between boxes but heterogeneity
> within each box over time
>
>
>
> Finally, we decided to model the heterogeneity using the 'varComb'
> function in order to combine the variances where the model allows
> heterogeneity between the experimental boxes and heterogeneity within the
> experimental boxes over time:
>
>
>
> M.4 <- gamm (f1, random = list (fcajita = ~ 1), data = Acorticis, method =
> "REML", control = lmc, weights = varComb (varIdent (form = ~ 1 | fcajita),
> varPower (form = ~ Time10)))
>
>
>
> The first three models executed perfectly and the following values ​​of
> the AIC indicator were obtained:
>
> > AIC (M.1 $ lme, M.2 $ lme, M.3 $ lme)
>
>
>
> df   AIC
>
>
>
> M.1 8379.6464
>
>
>
> M.215309.5736
>
>
>
> M.3 9310.4828
>
>
>
> Unfortunately, the execution of the M.4 model failed and the following
> error message was obtained:
>
>
>
> Error in environment (attr (ret $ lme $ modelStruct $ varStruct,
> "formula")) <-. GlobalEnv:
>
> attempt to set an attribute on NULL
>
>
>
> A final model I tried was M5:
>
> M.5 <- gamm(f1, random = list(fcajita =~ 1), data = Acorticis, method =
> "REML", control = lmc, weights = varComb(varIdent(form = ~1|fcajita),
> varExp(form =~ Time10|fcajita)))
>
> and this time I got the following error message:
>
> Error in lme.formula(y ~ X - 1, random = rand, data = strip.offset(mf),  :
>
>   nlminb problem, convergence error code = 1
>
>   message = function evaluation limit reached without convergence (9)
>
> Además: Warning message:
>
> In logLik.reStruct(object, conLin) :
>
>   Singular precision matrix in level -1, block 1
>
>
>
> My question is: Could someone help me fix these problems to run the M.4
> and M.5 models?
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] offset in glm

2020-02-28 Thread peter dalgaard
You need weights=Holders to make the 2nd form equivalent to the first (with a 
bunch of somewhat annoying and largely irrelevant warnings). This is because 
300 claims from 1000 holders is more informative than 3 out of 10 even though 
the rate is the same.

-pd 

> On 27 Feb 2020, at 19:15 , John Smith  wrote:
> 
>  It is simple to use the provided function glm as fit1 below. However,
> without the offset argument, I tried fit2 below. The reason I used fit2 is
> that (for X as predictors, b the coefficients)
> fit2: log(Claims/Holders) = Xb
> means
> fit1: log(Claims)=Xb + log(Holders)
> 
> Obviously the results from fit2 are different from fit1.
> 
> Thanks!
> ##
> library("MASS")
>  ## main-effects fit as Poisson GLM with offset
> fit1 <- glm(Claims ~ District + Group + Age + offset(log(Holders)),
>  data = Insurance, family = poisson)
> coef(fit1)
>> coef(fit1)
>   (Intercept) District2 District3 District4   Group.L
> -1.8105078329  0.0258681909  0.0385239271  0.2342053280  0.4297075387
>   Group.Q   Group.C Age.L Age.Q Age.C
>  0.0046324351 -0.0292943222 -0.3944318082 -0.0003549709 -0.0167367565
> 
> fit2 <- glm(Claims/Holders ~ District + Group + Age,
>  data = Insurance, family = poisson)
>> coef(fit2)
> (Intercept)   District2   District3   District4 Group.L Group.Q
> -1.86340418  0.17552458  0.11081521  0.15131076  0.43701544 -0.01530721
> Group.C   Age.L   Age.Q   Age.C
> -0.06033747 -0.31976743 -0.01833841 -0.01694737
> 
>   [[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.


[R] Help to solve modeling problem with gamm

2020-02-28 Thread José Antonio García Pérez
I conducted an experiment where earthworms were subjected to two treatments, 
with and without herbicide in the soil. Biomass measurements were taken every 
12 days for 398 days and the biomass growth curves as a function of time were 
plotted.

There was clearly a non-linear growth pattern such that an additive mixed 
effects model was proposed to model the behavior of biomass as a function of 
time and treatments.

When plotting the residuals a clear cone-shaped pattern was observed, therefore 
a series of additive models were proposed sequentially to deal with violations 
of the assumption of homogeneity. Below we can see the models with the 
following names: M.1; M.2; M.3; M.4



lmc <- lmeControl (niterEM = 5000, msMaxIter = 1000)

f1 <- formula (Biomass ~ Treat + s (Time, by = Treat))



M.1 <-gamm (f1, random = list (fcajita = ~ 1), method = "REML", control = lmc, 
data = Acorticis)



#This first model uses the experimental box factor (i.e. fcajita) as the random 
element of the model. This random effects model assumes homogeneity between the 
experimental boxes and within them over time



M.2 <-gamm (f1, random = list (fcajita = ~ 1), method = "REML", control = lmc, 
data = Acorticis, weights = varIdent (form = ~ 1 | fcajita))



#This second model assumes heterogeneity between boxes, but homogeneity within 
each box over time



M.3 <- gamm (f1, random = list (fcajita = ~ 1), method = "REML", control = lmc, 
data = Acorticis, weights = varExp (form = ~ Time10))



#The third model assumes homogeneity between boxes but heterogeneity within 
each box over time



Finally, we decided to model the heterogeneity using the 'varComb' function in 
order to combine the variances where the model allows heterogeneity between the 
experimental boxes and heterogeneity within the experimental boxes over time:



M.4 <- gamm (f1, random = list (fcajita = ~ 1), data = Acorticis, method = 
"REML", control = lmc, weights = varComb (varIdent (form = ~ 1 | fcajita), 
varPower (form = ~ Time10)))



The first three models executed perfectly and the following values ​​of the AIC 
indicator were obtained:

> AIC (M.1 $ lme, M.2 $ lme, M.3 $ lme)



df   AIC



M.1 8379.6464



M.215309.5736



M.3 9310.4828



Unfortunately, the execution of the M.4 model failed and the following error 
message was obtained:



Error in environment (attr (ret $ lme $ modelStruct $ varStruct, "formula")) 
<-. GlobalEnv:

attempt to set an attribute on NULL



A final model I tried was M5:

M.5 <- gamm(f1, random = list(fcajita =~ 1), data = Acorticis, method = "REML", 
control = lmc, weights = varComb(varIdent(form = ~1|fcajita), varExp(form =~ 
Time10|fcajita)))

and this time I got the following error message:

Error in lme.formula(y ~ X - 1, random = rand, data = strip.offset(mf),  :

  nlminb problem, convergence error code = 1

  message = function evaluation limit reached without convergence (9)

Además: Warning message:

In logLik.reStruct(object, conLin) :

  Singular precision matrix in level -1, block 1



My question is: Could someone help me fix these problems to run the M.4 and M.5 
models?


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