Re: [R] Best settings for RStudio video recording?

2020-08-13 Thread Bert Gunter
Well then:
"Using the multi-OS RStudio for teaching R seems rather less off-topic than
that."

If the query is about teaching r, wouldn't R-Sig-teaching be the right
place to post?

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 Thu, Aug 13, 2020 at 5:11 PM Jeff Newmiller 
wrote:

> The jab about a "private company" detracted from your point. It is a
> public benefit corporation, but either way they produce open source
> software that is frequently used to introduce people to R, and the company
> management structure is irrelevant.
>
> While I would have preferred to see a question that was open to any
> presentation format, forbidding discussion of how to teach R just because
> the query happens to limit itself to RStudio seems excessively narrow to me.
>
> I have been frustrated by the fact that there is no r-sig-windows, since I
> find myself uncomfortably discussing OS-specific issues on R-help for which
> there is no better place to forward them. Using the multi-OS RStudio for
> teaching R seems rather less off-topic than that.
>
> On August 13, 2020 3:15:31 PM PDT, Bert Gunter 
> wrote:
> >Way off topic. Ask at RStudio. This is **R-Help** -- help on R
> >programming.  RStudio is a private company.
> >
> >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 Thu, Aug 13, 2020 at 3:05 PM Jonathan Greenberg 
> >wrote:
> >
> >> Folks:
> >>
> >> I was wondering if you all would suggest some helpful RStudio
> >> configurations that make recording a session via e.g. zoom the most
> >useful
> >> for students doing remote learning.  Thoughts?
> >>
> >> --j
> >>
> >> --
> >> Jonathan A. Greenberg, PhD
> >> Randall Endowed Professor and Associate Professor of Remote Sensing
> >> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
> >> Natural Resources & Environmental Science
> >> University of Nevada, Reno
> >> 1664 N Virginia St MS/0186
> >> Reno, NV 89557
> >> Phone: 415-763-5476
> >> https://www.gearslab.org/
> >>
> >> [[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.
>
> --
> 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] Best settings for RStudio video recording?

2020-08-13 Thread Jeff Newmiller
The jab about a "private company" detracted from your point. It is a public 
benefit corporation, but either way they produce open source software that is 
frequently used to introduce people to R, and the company management structure 
is irrelevant.

While I would have preferred to see a question that was open to any 
presentation format, forbidding discussion of how to teach R just because the 
query happens to limit itself to RStudio seems excessively narrow to me.

I have been frustrated by the fact that there is no r-sig-windows, since I find 
myself uncomfortably discussing OS-specific issues on R-help for which there is 
no better place to forward them. Using the multi-OS RStudio for teaching R 
seems rather less off-topic than that.

On August 13, 2020 3:15:31 PM PDT, Bert Gunter  wrote:
>Way off topic. Ask at RStudio. This is **R-Help** -- help on R
>programming.  RStudio is a private company.
>
>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 Thu, Aug 13, 2020 at 3:05 PM Jonathan Greenberg 
>wrote:
>
>> Folks:
>>
>> I was wondering if you all would suggest some helpful RStudio
>> configurations that make recording a session via e.g. zoom the most
>useful
>> for students doing remote learning.  Thoughts?
>>
>> --j
>>
>> --
>> Jonathan A. Greenberg, PhD
>> Randall Endowed Professor and Associate Professor of Remote Sensing
>> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
>> Natural Resources & Environmental Science
>> University of Nevada, Reno
>> 1664 N Virginia St MS/0186
>> Reno, NV 89557
>> Phone: 415-763-5476
>> https://www.gearslab.org/
>>
>> [[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.

-- 
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] Best settings for RStudio video recording?

2020-08-13 Thread Martin Morgan
Excellent question! I think most R courses use RStudio, so it is completely 
appropriate to ask about how to help people learn R using RStudio.

I don't have a lot experience with virtual teaching, and very limited 
experience with anything other than short-term workshops.

I think that there is tremendous value, during the 'in person' portion of a 
course, in doing interactive and even 'ad hoc' analysis, perhaps especially 
handling the off-the-wall questions that participants might raise (when I have 
to struggle to figure out what the R answer is, and then convey to the 
attendees my thinking process), and making all kinds of mistakes, including 
simple typos (requiring me to explain what the error message means, and how I 
diagnosed the problem and arrived at a solution that was other than a 
pull-it-out-of-the-hat miracle).

With this in mind, I try to increase the prominence of the console portion of 
the RStudio interface. I place it at the top left of the screen (this might be 
a remnant of in-person presentations, where the heads of people in front often 
block the view of the lines where code is being enter; this is obviously not 
relevant in a virtual context). Usually I keep the script portion of the 
display visible at the bottom left, with only a few lines showing, as a kind of 
cheat sheet for me, rather than for the students to 'follow along').

I use a large font, which I think helps in both virtual and physical sessions 
in part because it limits the amount of information on the screen, causing me 
to slow my presentation enough that the students can absorb what I am saying. 
Perhaps as a consequence of the limited screen real-estate, students often ask 
'to see the last command' so I now include in the right panel the 'History' 
tab. The division is asymmetric, so the console continues to take up the 
majority of screen real estate.

The end result of a sequence of operations is often a pretty picture, but since 
this is only the end result and not the meat of the learning experience I tend 
to keep the plot window (lower right) relatively small, and try to remember to 
expand things at the time when the end result is in sight (so to speak;)).

I hope others with more direct experience are not dissuaded by Bert's opinions, 
and offer up their own experiences or resource recommendations.

Martin Morgan

On 8/13/20, 6:05 PM, "R-help on behalf of Jonathan Greenberg" 
 wrote:

Folks:

I was wondering if you all would suggest some helpful RStudio
configurations that make recording a session via e.g. zoom the most useful
for students doing remote learning.  Thoughts?

--j

-- 
Jonathan A. Greenberg, PhD
Randall Endowed Professor and Associate Professor of Remote Sensing
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Natural Resources & Environmental Science
University of Nevada, Reno
1664 N Virginia St MS/0186
Reno, NV 89557
Phone: 415-763-5476
https://www.gearslab.org/

[[alternative HTML version deleted]]

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


Re: [R] Best settings for RStudio video recording?

2020-08-13 Thread Bert Gunter
Way off topic. Ask at RStudio. This is **R-Help** -- help on R
programming.  RStudio is a private company.

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 Thu, Aug 13, 2020 at 3:05 PM Jonathan Greenberg 
wrote:

> Folks:
>
> I was wondering if you all would suggest some helpful RStudio
> configurations that make recording a session via e.g. zoom the most useful
> for students doing remote learning.  Thoughts?
>
> --j
>
> --
> Jonathan A. Greenberg, PhD
> Randall Endowed Professor and Associate Professor of Remote Sensing
> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
> Natural Resources & Environmental Science
> University of Nevada, Reno
> 1664 N Virginia St MS/0186
> Reno, NV 89557
> Phone: 415-763-5476
> https://www.gearslab.org/
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


[R] Best settings for RStudio video recording?

2020-08-13 Thread Jonathan Greenberg
Folks:

I was wondering if you all would suggest some helpful RStudio
configurations that make recording a session via e.g. zoom the most useful
for students doing remote learning.  Thoughts?

--j

-- 
Jonathan A. Greenberg, PhD
Randall Endowed Professor and Associate Professor of Remote Sensing
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Natural Resources & Environmental Science
University of Nevada, Reno
1664 N Virginia St MS/0186
Reno, NV 89557
Phone: 415-763-5476
https://www.gearslab.org/

[[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] rNOMAD package

2020-08-13 Thread Roy Mendelssohn - NOAA Federal via R-help


Hi Philip:

Both 'ncdf4' and 'Rnetcdf' should be able to download data using OPeNDAP.  That 
the package is using OPeNDAP is transparent to the user,  other than the fact 
that the "file" is an URL.  Extracts are just like reading a netCDF file using 
these packages,  so you may have to spend some time learning how to do that.

It is possible that 'tidnyNC' can also do OPeNDAP,  I am just not certain that.

-Roy

> On Aug 13, 2020, at 8:59 AM, Philip  wrote:
> 
> Daniel Bowman wrote a wonderful package to access National Weather Service 
> data with R.
> 
> Unfortunately I stuck trying to download archived Rapid Update Forecasts 
> (RAP) going back into 2016.  I have been poking around on the Internet for 
> days but keep getting recycled to three or four websites that assume a 
> certain level of background knowledge that I don’t have.  It has something to 
> do with OPenDAP (Data Access Protocol) which is a piece of software to grab 
> data over the Internet.
> 
> Can someone give me some direction?
> 
> Thanks,
> Philip
>   [[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.

**
"The contents of this message do not reflect any position of the U.S. 
Government or NOAA."
**
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: roy.mendelss...@noaa.gov www: https://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

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

2020-08-13 Thread Philip
Daniel Bowman wrote a wonderful package to access National Weather Service data 
with R.

Unfortunately I stuck trying to download archived Rapid Update Forecasts (RAP) 
going back into 2016.  I have been poking around on the Internet for days but 
keep getting recycled to three or four websites that assume a certain level of 
background knowledge that I don’t have.  It has something to do with OPenDAP 
(Data Access Protocol) which is a piece of software to grab data over the 
Internet.

Can someone give me some direction?

Thanks,
Philip
[[alternative HTML version deleted]]

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


Re: [R] R 3.6.1 for MAC

2020-08-13 Thread Ivan Krylov
Dear Elena,

On Thu, 13 Aug 2020 09:00:10 +0300
Elena Ivanova  wrote:

> Could you please let me know where to find the Version 3.6.1 for MAC
> since I have a package only working with this version

Short answer: perhaps
https://cran.r-project.org/bin/macosx/el-capitan/base/R-3.6.1.pkg would
work?

R-Help is about R programming, not installation of R on macOS, so if the
link above does not help you, please ask in the R-SIG-Mac mailing list:
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

-- 
Best regards,
Ivan

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


[R] R 3.6.1 for MAC

2020-08-13 Thread Elena Ivanova
Dear Sir/Madame, 
Could you please let me know where to find the Version 3.6.1 for MAC since I 
have a package only working with this version

Unfortunately I can not find it here

https://cran.r-project.org/bin/macosx/




Elena Ivanova
PhD Student
elena.ivan...@hu-berlin.de




[[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] stacked bar on single-color printing

2020-08-13 Thread Greg Snow
While it is possible to fill bars with patterns, it is not
recommended.  Fill patterns can lead to what is called the Moire
effect and other optical illusions.  Depending on the fill patterns
and how they relate to each other this can cause an illusion of
movement within the plot, straight lines appearing curved, and
distorting of lengths/positions.  Fill patterns (through the
illusions) can subtly move the observer's eye away from the important
parts of a graph and make it hard to focus on the parts of the graph
that are most important.  Google for phrases "Moire effect graphs" and
"optical illusion diagonal lines" for some examples.

Perhaps a dot chart (using symbols instead of colors/greyscale/fill
patterns) would be a better option than a bar chart for your case.

On Thu, Aug 13, 2020 at 7:21 AM John  wrote:
>
> Thanks Rui. That's very close to what I am looking for. You use gray scales
> for different categories. That would be a great idea. Could we use pattern
> fill?
> Rui Barradas  於 2020年8月13日 週四 下午6:31寫道:
>
> > Hello,
> >
> > Without sample data and the code you've tried it's difficult to say but
> > are you looking for something like this?
> >
> >
> > set.seed(2020)
> > df1 <- expand.grid(X = factor(1:5), Y = LETTERS[1:2])
> > df1 <- df1[sample(nrow(df1), 100, TRUE), ]
> >
> > library(ggplot2)
> >
> > tbl <- as.data.frame(table(df1))
> >
> > ggplot(tbl, aes(X, Freq, color = Y, fill = Y)) +
> >geom_col() +
> >scale_color_manual(values = c("black", "black")) +
> >scale_fill_manual(values = c("white", "gray70")) +
> >theme_bw()
> >
> >
> > Hope this helps,
> >
> > Rui Barradas
> >
> > Às 10:05 de 13/08/20, John escreveu:
> > > Hi,
> > >
> > > I would like to create percentage stacked bar with graphics package
> > > (e.g., ggplot2) and print it in white/black. The regular option is to use
> > > different color on the bar. Is there any way to use different background
> > on
> > > a bar so that we can tell on a black/white printing? For example, let my
> > > green correspond to ***, while my red correspond to 
> > >
> > > Thanks,
> > >
> > > J
> > >
> > >   [[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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

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


Re: [R] stacked bar on single-color printing

2020-08-13 Thread Rui Barradas

Hello,

In base graphics function barplot has arguments angle and density, see 
the help page ?barplot. As an example, with the same data (note that the 
argument density is recycled, 2 values, one per stacked bar times the 
number of unique X vakues):



barplot(Freq ~ Y + X, tbl, density = c(10, 0))


Hope this helps,

Rui Barradas

Às 14:27 de 13/08/20, John escreveu:
Thanks Rui. That's very close to what I am looking for. You use gray 
scales for different categories. That would be a great idea. Could we 
use pattern fill?
Rui Barradas mailto:ruipbarra...@sapo.pt>> 於 
2020年8月13日 週四 下午6:31寫道:


Hello,

Without sample data and the code you've tried it's difficult to say but
are you looking for something like this?


set.seed(2020)
df1 <- expand.grid(X = factor(1:5), Y = LETTERS[1:2])
df1 <- df1[sample(nrow(df1), 100, TRUE), ]

library(ggplot2)

tbl <- as.data.frame(table(df1))

ggplot(tbl, aes(X, Freq, color = Y, fill = Y)) +
    geom_col() +
    scale_color_manual(values = c("black", "black")) +
    scale_fill_manual(values = c("white", "gray70")) +
    theme_bw()


Hope this helps,

Rui Barradas

Às 10:05 de 13/08/20, John escreveu:
 > Hi,
 >
 >     I would like to create percentage stacked bar with graphics
package
 > (e.g., ggplot2) and print it in white/black. The regular option
is to use
 > different color on the bar. Is there any way to use different
background on
 > a bar so that we can tell on a black/white printing? For example,
let my
 > green correspond to ***, while my red correspond to 
 >
 >     Thanks,
 >
 > J
 >
 >       [[alternative HTML version deleted]]
 >
 > __
 > R-help@r-project.org  mailing list
-- To UNSUBSCRIBE and more, see
 > https://stat.ethz.ch/mailman/listinfo/r-help
 > PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
 > and provide commented, minimal, self-contained, reproducible code.
 >



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


Re: [R] date conversion problem

2020-08-13 Thread Abdoulaye Sarr
Hi Jim,

Thanks for the hint, that makes sense and I'll arrange accordingly.
Best regards,
Abdoulaye

On Thu, Aug 13, 2020 at 8:38 AM Jim Lemon  wrote:

> Hi Abdoulaye,
> It looks to me as though your offsets are in hours, not days. You can
> get a rough date like this:
>
> time<-c(1569072,1569096,1569120,1569144,
>  1569168,1569192,1569216,1569240)
> time_d<-as.Date("1800-01-01")+time/24
> time_d
> [1] "1979-01-01" "1979-01-02" "1979-01-03" "1979-01-04" "1979-01-05"
> [6] "1979-01-06" "1979-01-07" "1979-01-08"
>
> Jim
>
> On Thu, Aug 13, 2020 at 6:10 PM Abdoulaye Sarr 
> wrote:
> >
> > I have dataset with time sine 1800-01-01 and extracted data from 1981 to
> > 2019 and used these lines for the data conversion:
> > > time_d <- as.Date(time, format="%j", origin=as.Date("1800-01-01"))
> > > time_years <- format(time_d, "%Y")
> > > time_months <- format(time_d, "%m")
> > > time_year_months <- format(time_d, "%Y-%m")
> > > head(time_d)
> > [1] "6095-12-22" "6096-01-15" "6096-02-08" "6096-03-03" "6096-03-27"
> > "6096-04-20"
> >
> > As you see these gregorian dates are unrealistic and wonder what I am
> doing
> > wrong?
> > The time from the raw file in Jd are like this:
> >
> > > time
> >[1] 1569072 1569096 1569120 1569144 1569168 1569192 1569216
> 1569240etc.
> >
> > Hope hint and/or suggestion to solve this.
> >
> > Best regards
> >
> > [[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] stacked bar on single-color printing

2020-08-13 Thread John
Thanks Rui. That's very close to what I am looking for. You use gray scales
for different categories. That would be a great idea. Could we use pattern
fill?
Rui Barradas  於 2020年8月13日 週四 下午6:31寫道:

> Hello,
>
> Without sample data and the code you've tried it's difficult to say but
> are you looking for something like this?
>
>
> set.seed(2020)
> df1 <- expand.grid(X = factor(1:5), Y = LETTERS[1:2])
> df1 <- df1[sample(nrow(df1), 100, TRUE), ]
>
> library(ggplot2)
>
> tbl <- as.data.frame(table(df1))
>
> ggplot(tbl, aes(X, Freq, color = Y, fill = Y)) +
>geom_col() +
>scale_color_manual(values = c("black", "black")) +
>scale_fill_manual(values = c("white", "gray70")) +
>theme_bw()
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 10:05 de 13/08/20, John escreveu:
> > Hi,
> >
> > I would like to create percentage stacked bar with graphics package
> > (e.g., ggplot2) and print it in white/black. The regular option is to use
> > different color on the bar. Is there any way to use different background
> on
> > a bar so that we can tell on a black/white printing? For example, let my
> > green correspond to ***, while my red correspond to 
> >
> > Thanks,
> >
> > J
> >
> >   [[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] Error with sf ordinary kriging after creating grid

2020-08-13 Thread Bert Gunter
You should post on r-sig-geo, not here. The specific expertise you seek is
much more likely to be found there.

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 Thu, Aug 13, 2020 at 4:09 AM Nicola Gambaro  wrote:

> I want to perform ordinary kriging of temperature (UTCI) data in Nigeria
> with sf and gstat packages. However, after fitting the variogram model and
> creating a grid for the region, the krige function returns this error:
>
> Error in (function (classes, fdef, mtable)  :
>   unable to find an inherited method for function ‘krige’ for signature
> ‘"formula", "sfc_POINT"’
> What am I doing wrong? Here is my code:
>
> library(gstat)
> library(sf)
> sf_data <- st_as_sf(x = data, coords = c("longitude", "latitude"), crs =
> 4326)
>
> #VARIOGRAM
> vgm_utci <- variogram(UTCI~1, sf_data)
> utci_fit <- fit.variogram(vgm_utci, vgm("Mat"), fit.kappa = TRUE)
>
> #CREATE GRID
> nigeria <- read_sf("./Igismap/Nigeria_Boundary.shp")
> nigeria <- nigeria$geometry
> nigeria.grid <- nigeria %>%
>   st_make_grid(cellsize = 0.1, what = "centers") %>%
>   st_intersection(nigeria)
>
> #UTCI ORDINARY KRIGING
> utci_krig <- krige(formula = sf_data$UTCI ~ 1, nigeria.grid, model =
> utci_fit)
> When plotted, the grid and the variogram model look fine. I have attached
> data and shapefile. Thank you so much in advance,
>
> Nicola
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


[R] Error with sf ordinary kriging after creating grid

2020-08-13 Thread Nicola Gambaro
I want to perform ordinary kriging of temperature (UTCI) data in Nigeria with 
sf and gstat packages. However, after fitting the variogram model and creating 
a grid for the region, the krige function returns this error:

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘krige’ for signature 
‘"formula", "sfc_POINT"’
What am I doing wrong? Here is my code:

library(gstat)
library(sf)  
sf_data <- st_as_sf(x = data, coords = c("longitude", "latitude"), crs = 4326)

#VARIOGRAM  
vgm_utci <- variogram(UTCI~1, sf_data)
utci_fit <- fit.variogram(vgm_utci, vgm("Mat"), fit.kappa = TRUE)
   
#CREATE GRID
nigeria <- read_sf("./Igismap/Nigeria_Boundary.shp")
nigeria <- nigeria$geometry
nigeria.grid <- nigeria %>% 
  st_make_grid(cellsize = 0.1, what = "centers") %>%
  st_intersection(nigeria)

#UTCI ORDINARY KRIGING
utci_krig <- krige(formula = sf_data$UTCI ~ 1, nigeria.grid, model = utci_fit)
When plotted, the grid and the variogram model look fine. I have attached data 
and shapefile. Thank you so much in advance,

Nicola
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] stacked bar on single-color printing

2020-08-13 Thread Rui Barradas

Hello,

Without sample data and the code you've tried it's difficult to say but 
are you looking for something like this?



set.seed(2020)
df1 <- expand.grid(X = factor(1:5), Y = LETTERS[1:2])
df1 <- df1[sample(nrow(df1), 100, TRUE), ]

library(ggplot2)

tbl <- as.data.frame(table(df1))

ggplot(tbl, aes(X, Freq, color = Y, fill = Y)) +
  geom_col() +
  scale_color_manual(values = c("black", "black")) +
  scale_fill_manual(values = c("white", "gray70")) +
  theme_bw()


Hope this helps,

Rui Barradas

Às 10:05 de 13/08/20, John escreveu:

Hi,

I would like to create percentage stacked bar with graphics package
(e.g., ggplot2) and print it in white/black. The regular option is to use
different color on the bar. Is there any way to use different background on
a bar so that we can tell on a black/white printing? For example, let my
green correspond to ***, while my red correspond to 

Thanks,

J

[[alternative HTML version deleted]]

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



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


[R] Binomial PCA Using pcr()

2020-08-13 Thread Prasad DN
Hi All,

i am very new to R and need guidance.

Need help in doing process capability Analysis for my data set (6 months of
data) given in below format:

Date   |   Opportunities  |  Defectives | DefectivesInPercent

I searched and found that pcr() from QualityTools package can be used for
this purpose.  The USL is 2% defectives.

MyData = read.csv(file.choose())   #select  CSV file that has data in above
mentioned format.
x <- MyData$DefectivesInPercent

pcr(x, distribution = "negative-binomial", usl=0.02)

I get error message as:
Error in pcr(x, distribution = "negative-binomial", usl = 0.02) :
  y distribution could not be found!

Please advise, how to proceed?

Regards,
Prasad DN

[[alternative HTML version deleted]]

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


[R] stacked bar on single-color printing

2020-08-13 Thread John
Hi,

   I would like to create percentage stacked bar with graphics package
(e.g., ggplot2) and print it in white/black. The regular option is to use
different color on the bar. Is there any way to use different background on
a bar so that we can tell on a black/white printing? For example, let my
green correspond to ***, while my red correspond to 

   Thanks,

J

[[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] date conversion problem

2020-08-13 Thread Jim Lemon
Hi Abdoulaye,
It looks to me as though your offsets are in hours, not days. You can
get a rough date like this:

time<-c(1569072,1569096,1569120,1569144,
 1569168,1569192,1569216,1569240)
time_d<-as.Date("1800-01-01")+time/24
time_d
[1] "1979-01-01" "1979-01-02" "1979-01-03" "1979-01-04" "1979-01-05"
[6] "1979-01-06" "1979-01-07" "1979-01-08"

Jim

On Thu, Aug 13, 2020 at 6:10 PM Abdoulaye Sarr  wrote:
>
> I have dataset with time sine 1800-01-01 and extracted data from 1981 to
> 2019 and used these lines for the data conversion:
> > time_d <- as.Date(time, format="%j", origin=as.Date("1800-01-01"))
> > time_years <- format(time_d, "%Y")
> > time_months <- format(time_d, "%m")
> > time_year_months <- format(time_d, "%Y-%m")
> > head(time_d)
> [1] "6095-12-22" "6096-01-15" "6096-02-08" "6096-03-03" "6096-03-27"
> "6096-04-20"
>
> As you see these gregorian dates are unrealistic and wonder what I am doing
> wrong?
> The time from the raw file in Jd are like this:
>
> > time
>[1] 1569072 1569096 1569120 1569144 1569168 1569192 1569216 1569240etc.
>
> Hope hint and/or suggestion to solve this.
>
> Best regards
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] date conversion problem

2020-08-13 Thread Abdoulaye Sarr
I have dataset with time sine 1800-01-01 and extracted data from 1981 to
2019 and used these lines for the data conversion:
> time_d <- as.Date(time, format="%j", origin=as.Date("1800-01-01"))
> time_years <- format(time_d, "%Y")
> time_months <- format(time_d, "%m")
> time_year_months <- format(time_d, "%Y-%m")
> head(time_d)
[1] "6095-12-22" "6096-01-15" "6096-02-08" "6096-03-03" "6096-03-27"
"6096-04-20"

As you see these gregorian dates are unrealistic and wonder what I am doing
wrong?
The time from the raw file in Jd are like this:

> time
   [1] 1569072 1569096 1569120 1569144 1569168 1569192 1569216 1569240etc.

Hope hint and/or suggestion to solve this.

Best regards

[[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] add trailing dates with rbind

2020-08-13 Thread PIKAL Petr
Hi

I am not sure if I understand correctly. You want to change starting days to 
some common value?

It seems to me that you actually want start at zero date and continue in each 
dataset regardless of actual starting date. If it is the case, I would use day 
numbers like in these examples

> x <- seq(as.Date("2020-03-01"), by=1,length.out=20)
> x-x[1]
Time differences in days
 [1]  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19
> y <- seq(as.Date("2020-03-01"), by=2,length.out=10)
> y-y[1]
Time differences in days
 [1]  0  2  4  6  8 10 12 14 16 18
> z <- seq(as.Date("2019-03-01"), by=2,length.out=50)
> z -z[1]
Time differences in days
 [1]  0  2  4  6  8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48
[26] 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98
>

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of Frederik Feys
> Sent: Wednesday, August 12, 2020 1:44 PM
> To: R-help 
> Subject: [R] add trailing dates with rbind
> 
> I am having a hell of a time, this must surely be simple to solve….
> 
> Basically I want to add trailing dates to datasets with differing starting 
> dates
> so that across datasets I have the same starting date.
> 
> # make dataset with the same starting date
> start_date = as.Date("2020-03-01")
> d_start_date = min(agg_d_h$Group.date)
> 
> diff_in_days = as.numeric(difftime(d_start_date, start_date, units = "days"))
> 
> for(i in 1:diff_in_days) {
>   next_date  = start_date+i
>   app_d <- rbind(agg_d_h, c(next_date, 0) )
> }
> 
> gives:
> Error in as.Date.numeric(value) : 'origin' must be supplied
> 
> Thank you for your time to help me!
> 
> Frederik Feys
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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.