Re: [R] ggarrange & legend

2024-02-05 Thread John Kane
Blast it hit send by accident. Anyway the code above is a WWE.

I don't see any obvious way no move the legend


On Mon, 5 Feb 2024 at 09:13, John Kane  wrote:

> I'm sorry but that is not a working example.
>
> A working example needs to create the plots being used.
>
> For example, stealing some code from
> https://rpkgs.datanovia.com/ggpubr/reference/ggarrange.html
> #=
>
> data <https://rdrr.io/r/utils/data.html>("ToothGrowth")df <- 
> ToothGrowthdf$dose <- as.factor 
> <https://rdrr.io/r/base/factor.html>(df$dose)# Box plotbxp <- ggboxplot 
> <https://rpkgs.datanovia.com/ggpubr/reference/ggboxplot.html>(df, x = "dose", 
> y = "len",color = "dose", palette = "jco")# Density plotdens <- ggdensity 
> <https://rpkgs.datanovia.com/ggpubr/reference/ggdensity.html>(df, x = "len", 
> fill = "dose", palette = "jco")
>
> mylist<-list(bxp, dens)
>
> dev.new(width=28, height=18)
>
> fig1<- ggarrange(plotlist=mylist, common.legend = TRUE, legend="top", labels 
> = c("(A)", "(B)"), font.label = list(size = 18, color = "black"), ncol=2)
>
> fig1
> #=
>
>
> On Mon, 5 Feb 2024 at 08:44,  wrote:
>
>> Dear John Kane
>>
>> Dear R community
>>
>>
>>
>> Here my working example
>>
>>1. Example that is working with legend=”top”. However, as mentioned,
>>the legend is in the middle of the top axis.
>>
>> mylist<-list(p1, p2)
>>
>> dev.new(width=28, height=18)
>>
>> fig1<- ggarrange(plotlist=mylist, common.legend = TRUE, legend="top",
>> labels = c("(A)", "(B)"), font.label = list(size = 18, color = "black"),
>> ncol=2)
>>
>> fig1
>>
>>
>>
>>1. My question is how I can position the legend on the topright of
>>the top axis. However, “topright” is not a common label for legend in
>>ggarrange (but in other plot functions), so legend =”topright” is not
>>working.
>>
>> mylist<-list(p1, p2)
>>
>> dev.new(width=28, height=18)
>>
>> fig1<- ggarrange(plotlist=mylist, common.legend = TRUE,
>> legend="topright", labels = c("(A)", "(B)"), font.label = list(size = 18,
>> color = "black"), ncol=2)
>>
>> fig1
>>
>>
>>
>> Kind regards
>>
>> Sibylle
>>
>>
>>
>> *From:* John Kane 
>> *Sent:* Monday, February 5, 2024 1:59 PM
>> *To:* sibylle.stoec...@gmx.ch
>> *Cc:* r-help@r-project.org
>> *Subject:* Re: [R] ggarrange & legend
>>
>>
>>
>> Could you supply us with a MWE (minimal working example)of what you have
>> so far?
>>
>> Thanks.
>>
>>
>>
>> On Mon, 5 Feb 2024 at 05:00, SIBYLLE STÖCKLI via R-help <
>> r-help@r-project.org> wrote:
>>
>> Dear R community
>>
>> It is possible to adjust the legend in combined ggplots using ggarrange
>> with
>> be positions top, bottom, left and right.
>> My question: Is there a function to change the position of the legend to
>> topright or bottomleft? Right and top etc are in the middle of the axis.
>>
>> Kind regards
>> Sibylle
>>
>> __
>> 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.
>>
>>
>>
>> --
>>
>> John Kane
>> Kingston ON Canada
>>
>
>
> --
> John Kane
> Kingston ON Canada
>


-- 
John Kane
Kingston ON Canada

[[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] ggarrange & legend

2024-02-05 Thread John Kane
I'm sorry but that is not a working example.

A working example needs to create the plots being used.

For example, stealing some code from
https://rpkgs.datanovia.com/ggpubr/reference/ggarrange.html
#=

data <https://rdrr.io/r/utils/data.html>("ToothGrowth")df <-
ToothGrowthdf$dose <- as.factor
<https://rdrr.io/r/base/factor.html>(df$dose)# Box plotbxp <-
ggboxplot <https://rpkgs.datanovia.com/ggpubr/reference/ggboxplot.html>(df,
x = "dose", y = "len",color = "dose", palette = "jco")# Density
plotdens <- ggdensity
<https://rpkgs.datanovia.com/ggpubr/reference/ggdensity.html>(df, x =
"len", fill = "dose", palette = "jco")

mylist<-list(bxp, dens)

dev.new(width=28, height=18)

fig1<- ggarrange(plotlist=mylist, common.legend = TRUE, legend="top",
labels = c("(A)", "(B)"), font.label = list(size = 18, color =
"black"), ncol=2)

fig1
#=


On Mon, 5 Feb 2024 at 08:44,  wrote:

> Dear John Kane
>
> Dear R community
>
>
>
> Here my working example
>
>1. Example that is working with legend=”top”. However, as mentioned,
>the legend is in the middle of the top axis.
>
> mylist<-list(p1, p2)
>
> dev.new(width=28, height=18)
>
> fig1<- ggarrange(plotlist=mylist, common.legend = TRUE, legend="top",
> labels = c("(A)", "(B)"), font.label = list(size = 18, color = "black"),
> ncol=2)
>
> fig1
>
>
>
>1. My question is how I can position the legend on the topright of the
>top axis. However, “topright” is not a common label for legend in ggarrange
>(but in other plot functions), so legend =”topright” is not working.
>
> mylist<-list(p1, p2)
>
> dev.new(width=28, height=18)
>
> fig1<- ggarrange(plotlist=mylist, common.legend = TRUE, legend="topright",
> labels = c("(A)", "(B)"), font.label = list(size = 18, color = "black"),
> ncol=2)
>
> fig1
>
>
>
> Kind regards
>
> Sibylle
>
>
>
> *From:* John Kane 
> *Sent:* Monday, February 5, 2024 1:59 PM
> *To:* sibylle.stoec...@gmx.ch
> *Cc:* r-help@r-project.org
> *Subject:* Re: [R] ggarrange & legend
>
>
>
> Could you supply us with a MWE (minimal working example)of what you have
> so far?
>
> Thanks.
>
>
>
> On Mon, 5 Feb 2024 at 05:00, SIBYLLE STÖCKLI via R-help <
> r-help@r-project.org> wrote:
>
> Dear R community
>
> It is possible to adjust the legend in combined ggplots using ggarrange
> with
> be positions top, bottom, left and right.
> My question: Is there a function to change the position of the legend to
> topright or bottomleft? Right and top etc are in the middle of the axis.
>
> Kind regards
> Sibylle
>
> __
> 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.
>
>
>
> --
>
> John Kane
> Kingston ON Canada
>


-- 
John Kane
Kingston ON Canada

[[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] ggarrange & legend

2024-02-05 Thread John Kane
Could you supply us with a MWE (minimal working example)of what you have so
far?
Thanks.

On Mon, 5 Feb 2024 at 05:00, SIBYLLE STÖCKLI via R-help <
r-help@r-project.org> wrote:

> Dear R community
>
> It is possible to adjust the legend in combined ggplots using ggarrange
> with
> be positions top, bottom, left and right.
> My question: Is there a function to change the position of the legend to
> topright or bottomleft? Right and top etc are in the middle of the axis.
>
> Kind regards
> Sibylle
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] DrDimont package in R

2024-02-05 Thread John Kane
Nothing got through.  Try plain text rather than HTML.

On Mon, 5 Feb 2024 at 06:04, Anas Jamshed  wrote:

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


-- 
John Kane
Kingston ON Canada

[[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] arrow on contour line

2024-01-12 Thread John Kane
Something like this shodld worx.  You will need to fiddle around with the
actual co-ordinates etc. I just stuck an arrow in what seemed like a handy
place

On Wed, 10 Jan 2024 at 19:13, Deepankar Basu  wrote:

> Hello,
>
> I am drawing contour lines for a function of 2 variables at one level of
> the value of the function and want to include a small arrow in any
> direction of increase of the function. Is there some way to do that?
>
> Below is an example that creates the contour lines. How do I add one small
> arrow on each line in the direction of increase of the function (at some
> central point of the contour line)? Any direction will do, but perhaps the
> direction of the gradient will be the best.
>
> Thanks in advance.
> DB
>
> 
>
> library(tidyverse)
>
> x <- seq(1,2,length.out=100)
> y <- seq(1,2,length.out=100)
>
> myf <- function(x,y) {x*y}
> myg <- function(x,y) {x^2 + y^2}
>
> d1 <- expand.grid(X1 = x, X2 = y) %>%
>   mutate(Z = myf(X1,X2)) %>%
>   as.data.frame()
>
> d2 <- expand.grid(X1 = x, X2 = y) %>%
>   mutate(Z = myg(X1,X2)) %>%
>   as.data.frame()
>
> ggplot(data = d1, aes(x=X1,y=X2,z=Z))+
>   stat_contour(breaks = c(2)) +
>   stat_contour(data=d2, aes(x=X1,y=X2,z=Z), breaks=c(6))
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Truncated plots

2024-01-09 Thread John Kane
If it looks to be a very specific RStudio/ggplot2 problem then
https://community.rstudio.com is probably the place to ask.

What happens if she does as Duncan suggests or if she exports the file?

Come to think of it, is she getting the same result if she clicks on Zoom
in the plot window? The standard plot window in RStudio can distort the
actual image due to size restrictions.

On Tue, 9 Jan 2024 at 12:47, Ivan Krylov via R-help 
wrote:

> В Tue, 9 Jan 2024 16:42:32 +
> Nick Wray  пишет:
>
> > she has a problem with R studio on her laptop
>
> Does the problem happen with plain R, without Rstudio?
>
> What's the student's sessionInfo()?
>
> > I have a screenshot which could email if anyone needs to see what it
> > looks like.
>
> I think that PNG screenshots are allowed on the mailing list, so it
> could be very helpful if you attached an appropriately cropped
> screenshot.
>
> --
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] adding "Page X of XX" to PDFs

2023-12-02 Thread John Kane
https://community.rstudio.com/t/total-number-of-pages-in-quarto-pdf/177316/2

On Sat, 2 Dec 2023 at 09:39, Dennis Fisher  wrote:

> OS X
> R 4.3.1
>
> Colleagues
>
> I often create multipage PDFs [pdf()] in which the text "Page X" appears
> in the margin.  These PDFs are created automatically using a massive R
> script.
>
> One of my clients requested that I change this to:
> Page X of XX
> where XX is the total number of pages.
>
> I don't know the number of expected pages so I can't think of any clever
> way to do this.  I suppose that I could create the PDF, find out the number
> of pages, then have a second pass in which the R script was fed the number
> of pages.  However, there is one disadvantage to this -- the original PDF
> contains a timestamp on each page -- the new version would have a different
> timestamp -- so I would prefer to not use this approach.
>
> Has anyone thought of some terribly clever way to solve this problem?
>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone / Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.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.
>


-- 
John Kane
Kingston ON Canada

[[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] ggplot adjust two y-axis

2023-11-24 Thread John Kane
https://r-graph-gallery.com/line-chart-dual-Y-axis-ggplot2.html

On Fri, 24 Nov 2023 at 12:08, Charles-Édouard Giguère 
wrote:

> Hi,
> Just find a scaling factor that would make the two sets of data comparable.
> Here I divided the second row by 5 and did the same for the second axis.
> Charles-Édouard
> F1 <- as.table(matrix(c(50,11,6,17,16,3,1,2237,611,403,240,280,0,0), 2,7))
> barplot(F1, beside = TRUE, col = c("blue", "grey")) axis(2,
> at=c(0,10,20,30,40,50,60, labels=c(0,10,20,30,40,50,60))) axis(4, at =
> c(0,500,1000,1500,2000,2500), labels =
> c(0,500,1000,1500,2000,2500))
>
> -Message d'origine-
> De : sibylle.stoec...@gmx.ch 
> Envoyé : 24 novembre 2023 11:27
> À : 'Charles-Édouard Giguère' ; r-help@r-project.org
> Objet : RE: [R] ggplot adjust two y-axis
>
> Dear Charles-Edouard
>
> Thanks a lot. Yes indeed barplot sounds excellent.
>
> Unfortunately, the scale of the smaller axis is fixed, even If I am able to
> draw to axes. The idea is to expand the scale to the scale to the second
> axis for comparison.
> F1 <- as.table(matrix(c(50,11,6,17,16,3,1,2237,611,403,240,280,0,0), 2,7))
> barplot(F1, beside = TRUE, col = c("blue", "grey")) axis(2,
> at=c(0,10,20,30,40,50,60, labels=c(0,10,20,30,40,50,60))) axis(4, at =
> c(0,500,1000,1500,2000,2500), labels =
> c(0,500,1000,1500,2000,2500))
>
> Kind regards
> Sibylle
>
>
> -Original Message-
> From: Charles-Édouard Giguère 
> Sent: Friday, November 24, 2023 3:57 PM
> To: sibylle.stoec...@gmx.ch; r-help@r-project.org
> Subject: RE: [R] ggplot adjust two y-axis
>
> Hi,
>  I don't know the axis mecanism well enough in ggplot but using the
> original
> barplot function you can add an axis on the right using the axis function.
>
> Here is an example:
>
> test <- as.table(matrix(c(2,10,3,11), 2,2)) barplot(test, beside = TRUE,
> col
> = scales::brewer_pal(palette = 1)(2)) axis(4, at = c(0, 5,  10), labels =
> c(0,50,100))
>
>
> -Message d'origine-
> De : sibylle.stoec...@gmx.ch  Envoyé : 24
> novembre
> 2023 09:27 À : 'Charles-Édouard Giguère' ;
> r-help@r-project.org Objet : RE: [R] ggplot adjust two y-axis
>
> Dear Charles-Edouard
>
> Thanks a lot.
> So no way in R to just simply have one ggplot with to axis as in Excel
> (attachment)?
>
> Kind regards
> Sibylle
>
> -Original Message-
> From: Charles-Édouard Giguère 
> Sent: Friday, November 24, 2023 3:14 PM
> To: sibylle.stoec...@gmx.ch; r-help@r-project.org
> Subject: RE: [R] ggplot adjust two y-axis
>
> You could also use more simply facet_wrap(~ Studien_Flaeche).
> Charles-Édouard
>
> -Message d'origine-
> De : Charles-Édouard Giguère  Envoyé : 24 novembre
> 2023 09:11 À : sibylle.stoec...@gmx.ch; r-help@r-project.org Objet : RE:
> [R]
> ggplot adjust two y-axis
>
> Hi Sibylle,
> For that kind of data with two different scales, I generally use two graphs
> that I name gg1 and gg2 and join them using gridExtra::grid.arrange(gg1,
> gg2). This way, the red part of your graph is easier to interpret.
> Have a nice day,
> Charles-Édouard
>
> -Message d'origine-
> De : R-help  De la part de
> sibylle.stoec...@gmx.ch Envoyé : 24 novembre 2023 05:52 À :
> r-help@r-project.org Objet : [R] ggplot adjust two y-axis
>
> Dear R-users
>
> Is it possible to adjust two y-axis in a ggplot differently?
> - First y axis (0-60)
> - Second y axis (0-2500)
>
>
> ### Figure 1
> ggplot(Fig1,aes(BFF,Wert,fill=Studien_Flaeche))+
>   geom_bar(stat="identity",position='dodge')+
>   scale_y_continuous(name="First Axis", sec.axis=sec_axis(trans=~.*50,
> name="Second Axis"))+
>   scale_fill_brewer(palette="Set1")
>
> Thanks a lot
> Sibylle
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Can someone please have a look at this query on stackoverflow?

2023-11-14 Thread John Kane
I ran the code from the answer and it seems to work well. It, definitely,
is giving a landscape output.

---
title: "Testing landscape and aspect ratio"
output:
  pdf_document:
number_sections: true
classoption:
  - landscape
  - "aspectratio=169"
header-includes:
   - \usepackage{dcolumn}
documentclass: article
geometry: margin=1.5cm---

```{r, out.extra='keepaspectratio=true', out.height='100%', out.width="100%"}
plot(rnorm(100))
```




On Mon, 13 Nov 2023 at 23:33, Ashim Kapoor  wrote:

> Dear all,
>
> I have posted a query which has received a response but that is not
> working on my computer.
>
> Here is the query:
>
>
> https://stackoverflow.com/questions/77387434/pdf-from-rmarkdown-landscape-and-aspectratio-169
>
> Can someone please help me ?
>
> Best Regards,
> Ashim
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada


landscape.pdf
Description: Adobe PDF document
__
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] Grouping by Date and showing count of failures by date

2023-09-30 Thread John Kane
To follow up on Rui Barradas's post, I do not think PivotTable is an R
command.

You may be thinking og the "pivot_longer" and "pivot_wider" functions in
the {tidyr} package which is part of {tidyverse}.

On Sat, 30 Sept 2023 at 07:03, Rui Barradas  wrote:

> Às 21:29 de 29/09/2023, Paul Bernal escreveu:
> > Dear friends,
> >
> > Hope you are doing great. I am attaching the dataset I am working with
> > because, when I tried to dput() it, I was not able to copy the entire
> > result from dput(), so I apologize in advance for that.
> >
> > I am interested in creating a column named Failure_Date_Period that has
> the
> > FAILDATE but formatted as _MM. Then I want to count the number of
> > failures (given by column WONUM) and just have a dataframe that has the
> > FAILDATE and the count of WONUM.
> >
> > I tried this:
> > pt <- PivotTable$new()
> > pt$addData(failuredf)
> > pt$addColumnDataGroups("FAILDATE")
> > pt <- PivotTable$new()
> > pt$addData(failuredf)
> > pt$addColumnDataGroups("FAILDATE")
> > pt$defineCalculation(calculationName = "FailCounts",
> > summariseExpression="n()")
> > pt$renderPivot()
> >
> > but I was not successful. Bottom line, I need to create a new dataframe
> > that has the number of failures by FAILDATE, but in -MM format.
> >
> > Any help and/or guidance will be greatly appreciated.
> >
> > Kind regards,
> > Paul
> > __
> > 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.
> Hello,
>
> No data is attached. Maybe try
>
> dput(head(failuredf, 30))
>
> ?
>
> And where can we find non-base PivotTable? Please start the scripts with
> calls to library() when using non-base functionality.
>
> Hope this helps,
>
> Rui Barradas
>
>
> --
> Este e-mail foi analisado pelo software antivírus AVG para verificar a
> presença de vírus.
> www.avg.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.
>


-- 
John Kane
Kingston ON Canada

[[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 coding errors

2023-09-08 Thread John Kane
Can you supply us with some sample data?

 A handy way to supply some sample data is the dput() function.  In the
case of a large dataset something like dput(head(mydata, 100)) should
supply the data we need. Just do dput(mydata) where *mydata* is your data.
Copy the output and paste it here.

On Fri, 8 Sept 2023 at 10:42, PROFESOR MADYA DR NORHAYATI BAHARUN <
norha...@uitm.edu.my> wrote:

> Hi Sir,
>
> Could you please help me on the following errors:
>
> STEPS TO MIX IRT_RMT APPROACH IN R
>
> #1- Load required libraries
> library(eRm)
> library(ltm)
> library(mirt)
> library(psych)
>
> HT <- read.csv("C:/Users/User/Dropbox/Analysis R_2023/HT2.csv")
> str(HT)
>
> #2- Load or create your data matrix
> response_columns <- HT[, 1:ncol(HT)]
> response_matrix <- as.matrix(response_columns)
>
> #3- Fit IRT model
> irt_model <- gpcm(response_matrix)
> irt_model
> summary(irt_model)
>
> #4- Fit Rasch model
> rasch_model <- PCM(response_matrix)
> rasch_model
> summary(rasch_model)
>
> #5- Compare item parameter estimates between IRT and Rasch models
> irt_item_parameters <- coef(irt_model)
> rasch_item_parameters <- coef(rasch_model)
>
> #6- Compare person ability estimates between IRT and Rasch models
> #TRY1
> irt_person_abilities <- fscores(irt_model)###ERROR###
> #TRY2
> #a(IRT)- Fit your GPCM model using ltm
> irt_model <- gpcm(data = HT, constraint = "1PL")
>
> #a(IRT)- Calculate factor scores (IRT person abilities)
> irt_person_abilities <- factor.scores(irt_model) ###ERROR###
> irt_person_abilities_dim1 <- factor.scores(gpcm_model, f = 1)
>
> #TRY3
> # Fit your GPCM model using mirt
> irt_model <- mirt(data = HT, model = "gpcm", itemtype = "graded")
>  ###ERROR###
>
> # Calculate factor scores for dimension 1 (adjust the dimension as needed)
> irt_person_abilities_dim1 <- fscores(gpcm_model, method = "EAP", dims = 1)
>
>
> #b(RMT)
> rasch_person_abilities <- person.parameter(rasch_model)$theta
>
>
> #7- Perform model comparison using fit statistics (e.g., AIC, BIC)
> irt_aic <- AIC(irt_model)
> rasch_aic <- AIC(rasch_model)
>
> irt_bic <- BIC(irt_model)
> rasch_bic <- BIC(rasch_model)
>
> #8- Print or visualize the results for comparison
> print("Item Parameter Estimates:")
> print(irt_item_parameters)
> print(rasch_item_parameters)
>
> print("Person Ability Estimates:")
> print(irt_person_abilities)  ###ERROR###
> print(rasch_person_abilities)
>
> print("Model Fit Statistics:")
> print(paste("IRT AIC:", irt_aic))
> print(paste("Rasch AIC:", rasch_aic))
>
> print(paste("IRT BIC:", irt_bic))
> print(paste("Rasch BIC:", rasch_bic))
>
> Hope to get your response.
>
> Many thanks.
>
> Regards,
>
> Norhayati
>
> --
>
>
>
>
> *PENAFIAN: *E-mel ini dan apa-apa fail yang dihantar
> bersama-samanya
> ("Mesej") adalah dihasratkan hanya untuk kegunaan
> penerima yang dinyatakan
> di atas dan mungkin mengandungi maklumat yang tidak
> umum, bermilik,
> istimewa, sulit dan dikecualikan dari penzahiran di bawah
> undang-undang
> yang terpakai termasuklah Akta Rahsia Rasmi 1972. *BACA SELANJUTNYA...*
> <https://mail.uitm.edu.my/index.php?option=com_content=article=83>*DISCLAIMER
>
> :** This e-mail and any files transmitted with it
> ("Message") is intended
> only for the use of the recipient(s) named
> above and may contain
> information that is non-public,  proprietary,
> privileged,  confidential
> and
> exempt  from  disclosure under applicable law including the
> Official
> Secrets Act 1972. **READ MORE...*
> <https://mail.uitm.edu.my/index.php?option=com_content=article=83>
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Could not read time series data using read.zoo()

2023-08-03 Thread John Kane
One reason seems to be you are saying sep = "," and there is no "," in the
file.
Also you only have 3 columns of data but 4 variable names.

On Thu, 3 Aug 2023 at 10:53, Christofer Bogaso 
wrote:

> Hi,
>
> I have a CSV which contains data like below (only first few rows),
>
> Date Adj Close lret
> 02-01-1997 737.01
> 03-01-1997 748.03 1.48416235
> 06-01-1997 747.65 -0.050813009
> 07-01-1997 753.23 0.743567202
> 08-01-1997 748.41 -0.64196699
> 09-01-1997 754.85 0.856809786
> 10-01-1997 759.5 0.614126802
>
> However when I try to read this data using below code I get error,
>
> read.zoo("1.csv", sep = ',', format = '%d-%m-%Y')
>
> Error reads as,
>
> index has 4500 bad entries at data rows: 1 2 3 4 5 6 7 8 9.
>
> Could you please help to understand why I am getting this error?
>
> > sessionInfo()
>
> R version 4.2.2 (2022-10-31)
>
> Platform: x86_64-apple-darwin17.0 (64-bit)
>
> Running under: macOS Big Sur ... 10.16
>
>
> Matrix products: default
>
> BLAS:
>  /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
>
> LAPACK:
> /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
>
>
> locale:
>
> [1] C/UTF-8/C/C/C/C
>
>
> attached base packages:
>
> [1] stats graphics  grDevices utils datasets  methods   base
>
>
> other attached packages:
>
> [1] zoo_1.8-12
>
>
> loaded via a namespace (and not attached):
>
> [1] compiler_4.2.2  tools_4.2.2 grid_4.2.2  lattice_0.20-45
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] ggplot: Can plot graphs with points, can't plot graph with points and line

2023-07-13 Thread John Kane
Hi John,

This should do what you want.  I've changed your data.frame name for my own
convenience to "dat1".

###===
dat1  <- data.frame(
Time  = c("Age.25","Age.35","Age.45","Age.55"),
Medians = c(128.25,148.75,158.5,168.75)
)

# create segments data.frame

dat2  <- data.frame(x = dat1$Time[1:3], xend = dat1$Time[2:4],
y = dat1$Medians[1:3], yend = dat1$Medians[2:4])



p1  <- ggplot(dat1 ,aes(x = Time, y = Medians)) +
  geom_point()

p1 + geom_segment( x = "Age.25", y = 128.25, xend = "Age.35", yend =
148.75) +
  geom_segment( x = "Age.35", y = 148.75, xend = "Age.45", yend = 158.5) +
  geom_segment( x = "Age.45", y = 158.5, xend = "Age.55", yend = 168.55)


# This solution shamelessly stolen from
##
https://stackoverflow.com/questions/62536499/how-to-draw-multiple-line-segment-in-ggplot
p1 + geom_segment(
  data = dat2,
  mapping = aes(x=x, y=y, xend=xend, yend=yend),
  inherit.aes = FALSE
)


On Thu, 13 Jul 2023 at 01:11, Jim Lemon  wrote:

> Hi John,
> I'm not sure how to do this with ggplot, but:
>
> Time<- c("Age.25","Age.35","Age.45","Age.55")
> Medians<-c(128.25,148.75,158.5,168.75)
> > is.character(Time)
> # [1] TRUE - thus it has no intrinsic numeric value to plot
> > is.numeric(Medians)
> # [1] TRUE
> # coerce Medians to factor and then plot against Time, but can't do
> point/line
> plot(as.factor(Time),Medians,type="p")
> # let R determine the x values (1:4) and omit the x-axis
> plot(Medians,type="b",xaxt="n")
> # add the x-axis with the "Time" labels
> axis(1,at=1:4,labels=Time)
>
>
> On Thu, Jul 13, 2023 at 11:18 AM Sorkin, John 
> wrote:
> >
> > I am trying to plot four points, and join the points with lines. I can
> plot the points, but I can't plot the points and the line.
> > I hope someone can help my with my ggplot code.
> >
> > # load ggplot2
> > if(!require(ggplot2)){install.packages("ggplot2")}
> > library(ggplot2)
> >
> > # Create data
> > Time   <- c("Age.25","Age.35","Age.45","Age.55")
> > Medians<-c(128.25,148.75,158.5,168.75)
> > themedians <- matrix(data=cbind(Time,Medians),nrow=4,ncol=2)
> > dimnames(themedians) <- list(NULL,c("Time","Median"))
> > # Convert to dataframe the data format used by ggplot
> > themedians <- data.frame(themedians)
> > themedians
> >
> > # This plot works
> > ggplot(themedians,aes(x=Time,y=Median))+
> >   geom_point()
> > # This plot does not work!
> > ggplot(themedians,aes(x=Time,y=Median))+
> >   geom_point()+
> >   geom_line()
> >
> > Thank you,
> > John
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Plotting factors in graph panel

2023-06-29 Thread John Kane
r=TRUE,stringsAsFactors=FALSE)
> > at_df<-at_df[at_df$Income!="No_Answer",which(names(at_df)!="Bank_NA")]
> > png("MF_Bank.png",height=600)
> > par(mfrow=c(2,1))
> > matplot(at_df[,c("MF_None","MF_Equity","MF_Debt","MF_Hybrid")],
> >  type="l",col=1:4,lty=1:4,lwd=3,
> >  main="Percentages by Income and MF type",
> > xlab="Income",ylab="Percentage of group",xaxt="n")
> > axis(1,at=1:5,labels=at_df$Income)
> > legend(3,24,c("MF_None","MF_Equity","MF_Debt","MF_Hybrid"),
> >  lty=1:4,lwd=3,col=1:4)
> > matplot(at_df[,c("Bank_None","Bank_Current","Bank_Savings")],
> >  type="l",col=1:3,lty=1:4,lwd=3,
> >  main="Percentages by Income and Bank type",
> > xlab="Income",ylab="Percentage of group",xaxt="n")
> > axis(1,at=1:5,labels=at_df$Income)
> > legend(3,54,c("Bank_None","Bank_Current","Bank_Savings"),
> >  lty=1:4,lwd=3,col=1:3)
> > dev.off()
> >
> > Jim
> >
> > On Wed, Jun 28, 2023 at 6:33 PM Anupam Tyagi 
> wrote:
> > >
> > > Hello,
> > >
> > > I want to plot the following kind of data (percentage of respondents
> > from a
> > > survey) that varies by Income into many small *line* graphs in a
> > > panel of graphs. I want to omit "No Answer" categories. I want to
> > > see how each one of the categories (percentages), "None", " Equity",
> > > etc. varies by
> > Income.
> > > How can I do this? How to organize the data well and how to plot? I
> > thought
> > > Lattice may be a good package to plot this, but I don't know for
> > > sure. I prefer to do this in Base-R if possible, but I am open to
> > > ggplot. Any
> > ideas
> > > will be helpful.
> > >
> > > Income
> > > $10 $25 $40 $75 > $75 No Answer
> > > MF 1 2 3 4 5 9
> > > None 1 3.05 2.29 2.24 1.71 1.30 2.83 Equity 2 29.76 28.79 29.51
> > > 28.90 31.67 36.77 Debt 3 31.18 32.64 34.31 35.65 37.59 33.15 Hybrid
> > > 4 36.00 36.27 33.94 33.74 29.44 27.25 Bank AC None 1 46.54 54.01
> > > 59.1 62.17 67.67 60.87 Current 2 24.75 24.4 25 24.61 24.02 21.09
> > > Savings 3 25.4 18.7 29 11.48 7.103 13.46 No Answer 9 3.307 2.891
> > > 13.4 1.746 1.208 4.577
> > >
> > > Thanks.
> > > --
> > > Anupam.
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > __
> > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > https://st/
> > > at.ethz.ch%2Fmailman%2Flistinfo%2Fr-help=05%7C01%7Ctebert%40ufl
> > > .edu%7C59874e74164c46133f2c08db7853d28f%7C0d4da0f84a314d76ace60a6233
> > > 1e1b84%7C0%7C0%7C638236073642897221%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi
> > > MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
> > > %7C%7C=xoaDMG7ogY4tMtqe30pONZrBdk0eq2cW%2BgdwlDHneWY%3D
> > > ed=0
> > > PLEASE do read the posting guide
> > http://www.r/
> > -project.org%2Fposting-guide.html=05%7C01%7Ctebert%40ufl.edu%7C59
> > 874e74164c46133f2c08db7853d28f%7C0d4da0f84a314d76ace60a62331e1b84%7C0%
> > 7C0%7C638236073642897221%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL
> > CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=H7
> > 6XCa%2FULBGUn0Lok93l6mtHzo0snq5G0a%2BL4sEH8%2F8%3D=0
> > > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
> Anupam.
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Shaded area

2023-03-03 Thread John Kane
As Peter says, the list is very cautious about what types of files it
allows. A handy way to supply some sample data is the dput() function.  In
the case of a large dataset something like dput(head(mydata, 100)) should
supply the data we need. Just do dput(mydata) where *mydata* is your data.
Copy the output and paste it here.

On Wed, 1 Mar 2023 at 09:58, PIKAL Petr  wrote:

> Hallo
>
> Excel attachment is not allowed here, but shading area is answered many
> times elsewhere. Use something like . "shading area r" in google.
>
> See eg.
> https://www.geeksforgeeks.org/how-to-shade-a-graph-in-r/
>
> Cheers Petr
>
> -Original Message-
> From: R-help  On Behalf Of George Brida
> Sent: Wednesday, March 1, 2023 3:21 PM
> To: r-help@r-project.org
> Subject: [R] Shaded area
>
> Dear R users,
>
> I have an xlsx file (attached to this mail) that shows the values of a
> "der" series observed on a daily basis from January 1, 2017 to January 25,
> 2017. This series is strictly positive during two periods: from January 8,
> 2017 to January 11, 2017 and from January 16, 2017 to January 20, 2017. I
> would like to plot the series with two shaded areas corresponding to the
> positivity of the series. Specifically, I would like to draw 4 vertical
> lines intersecting the x-axis in the 4 dates mentioned above and shade the
> two areas of positivity. Thanks for your help.
> __
> 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.
> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních
> partnerů PRECHEZA a.s. jsou zveřejněny na:
> https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information
> about processing and protection of business partner’s personal data are
> available on website:
> https://www.precheza.cz/en/personal-data-protection-principles/
> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
> důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení
> odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
> documents attached to it may be confidential and are subject to the legally
> binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Generic Function read?

2023-02-28 Thread John Kane
Have a look at the {rio} package.

On Tue, 28 Feb 2023 at 15:00, Leonard Mada via R-help 
wrote:

> Dear R-Users,
>
> I noticed that *read* is not a generic function. Although it could
> benefit from the functionality available for generic functions:
>
> read = function(file, ...) UseMethod("read")
>
> methods(read)
>   # [1] read.csv read.csv2read.dcf read.delim read.delim2
> read.DIF read.fortran
>   # [8] read.ftable  read.fwf read.socket  read.table
>
> The users would still need to call the full function name. But it seems
> useful to be able to find rapidly what formats can be read; including
> with other packages (e.g. for Excel, SAS, ... - although most packages
> do not adhere to the generic naming convention, but maybe they will
> change in the future).
>
> Note:
> This should be possible (even though impractical), but actually does NOT
> work:
> read = function(file, ...) UseMethod("read")
> file = "file.csv"
> class(file) = c("csv", class(file));
> read(file)
>
> Should it not work?
>
> Sincerely,
>
> Leonard
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Removing variables from data frame with a wile card

2023-01-14 Thread John Kane
You rang sir?

library(tidyverse)
xx = 1:10
yr1 = yr2 = yr3 = rnorm(10)
dat1 <- data.frame(xx , yr1, yr2, y3)

dat1  %>%  select(!starts_with("yr"))

or for something a bit more exotic as I have been trying to learn a bit
about the "data.table package

library(data.table)

xx = 1:10
yr1 = yr2 = yr3 = rnorm(10)

dat2 <- data.table(xx , yr1, yr2, yr3)

dat2[, !names(dat2) %like% "yr", with=FALSE ]



On Sat, 14 Jan 2023 at 12:28,  wrote:

> Steven,
>
> Just want to add a few things to what people wrote.
>
> In base R, the methods mentioned will let you make a copy of your original
> DF that is missing the items you are selecting that match your pattern.
>
> That is fine.
>
> For some purposes, you want to keep the original data.frame and remove a
> column within it. You can do that in several ways but the simplest is
> something where you sat the column to NULL as in:
>
> mydata$NAME <- NULL
>
> using the mydata["NAME"] notation can do that for you by using a loop of
> unctional programming method that does that with all components of your
> grep.
>
> R does have optimizations that make this less useful as a partial copy of
> a data.frame retains common parts till things change.
>
> For those who like to use the tidyverse, it comes with lots of tools that
> let you select columns that start with or end with or contain some pattern
> and I find that way easier.
>
>
>
> -Original Message-
> From: R-help  On Behalf Of Steven Yen
> Sent: Saturday, January 14, 2023 7:49 AM
> To: Andrew Simmons 
> Cc: R-help Mailing List 
> Subject: Re: [R] Removing variables from data frame with a wile card
>
> Thanks to all. Very helpful.
>
> Steven from iPhone
>
> > On Jan 14, 2023, at 3:08 PM, Andrew Simmons  wrote:
> >
> > You'll want to use grep() or grepl(). By default, grep() uses
> > extended regular expressions to find matches, but you can also use
> > perl regular expressions and globbing (after converting to a regular
> expression).
> > For example:
> >
> > grepl("^yr", colnames(mydata))
> >
> > will tell you which 'colnames' start with "yr". If you'd rather you
> > use globbing:
> >
> > grepl(glob2rx("yr*"), colnames(mydata))
> >
> > Then you might write something like this to remove the columns starting
> with yr:
> >
> > mydata <- mydata[, !grepl("^yr", colnames(mydata)), drop = FALSE]
> >
> >> On Sat, Jan 14, 2023 at 1:56 AM Steven T. Yen  wrote:
> >>
> >> I have a data frame containing variables "yr3",...,"yr28".
> >>
> >> How do I remove them with a wild cardsomething similar to "del yr*"
> >> in Windows/doc? Thank you.
> >>
> >>> colnames(mydata)
> >>   [1] "year"   "weight" "confeduc"   "confothr" "college"
> >>   [6] ...
> >>  [41] "yr3""yr4""yr5""yr6" "yr7"
> >>  [46] "yr8""yr9""yr10"   "yr11" "yr12"
> >>  [51] "yr13"   "yr14"   "yr15"   "yr16" "yr17"
> >>  [56] "yr18"   "yr19"   "yr20"   "yr21" "yr22"
> >>  [61] "yr23"   "yr24"   "yr25"   "yr26" "yr27"
> >>  [66] "yr28"...
> >>
> >> __
> >> 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-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.
>


-- 
John Kane
Kingston ON Canada

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

2023-01-02 Thread John Kane
Hi Mukesh,

Have a look at the blurb that prints at the start-up of R.

"R is free software and comes with ABSOLUTELY NO WARRANTY."

This is a hint that the R-Project is unlikely to be issuing certificates.



On Mon, 2 Jan 2023 at 08:18, Mukesh Ghanshyamdas Lekhrajani via R-help <
r-help@r-project.org> wrote:

> Thanks Petr !
>
> I will look at other training bodies as Coursera, or few others... but I
> was just wondering if there could be a  certificate from the "originators"
> itself, I mean an "R" certificate from "r-project" itself and that would
> carry more importance than external / unauthorized certificate bodies.
>
> But, if you suggest there is no such certification provided by
> "r-project", then the only option for me is to search else where like -
> Coursera or few others.
>
> I now have got my answers, but later the day - if ever "r-project" comes
> up with "R Language" certifications, do keep me informed.
>
>
> Thanks, Mukesh
> 9819285174.
>
>
> -Original Message-
> From: PIKAL Petr 
> Sent: Monday, January 2, 2023 6:13 PM
> To: mukesh.lekhraj...@yahoo.com; R-help Mailing List  >
> Subject: RE: [R] R Certification
>
> Hallo Mukesh
>
> R project is not Microsoft or Oracle AFAIK. But if you need some
> certificate you could take courses on Coursera, they are offering
> certificates.
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help  On Behalf Of Mukesh
> > Ghanshyamdas Lekhrajani via R-help
> > Sent: Monday, January 2, 2023 1:04 PM
> > To: 'Jeff Newmiller' ; 'Mukesh Ghanshyamdas
> > Lekhrajani via R-help' ; r-help@r-project.org
> > Subject: Re: [R] R Certification
> >
> > Hello Jeff !
> >
> > Yes, you are right.. and that’s why I am asking this question - just
> like other
> > governing bodies that issue certification on their respective
> technologies, does
> > "r-project.org" also have a learning path ? and then a certification.
> >
> > Say - Microsoft issues certificate for C#, .Net, etc..
> > Then, Oracle issues certificates for Java, DB etc..
> >
> > These are authentic governing bodies for learning and issuing
> certificates
> >
> > On exactly similar lines -  "r-project.org" would also be having some
> learning
> > path and then let "r-project" take the proctored exam and issue a
> certificate...
> >
> > I am not looking at any external institute for certifying me on "R" -
> but, the
> > governing body itself..
> >
> > So, the question again is - "does r-project provide a learning path and
> issue
> > certificate after taking exams"
> >
> > Thanks, Mukesh
> > 9819285174
> >
> >
> >
> > -Original Message-
> > From: Jeff Newmiller 
> > Sent: Monday, January 2, 2023 2:26 PM
> > To: mukesh.lekhraj...@yahoo.com; Mukesh Ghanshyamdas Lekhrajani via R-
> > help ; r-help@r-project.org
> > Subject: Re: [R] R Certification
> >
> > I think this request is like saying "I want a unicorn." There are many
> > organizations that will enter your name into a certificate form for a
> fee, possibly
> > with some credibility... but if they put "r-project.org" down as the
> name of the
> > organization granting this "certificate" then you are probably getting
> fooled.
> >
> > On December 30, 2022 8:33:09 AM PST, Mukesh Ghanshyamdas Lekhrajani via
> > R-help  wrote:
> > >Hello R Support Team,
> > >
> > >
> > >
> > >I want to do R certification, could you help me with the list of
> > >certificates with their prices so it helps me to register.
> > >
> > >
> > >
> > >I want to do the certification directly from the governing body
> > >"r-project.org" and not from any 3rd party.
> > >
> > >
> > >
> > >Please help.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >Mukesh
> > >
> > >+91 9819285174
> > >
> > >
> > > [[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] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread John Kane
Here is a rough guess at what you may want with a bit of mock data and
using ggplot2.
##=#
library(ggplot2)
library(RColorBrewer)

dat1  <- data.frame(aa = sample(1:10, 20, replace = TRUE), bb =
sample(21:30, 20, replace = TRUE),
outcome = sample(c("died", "home", "other
hospital","secondary care/rehab"), 20, replace = TRUE ))
ggplot(dat1, aes(aa, bb, colour = outcome)) + geom_point() +
scale_colour_brewer(palette = "Dark2") +
labs(
x = "Maximum body temperature",
y =  "Maximum heart rate",
colour = "outcome",
title ="500 ICU patients"
)
 ##====##

On Mon, 26 Dec 2022 at 09:46, John Kane  wrote:

> I suspect you may be mixing *plot()* commands with *ggplot()* commands and
> they are likely incompatible.
>
> Could you supply some sample data and any error messages that you are
> getting?   A handy way to supply some sample data is the dput() function.
> In the case of a large dataset something like dput(head(mydata, 100))
> should supply the data we need.
>
> On Mon, 26 Dec 2022 at 09:06, Upananda Pani 
> wrote:
>
>> Dear All,
>>
>> I am trying to plot a scatter plot between  temperature and heart rate and
>> additionally marking the outcome of the patients by colors. I am using the
>> standard package Use the standard function plot as well as the functions
>> of
>> package "ggplot2" (Wickham (2009)). Save the plots in pdf files.
>>
>> I am geeting an error to plot when assigning colsOutcome to the
>> scatterplot. I am doing it wrongly. Please advise me.
>> ```{r}
>> library(ggplot2)
>> library(RColorBrewer)
>> library(ggsci)
>> ICUData <- read.csv(file = "ICUData.csv")
>> ```
>> ```{r}
>> ## Generate empty vector
>> colsOutcome <- character(nrow(ICUData))
>> ## Fill with colors
>> colsOutcome[ICUData$outcome == "died"] <- "#E41A1C"
>> colsOutcome[ICUData$outcome == "home"] <- "#377EB8"
>> colsOutcome[ICUData$outcome == "other hospital"] <- "#4DAF4A8"
>> colsOutcome[ICUData$outcome == "secondary care/rehab"] <- "#984EA3"
>> ```
>>
>> ```{r}
>> plot(x = ICUData$temperature, y = ICUData$heart.rate, pch = 19,
>>  xlab = "Maximum body temperature", ylab = "Maximum heart rate",
>>  main = "500 ICU patients", col = colsOutcome, xlim = c(33,43))
>> legend(x = "topleft", legend = c("died", "home", "other hospital",
>> "secondary care/rehab"), pch = 19,
>>col = c("#E41A1C", "#377EB8", "#4DAF4A8", "#984EA3"))
>> ```
>> __
>> 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.
>>
>
>
> --
> John Kane
> Kingston ON Canada
>


-- 
John Kane
Kingston ON Canada

[[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] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread John Kane
I suspect you may be mixing *plot()* commands with *ggplot()* commands and
they are likely incompatible.

Could you supply some sample data and any error messages that you are
getting?   A handy way to supply some sample data is the dput() function.
In the case of a large dataset something like dput(head(mydata, 100))
should supply the data we need.

On Mon, 26 Dec 2022 at 09:06, Upananda Pani  wrote:

> Dear All,
>
> I am trying to plot a scatter plot between  temperature and heart rate and
> additionally marking the outcome of the patients by colors. I am using the
> standard package Use the standard function plot as well as the functions of
> package "ggplot2" (Wickham (2009)). Save the plots in pdf files.
>
> I am geeting an error to plot when assigning colsOutcome to the
> scatterplot. I am doing it wrongly. Please advise me.
> ```{r}
> library(ggplot2)
> library(RColorBrewer)
> library(ggsci)
> ICUData <- read.csv(file = "ICUData.csv")
> ```
> ```{r}
> ## Generate empty vector
> colsOutcome <- character(nrow(ICUData))
> ## Fill with colors
> colsOutcome[ICUData$outcome == "died"] <- "#E41A1C"
> colsOutcome[ICUData$outcome == "home"] <- "#377EB8"
> colsOutcome[ICUData$outcome == "other hospital"] <- "#4DAF4A8"
> colsOutcome[ICUData$outcome == "secondary care/rehab"] <- "#984EA3"
> ```
>
> ```{r}
> plot(x = ICUData$temperature, y = ICUData$heart.rate, pch = 19,
>  xlab = "Maximum body temperature", ylab = "Maximum heart rate",
>  main = "500 ICU patients", col = colsOutcome, xlim = c(33,43))
> legend(x = "topleft", legend = c("died", "home", "other hospital",
> "secondary care/rehab"), pch = 19,
>col = c("#E41A1C", "#377EB8", "#4DAF4A8", "#984EA3"))
> ```
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Amazing AI

2022-12-19 Thread John Kane
Does not Medians <- apply(numeric_data, 1, median) give us the rom medians?

On Mon, 19 Dec 2022 at 05:52, Milan Glacier  wrote:

> On 12/18/22 19:01, Boris Steipe wrote:
> >Technically not a help question. But crucial to be aware of, especially
> for those of us in academia, or otherwise teaching R. I am not aware of a
> suitable alternate forum. If this does not interest you, please simply
> ignore - I already know that this may be somewhat OT.
> >
> >Thanks.
> >--
> >
> >You very likely have heard of ChatGPT, the conversation interface on top
> of the GPT-3 large language model and that it can generate code. I thought
> it doesn't do R - I was wrong. Here is a little experiment:
> >Note that the strategy is quite different (e.g using %in%, not
> duplicated() ), the interpretation of "last variable" is technically
> correct but not what I had in mind (ChatGPT got that right though).
> >
> >
> >Changing my prompts slightly resulted it going for a dplyr solution
> instead, complete with %>% idioms etc ... again, syntactically correct but
> not giving me the fully correct results.
> >
> >--
> >
> >Bottom line: The AI's ability to translate natural language instructions
> into code is astounding. Errors the AI makes are subtle and probably not
> easy to fix if you don't already know what you are doing. But the way that
> this can be "confidently incorrect" and plausible makes it nearly
> impossible to detect unless you actually run the code (you may have noticed
> that when you read the code).
> >
> >Will our students use it? Absolutely.
> >
> >Will they successfully cheat with it? That depends on the assignment. We
> probably need to _encourage_ them to use it rather than sanction - but
> require them to attribute the AI, document prompts, and identify their own,
> additional contributions.
> >
> >Will it help them learn? When you are aware of the issues, it may be
> quite useful. It may be especially useful to teach them to specify their
> code carefully and completely, and to ask questions in the right way. Test
> cases are crucial.
> >
> >How will it affect what we do as instructors? I don't know. Really.
> >
> >And the future? I am not pleased to extrapolate to a job market in which
> they compete with knowledge workers who work 24/7 without benefits,
> vacation pay, or even a salary. They'll need to rethink the value of their
> investment in an academic education. We'll need to rethink what we do to
> provide value above and beyond what AI's can do. (Nb. all of the arguments
> I hear about why humans will always be better etc. are easily debunked, but
> that's even more OT :-)
> >
> >
> >
> >If you have thoughts to share how your institution is thinking about
> academic integrity in this situation, or creative ideas how to integrate
> this into teaching, I'd love to hear from you.
>
> *NEVER* let the AI misleading the students! ChatGPT gives you seemingly
> sound but actually *wrong* code!
>
> ChatGPT never understands the formal abstraction behind the code, it
> just understands the shallow text pattern (and the syntax rules) in the
> code. And it often gives you the code that seemingly correct but indeed
> wrongly output. If it is used with code completion, then it is okay
> (just like github copilot), since the coder need to modify the code
> after getting the completion. But if you want to use ChatGPT for
> students to query information / writing code, it is error proning!
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] rio: list of extensions for supported formats

2022-11-05 Thread John Kane
Cat was being helpful.

On Sat, 5 Nov 2022 at 15:39, John Kane  wrote:

> o idea but there is a list here
> https://thomasleeper.com/rio/articles/rio.html
>
> On Sat, 5 Nov 2022 at 04:04, Sigbert Klinke 
> wrote:
>
>> Hi,
>>
>> is there a function in the package rio to get the file extensions listed
>> in the vignette under supported formats?
>>
>> Thanks Sigbert
>>
>> __
>> 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.
>>
>
>
> --
> John Kane
> Kingston ON Canada
>


-- 
John Kane
Kingston ON Canada

[[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] rio: list of extensions for supported formats

2022-11-05 Thread John Kane
o idea but there is a list here
https://thomasleeper.com/rio/articles/rio.html

On Sat, 5 Nov 2022 at 04:04, Sigbert Klinke 
wrote:

> Hi,
>
> is there a function in the package rio to get the file extensions listed
> in the vignette under supported formats?
>
> Thanks Sigbert
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] How long does it take to learn the R programming language?

2022-09-28 Thread John Kane
+ 1

On Wed, 28 Sept 2022 at 17:36, Jim Lemon  wrote:

> Given some of the questions that are posted to this list, I am not
> sure that there is an upper bound to the estimate.
>
> Jim
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Kindly Guide

2022-07-15 Thread John Kane
Typo? Try
write.xlsx(x, "table name.xlsx")

Example
install.packages('openxlsx')
library(openxlsx)

write.xlsx(df, "stations.xlsx")

On Thu, 14 Jul 2022 at 15:40, Muhammad Zubair Chishti
 wrote:
>
> Dear Experts,
> I have obtained the results through applying Time Varying VAR model in R.
> Now I want to save my results in a excel sheet. Kindly guide me how to
> create a excel or excel table. Although I have tried the following code but
> I face error.
> Write.xlsx(x, "table name.xlsx")
>
> Kindly guide.
>
> Regards
> Chishti
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
John Kane
Kingston ON Canada

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


Re: [R] A humble request

2022-07-03 Thread John Kane
> >>>> your data using wavelets.  No worries.
> >>>> But does it have to be THIS unmaintained
> >>>> package?
> >>>>
> >>>> Why not visit
> >>>>
> >>>> https://CRAN.R-project.org/view=TimeSeries
> >>>> and search for "wavelets" in the text?
> >>>> Oh heck, I might as well do it for you.
> >>>> 
> >>>> *Wavelet methods* : The wavelets
> >>>> <https://cran.r-project.org/web/packages/wavelets/index.html> package
> >>>> includes computing wavelet filters, wavelet transforms and 
> >>>> multiresolution
> >>>> analyses. Multiresolution forecasting using wavelets is also implemented 
> >>>> in
> >>>> mrf <https://cran.r-project.org/web/packages/mrf/index.html>. WaveletComp
> >>>> <https://cran.r-project.org/web/packages/WaveletComp/index.html>
> >>>> provides some tools for wavelet-based analysis of univariate and 
> >>>> bivariate
> >>>> time series including cross-wavelets, phase-difference and significance
> >>>> tests. biwavelet
> >>>> <https://cran.r-project.org/web/packages/biwavelet/index.html> is a port
> >>>> of the WTC Matlab package for univariate and bivariate wavelet analyses.
> >>>> mvLSW <https://cran.r-project.org/web/packages/mvLSW/index.html>
> >>>> provides tools for multivariate locally stationary wavelet processes.
> >>>> LSWPlib <https://cran.r-project.org/web/packages/LSWPlib/index.html>
> >>>> contains functions for simulation and spectral estimation of locally
> >>>> stationary wavelet packet processes. Tests of white noise using wavelets
> >>>> are provided by hwwntest
> >>>> <https://cran.r-project.org/web/packages/hwwntest/index.html>. Wavelet
> >>>> scalogram tools are contained in wavScalogram
> >>>> <https://cran.r-project.org/web/packages/wavScalogram/index.html>.
> >>>> Further wavelet methods can be found in the packages rwt
> >>>> <https://cran.r-project.org/web/packages/rwt/index.html>, waveslim
> >>>> <https://cran.r-project.org/web/packages/waveslim/index.html>, wavethresh
> >>>> <https://cran.r-project.org/web/packages/wavethresh/index.html>.
> >>>> 
> >>>>
> >>>> Presumably there is a reason that nobody else has
> >>>> bothered to continue maintaining wmtsa.  Perhaps
> >>>> one of those other wavelets + time series packages
> >>>> can do what you need?
> >>>>
> >>>>
> >>>> On Sun, 3 Jul 2022 at 04:12, Muhammad Zubair Chishti <
> >>>> mzchis...@eco.qau.edu.pk> wrote:
> >>>>
> >>>>> Dear Experts,
> >>>>> I cannot find a package "wmtsa" for my R version "R 4.2.0". Kindly help
> >>>>> me
> >>>>> to find it or share the link with me.
> >>>>> Although I tried the old version of "wmtsa" but failed.
> >>>>> Thank you for your precious time.
> >>>>>
> >>>>> Regards
> >>>>> Muhammad Zubair Chishti
> >>>>>
> >>>>>  [[alternative HTML version deleted]]
> >>>>>
> >>>>> __
> >>>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>>>> PLEASE do read the posting guide
> >>>>> http://www.R-project.org/posting-guide.html
> >>>>> and provide commented, minimal, self-contained, reproducible code.
> >>>>>
> >>>>
> >>
> >>  [[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-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.



-- 
John Kane
Kingston ON Canada

__
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] Syntax help for 'Pivot_longer'

2021-12-01 Thread John Kane
> > >> > 4.542354226   4.824773827
> > >> >
> > >> > 5002.900508112   4.305900444   5.61367474
> > >> > 4.320657374   4.520022189
> > >> >
> > >> > 6003.110238149   3.616699448   4.83992
> > >> > 4.006103489   4.188421662
> > >> >
> > >> > 700 3.150580922   2.848148846   4.216782177
> > >> > 3.642003696   3.725611032
> > >> >
> > >> > 800 3.079728958   2.016807672   4.05288041
> > >> > 3.315992643   3.278124347
> > >> >
> > >> > 900 2.327902499   1.452876728   3.779922823
> > >> > 3.181741995   3.29577819
> > >> >
> > >> > 1000   1.641887823   2.120099832   4.267840277
> > >> > 3.321634055   3.551965361
> > >> >
> > >> > 1100   1.63370882 1.661317381   3.747342619
> > >> > 2.814670223   2.807355369
> > >> >
> > >> > 1200   0.986559368   1.133219897   2.414025636
> > >> > 2.180686348   2.166547946
> > >> >
> > >> > 1300   0.920601397   1.237239562   2.647100163
> > >> > 2.253223258   2.411947081
> > >> >
> > >> > 1400   0.571882394   0.93675648 2.272566024
> > >> > 2.07198929 1.954723088
> > >> >
> > >> > 1500   0.340505009   0.7379146   2.526476424
> > >> > 1.912840489   2.003872651
> > >> >
> > >> > 1600   0.813480877   1.026085605   2.643863876
> > >> > 1.825988411   2.278799668
> > >> >
> > >> > 1700   0.47192   0.566766122   1.290173713
> > >> > 1.360936689   1.45967449
> > >> >
> > >> > 1800   0.269067515   0.13349775 0.612263766
> > >> > 0.666152106   0.680354177
> > >> >
> > >> > 1900   0.303179244   0.082892149   0.465457136
> > >> > 0.537232782   0.287185161
> > >> >
> > >> > Temperautre   1215 16
> > >> >  23   21.5
> > >> >
> > >> > Wind speed 109  10.5
> > >> >  9.5   9.5
> > >> >
> > >> > Wind trend   1  1  1
> > >> >0 1
> > >> >
> > >> > Wind direction  22.545  67.5
> > >> > 191.2556.25
> > >> >
> > >> > Humidity   40   44.5   22
> > >> >  24.57
> > >> >
> > >> > Pressure  1024   1018.5   1025
> > >> >   1005.51015.5
> > >> >
> > >> > Pressure trend 1  11
> > >> >   1  1
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > long data
> > >> > -
> > >> > Buffer Date LST Temperature  Wind
> > >> > speed ..
> > >> > 1  01.01.21 4  5   
> > >> >  10
> > >> > 2  01.02.21 5  2   
> > >> >  11
> > >> > 3  01.03.21 7  5   
> > >> >  15
> > >> > 4  01.04.21 9  6   
> > >> >  7
> > >> > 5  01.05.21 7  5   
> > >> >  10
> > >> >
> > >> > __
> > >> > 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.
> > >>
> > >> --
> > >> Chris Evans (he/him) 
> > >> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor, 
> > >> University of Roehampton, London, UK.
> > >> Work web site: https://www.psyctc.org/psyctc/
> > >> CORE site: https://www.coresystemtrust.org.uk/
> > >> Personal site: https://www.psyctc.org/pelerinage2016/
> > >> OMbook:https://ombook.psyctc.org/book/
> > >
> > >__
> > >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.



--
John Kane
Kingston ON Canada

__
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: the leading minor of order 6 is not positive definite

2021-10-28 Thread John Kane
I think we need the code you are running, any error messages you are
getting and some sample data. A handy way to supply sample data is to
use the dput() function. See ?dput.  If you have a very large data set
then something like head(dput(myfile), 100) will likely supply enough
data for us to work with.

On Mon, 25 Oct 2021 at 16:26, Sandhya Prakash
 wrote:
>
> Hi I'm too running a canonical correlation code but I'm getting my error like 
> this can you please help me
>
> Get Outlook for Android<https://aka.ms/AAb9ysg>
>
> [[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.



-- 
John Kane
Kingston ON Canada

__
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] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread John Kane
Would you supply some sample data please? A handy way to supply sample
data is to use the dput() function. See ?dput.  If you have a very
large data set then something like head(dput(myfile), 100) will likely
supply enough data for us to work with.

On Thu, 12 Aug 2021 at 11:45, Kai Yang via R-help  wrote:
>
> Hello List,
> I use the following code to generate a donut plot.
> # Compute percentages
> eth$fraction = eth$individuals / sum(eth$individuals)
> # Compute the cumulative percentages (top of each rectangle)
> eth$ymax = cumsum(eth$fraction)
> # Compute the bottom of each rectangle
> eth$ymin = c(0, head(eth$ymax, n=-1))
> # Make the plot using percentage
> ggplot(eth, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=ethnicity)) +
>   geom_rect() +
>   coord_polar(theta="y")  +
>   xlim(c(2, 4)
>   )
>
> I want to improve the plot for two thing:
> 1. the legend: I need to add percentage (eth$fraction * 100 and then add %) 
> for each of element.
> 2. remove all number (tick mark ?) around the plot
> Please help
> Thank you,
> Kai
>
> [[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.



-- 
John Kane
Kingston ON Canada

__
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] No "doc" directory in my installation of R.

2021-08-08 Thread John Kane
R version 4.1.0 (2021-05-18)
RStudio 1.4.1714
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

I do not see a doc folder at R level but a lot of newer packages,
probably tidyverse derived seem to have a doc sub-folder containing
documentation files

For example corrplot has a doc subfolder containing
corrplot-intro.html
corrplot-intro.R
corrplot-intro.Rmd
index.html

Jim Lemon's suggestion seems worth trying but I really think this is
some RStudio weirdity. I have been using RStudio for 3-4 years and a
several complete installations on new machines and tave never seen
anything like "R doc dir (/usr/local/lib64/R/doc) not found".

RStudio keeps getting tweaked.



On Sun, 8 Aug 2021 at 00:30, Jim Lemon  wrote:
>
> Hi Rolf,
> What about:
>
> mkdir /usr/lib/R/doc
>
> Jim
>
> On Sun, Aug 8, 2021 at 12:45 PM Rolf Turner  wrote:
> >
> >
> > Should/shouldn't there be one?
> >
> > My R seems to be installed in /usr/lib/R.  If do an "ls" of this
> > directory, I get:
> >
> > > bin/  COPYING@etc/  lib/  library/  modules/
> > > site-library/  SVN-REVISION
> >
> > Definitely no "doc".
> >
> > The (only) reason that I am concerned about this, is that I have decided
> > to experiment a bit with Rstudio, and it apparently wants a "doc"
> > directory.  When I try to start Rstudio I get a pop-up window with the
> > error message
> >
> > > R doc dir (/usr/local/lib64/R/doc) not found.
> >
> > Note that /usr/local/lib64/R is a symbolic link to /usr/lib/R.
> > The latter is where my installation put R; the former seems to be where
> > Rstudio wants it to.  So I created the symbolic link.
> >
> > The discrepancy between locations is another puzzle/worry.
> >
> > My installation comes from a pre-built binary ("sudo apt install
> > r-base").  I apparently have the latest version.  I remark that I am
> > running Ubuntu 20.04 with a Mate 1.20.4 desktop.
> >
> > How can I get a "doc" directory into my R directory and make Rstudio
> > happy?
> >
> > cheers,
> >
> > Rolf Turner
> >
> > P.S. I have also tried to ask about this on the  Rstudio community
> > forum, but it seems to me to more of an R question than an Rstudio one.
> >
> > R. T.
> >
> > --
> > 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.
>
> __
> 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.



-- 
John Kane
Kingston ON Canada

__
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] DBDA2E-utilities.R file download

2021-06-02 Thread John Kane
"
In some cases there may be one missing package."

That should reae

In some cases there may be more than one missing package.

On Tue, 1 Jun 2021 at 14:19, John Kane  wrote:
>
> I have added this to the R Help mailing list as it increases your
> chances of getting a helpful response.
>
> That error message  can't "lazyload" indicates that you have
> some serious problem(s) upstream.
>
> Probably the best thing to do is copy and paste the entire
> installation output here for people to examine.
>
> However as a quicker approach, scroll through the output and look for
> an earlier message that will say something like:
> There is no package called ‘’.
>
> This will indicate that for some reasan the package  is not being
> installed automatically.
>
> You should try an install.packages("") and then retry
> remotes::install_github("kyusque/DBDA2E-utilities")
>
> In some cases there may be one missing package.
>
> On Tue, 1 Jun 2021 at 03:19, Nick Wray  wrote:
> >
> > Hi John  Thanks but that doesn't work.  When installing the needed packages 
> > R is telling me that it can't "lazyload"  DBDA2E-utilities.  Tbh I don't 
> > understand what that means. The page I quoted in my OP implies that one 
> > should be able to easily upload the file but there are various error 
> > messages which come up which again tbh mean nothing to me.  As far as I am 
> > aware this file should simply be some straightforward data to do an 
> > exercise in the book...  Nick
> >
> > On Tue, 1 Jun 2021 at 01:26, John Kane  wrote:
> >>
> >> If it seems to have installed correctly try:
> >> library(DBDA2E)
> >> which should load the DBDA@E-specific programmes.
> >>
> >>
> >>
> >> On Mon, 31 May 2021 at 16:27, Nick Wray  wrote:
> >> >
> >> > Hello I am trying to download the file "kyusque/DBDA2E-utilities.R" which
> >> > is used in following through John Krushke's book on Bayesian stats.
> >> > According to the net (kyusque/DBDA2E-utilities: Packaged One for
> >> > DBDA2E-utilities.R in 'Kruschke, J. K. (2015). Doing Bayesian Data
> >> > Analysis, Second Edition' version 0.1.0 from GitHub (rdrr.io)
> >> > <https://rdrr.io/github/kyusque/DBDA2E-utilities/>) I needed to
> >> >
> >> > install.packages("remotes")
> >> > remotes::install_github("kyusque/DBDA2E-utilities")
> >> >
> >> > which i have done, and seem to have done successfully
> >> >
> >> > but I can't get hold of the utilities file.  Does anyone know what I
> >> > should now do?
> >> >
> >> > Thanks Nick Wray
> >> >
> >> > [[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.
> >>
> >>
> >>
> >> --
> >> John Kane
> >> Kingston ON Canada
>
>
>
> --
> John Kane
> Kingston ON Canada



-- 
John Kane
Kingston ON Canada

__
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] DBDA2E-utilities.R file download

2021-06-01 Thread John Kane
I have added this to the R Help mailing list as it increases your
chances of getting a helpful response.

That error message  can't "lazyload" indicates that you have
some serious problem(s) upstream.

Probably the best thing to do is copy and paste the entire
installation output here for people to examine.

However as a quicker approach, scroll through the output and look for
an earlier message that will say something like:
There is no package called ‘’.

This will indicate that for some reasan the package  is not being
installed automatically.

You should try an install.packages("") and then retry
remotes::install_github("kyusque/DBDA2E-utilities")

In some cases there may be one missing package.

On Tue, 1 Jun 2021 at 03:19, Nick Wray  wrote:
>
> Hi John  Thanks but that doesn't work.  When installing the needed packages R 
> is telling me that it can't "lazyload"  DBDA2E-utilities.  Tbh I don't 
> understand what that means. The page I quoted in my OP implies that one 
> should be able to easily upload the file but there are various error messages 
> which come up which again tbh mean nothing to me.  As far as I am aware this 
> file should simply be some straightforward data to do an exercise in the 
> book...  Nick
>
> On Tue, 1 Jun 2021 at 01:26, John Kane  wrote:
>>
>> If it seems to have installed correctly try:
>> library(DBDA2E)
>> which should load the DBDA@E-specific programmes.
>>
>>
>>
>> On Mon, 31 May 2021 at 16:27, Nick Wray  wrote:
>> >
>> > Hello I am trying to download the file "kyusque/DBDA2E-utilities.R" which
>> > is used in following through John Krushke's book on Bayesian stats.
>> > According to the net (kyusque/DBDA2E-utilities: Packaged One for
>> > DBDA2E-utilities.R in 'Kruschke, J. K. (2015). Doing Bayesian Data
>> > Analysis, Second Edition' version 0.1.0 from GitHub (rdrr.io)
>> > <https://rdrr.io/github/kyusque/DBDA2E-utilities/>) I needed to
>> >
>> > install.packages("remotes")
>> > remotes::install_github("kyusque/DBDA2E-utilities")
>> >
>> > which i have done, and seem to have done successfully
>> >
>> > but I can't get hold of the utilities file.  Does anyone know what I
>> > should now do?
>> >
>> > Thanks Nick Wray
>> >
>> > [[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.
>>
>>
>>
>> --
>> John Kane
>> Kingston ON Canada



-- 
John Kane
Kingston ON Canada

__
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] DBDA2E-utilities.R file download

2021-05-31 Thread John Kane
If it seems to have installed correctly try:
library(DBDA2E)
which should load the DBDA@E-specific programmes.



On Mon, 31 May 2021 at 16:27, Nick Wray  wrote:
>
> Hello I am trying to download the file "kyusque/DBDA2E-utilities.R" which
> is used in following through John Krushke's book on Bayesian stats.
> According to the net (kyusque/DBDA2E-utilities: Packaged One for
> DBDA2E-utilities.R in 'Kruschke, J. K. (2015). Doing Bayesian Data
> Analysis, Second Edition' version 0.1.0 from GitHub (rdrr.io)
> <https://rdrr.io/github/kyusque/DBDA2E-utilities/>) I needed to
>
> install.packages("remotes")
> remotes::install_github("kyusque/DBDA2E-utilities")
>
> which i have done, and seem to have done successfully
>
> but I can't get hold of the utilities file.  Does anyone know what I
> should now do?
>
> Thanks Nick Wray
>
> [[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.



-- 
John Kane
Kingston ON Canada

__
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] input string ... cannot be translated to UTF-8, is it valid in 'ANSI_X3.4-1968'?

2021-04-25 Thread John Kane
The tab format seems to read in with no problem.

On Thu, 22 Apr 2021 at 23:08, Duncan Murdoch  wrote:
>
> On 22/04/2021 9:25 p.m., Spencer Graves wrote:
> > Hello:
> >
> >
> > What if anything should I do regarding notes from either "load" or
> > "attach" that, "input string ... cannot be translated to UTF-8, is it
> > valid in 'ANSI_X3.4-1968'?"?
>
> First, ANSI_X3.4-1968  is an official name for for a version of Ascii.
> It appears in the file near the start, where I believe it records the
> native encoding in place when the file was written, so readers using a
> different encoding can translate.
>
> Your actual file appears to have been encoded in UTF-8, but not marked
> as such.  You're lucky you read it on macOS, where UTF-8 is the native
> encoding, since the reader probably recognized the bytes weren't ascii
> bytes (and warned you about that), then just left them alone.  If you
> read that file on Windows you'd likely get junk for those entries.
>
> For your interest, here's a dump of the start of your file, after
> gunzipping it:
>
>   52 44 58 33 0a 58 0a 00  00 00 03 00 03 06 00 00
> |RDX3.X..|
> 0010  03 05 00 00 00 00 0e 41  4e 53 49 5f 58 33 2e 34
> |...ANSI_X3.4|
> 0020  2d 31 39 36 38 00 00 04  02 00 00 00 01 00 04 00
> |-1968...|
> 0030  09 00 00 00 01 78 00 00  03 13 00 00 00 10 00 00
> |.x..|
> 0040  02 0e 00 00 02 6e 40 90  0c 00 00 00 00 00 40 90
> |.n@...@.|
> 0050  44 00 00 00 00 00 40 10  00 00 00 00 00 00 40 7c
> |D.@...@||
>
> Duncan Murdoch
>
> >
> >
> > I'm running R 4.0.5 under macOS 11.2.3;  see "sessionInfo()" and
> > detailed instructions below on the precise file I dowloaded from the web
> > and tried to read.
> >
> >
> > I may be able to get what I want just ignoring this.  However, I'd
> > like to know how to fix this.
> >
> >
> > Thanks,
> > Spencer Graves
> >
> >
> > sessionInfo()
> > R version 4.0.5 (2021-03-31)
> > Platform: x86_64-apple-darwin17.0 (64-bit)
> > Running under: macOS Big Sur 10.16
> >
> > Matrix products: default
> > LAPACK:
> > /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
> >
> > locale:
> > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> >
> > attached base packages:
> > [1] stats graphics  grDevices utils datasets  methods   base
> >
> > loaded via a namespace (and not attached):
> >[1] compiler_4.0.5htmltools_0.5.1.1 tools_4.0.5   yaml_2.2.1
> >
> >[5] tinytex_0.31  rmarkdown_2.7 knitr_1.31
> > digest_0.6.27
> >[9] xfun_0.22 rlang_0.4.10  evaluate_0.14
> >   > search()
> >[1] ".GlobalEnv""file:NAVCO 1.3 List.RData"
> >[3] "file:NAVCO 1.3 List.RData" "tools:rstudio"
> >[5] "package:stats" "package:graphics"
> >[7] "package:grDevices" "package:utils"
> >[9] "package:datasets"  "package:methods"
> > [11] "Autoloads" "package:base"
> >
> >
> > *** To get the file I used for this, I went to
> > "https://www.ericachenoweth.com/research;.  From there I clicked
> > "Version 1.3".  This took me to
> >
> >
> > https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/ON9XND
> >
> >
> > I then clicked the "Download" icon to the right of "NAVCO 1.3 List.tab".
> >This gave me 5 "Download Options", one of which was "RData Format";  I
> > selected that.  This downloaded "NAVCO 1.3 List.RData", which I moved to
> > getwd().  Then I did 'load("NAVCO 1.3 List.RData")' and 'attach("NAVCO
> > 1.3 List.RData")'.  Both of those gave me 8 repetitions of a message
> > like "input string ... cannot be translated to UTF-8, is it valid in
> > 'ANSI_X3.4-1968'?" with different values substituted for "...".
> >
> > __
> > 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.



-- 
John Kane
Kingston ON Canada

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


Re: [R] Query

2021-04-25 Thread John Kane
What package has the irf function?

On Fri, 23 Apr 2021 at 09:34, Sun Yong Kim
 wrote:
>
> Hi
>
> I have been trying to circulate a question but my question keeps getting 
> rejected. Let me try again via email. The message is below:
>
> I am trying to change the tick size for IRF graphs that I created using the 
> following code below:
>
> par(mfrow=c(2,3))
> IRF_F2 <- irf(SVARmod1, impulse="deltaw2",
>   response=c("Belgium","France","Germany","Italy","Netherlands"),
> n.ahead=60)
> plot(IRF_F2,ylim=c(-0.5,0.3), plot.type="single", main="US Wealth Share
> Shock")
>
> The code gives me the following IRFs I have attached to this email. However 
> the tick intervals is way too small and I want to change it to intervals of 
> 10. I was thinking something like:
>
> par(mfrow=c(2,3))
> IRF_F2 <- irf(SVARmod1, impulse="deltaw2",
>
> response=c("Belgium","France","Germany","Italy","Netherlands"),
> n.ahead=60)
> plot(IRF_F2,ylim=c(-0.5,0.3), plot.type="single", main="US Wealth
> Share Shock", xaxt="n")
> axis(side= 1, at = c(10, 20, 30, 40, 50, 60))
>
> But it doesn't work. Any suggestions on how to reduce the tick interval?
> __
> 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.



-- 
John Kane
Kingston ON Canada

__
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] Can't save files from the Source pane of R Studio

2021-03-22 Thread John Kane
Rui is correct but you should also check that you have write--permission to
the directory you are accessing

On Mon, 22 Mar 2021 at 14:28, Parkhurst, David  wrote:

> I’m just starting to learn and use R Studio in my Mac.  Now I find if I
> type lines in what I think is called the source pane, and use Save as from
> the menu, nothing gets saved.  That’s true if I add the extension .R or the
> extension .txt.  If I try reopen the file in an empty source pane, it’s
> empty.  And even if I open the file in a text editor, it’s blank.  How can
> I save my work from R Studio?
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Command history

2021-02-28 Thread John Kane
I think it may depend on your operating system.  In my case, Ubuntu 20.10,
it is a hidden file at /home level.

On Sun, 28 Feb 2021 at 08:40, Mahmood Naderan-Tahan <
mahmood.nade...@ugent.be> wrote:

> Hi
>
> May I know where is the location of commands we used in R in the history?
>
>
> Regards,
> Mahmood
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] Help Required for R Markdown function.

2021-02-27 Thread John Kane
The "confusionMatrix" function appears to be from the 'caret' package.
Have you loaded 'caret' with the library(caret) command?

On Sat, 27 Feb 2021 at 14:20, Kishor raut  wrote:

> Respected Sir,
>
> I Mr Kishor Tried to get help online but wont found the solution so
> writting an email.
>
> Step1: While writting in rmarkdown all codes get executted very well till
> the fuction
> Confusionmatrix were written on it.
>
> Step2: As confusionmatrix command inserted following error is on screen
> board
>
>
> processing file: RMarkdown.Rmd
>   |. |
>   7%
>   ordinary text without R code
>
>   |. |
>  13%
> label: unnamed-chunk-1
>   |..|
>  20%
>   ordinary text without R code
>
>   |...   |
>  27%
> label: unnamed-chunk-2
>   |...   |
>  33%
>   ordinary text without R code
>
>   |  |
>  40%
> label: unnamed-chunk-3
>   |. |
>  47%
>   ordinary text without R code
>
>   |. |
>  53%
> label: unnamed-chunk-4
>   |..|
>  60%
>   ordinary text without R code
>
>   |...   |
>  67%
> label: unnamed-chunk-5
>   |...   |
>  73%
>   ordinary text without R code
>
>   |  |
>  80%
> label: unnamed-chunk-6
>   |. |
>  87%
>   ordinary text without R code
>
>   |. |
>  93%
> label: unnamed-chunk-7
> Quitting from lines 98-104 (RMarkdown.Rmd)
> Error in confusionMatrix(p1, train$CTestresult) :
>   could not find function "confusionMatrix"
> Calls:  ... handle -> withCallingHandlers -> withVisible -> eval
> -> eval
>
> Execution halted
>
> Step4: As codes were written these
>
>
> Using function “sample” the data takes into sample of the specified size
> from the stored data
> ```{r}
> set.seed(1234)
> ind<-sample(2,nrow(FEVER1),replace=TRUE, pro = c(0.7,0.3))
> train<-FEVER1[ind==1,]
> test<-FEVER1[ind==2,]
> ```
>
> Application of Random Forest
>
> ```{r}
> library(randomForest)
> set.seed(123)
> rfmodel<-randomForest(CTestresult~.,data = train,prox=TRUE)# Random
> Forest Model
> plot(rfmodel,main="RandomForest Model")
> print(rfmodel,train)# Printing Outcome of 'model for
> Training Data
>
> ```
>
> Prediction using Randome Forest Model
> ```{r}
> # Prediction  of RandomForest Intial Model for Test and Train Data
>
> ptrain1<-predict(rfmodel,train)  # Predicting model Prediction
> On Training Data
>   # First Six Outcomes with prediction
> head(ptrain1)  # Printing First Six Prediction
> using Random Forest Model
> head(train$CTestresult)   # Printing First Six (6)
> Actual outcomes
>
> ```
>
>
> Tuning Model:
> Tuning of Machine learning model is important step for building good model
> for best outcome of research.
>
> ```{r}
> # Tunning RandomForest  Model using Algorithm
>
> t<-tuneRF(train[,-11],train$CTestresult, mtryStart = 2,ntreeTry = 100,
> stepFactor =2,improve = 0.051,trace = TRUE, plot = TRUE, doBest=TRUE)
>
>
> ```
>
> Building New Model:
>
> New model was build on the basis of tunned model parameters and controls.
>
> ```{r}
> # New Model After Tuning Random Forest Model
>
> rf1<-randomForest(CTestresult~.,data = train,ntree = 100, mtry = 8,
> importance = TRUE,proximity = TRUE)
>
> print(rf1)
> ```
>
> Prediction and Confusion MAtrix:
>
> outcome of model will mesuare with the help of predictive outcomes with the
> help of confusion matrix.
>
> ```{r}
> # Prediction using Random Forest and Confusion Matrix for Train Data
> p1<-predict(rf1,train)
> cmatrix<-confusionMatrix(p1,train$CTestresult)
> cmatrix
>
>
> ```
>
>
> I will great thank full if you will help me for to remove

Re: [R] Undesired result

2021-02-17 Thread John Kane
You have 4 " addFormats" commands. Maybe add one more?

On Wed, 17 Feb 2021 at 10:00, Val  wrote:

> HI All,
>
> I am reading a data file which has different date formats. I wanted to
> standardize to one format and used  a library anytime but got
> undesired results as shown below. It gave me year 2093 instead of 1993
>
>
> library(anytime)
> DFX<-read.table(text="name ddate
>   A  19-10-02
>   D  11/19/2006
>   F  9/9/2011
>   G1  12/29/2010
>   AA   10/18/93 ",header=TRUE)
> getFormats()
> addFormats(c("%d-%m-%y"))
> addFormats(c("%m-%d-%y"))
> addFormats(c("%Y/%d/%m"))
> addFormats(c("%m/%d/%y"))
>
> DFX$anew=anydate(DFX$ddate)
>
> Output
>  name  ddate   anew
> 1A   19-10-02 2002-10-19
> 2D 11/19/2006 2020-11-19
> 3F   9/9/2011 2011-09-09
> 4   G1 12/29/2010 2020-12-29
> 5   AA   10/18/93 2093-10-18
>
> The problem is in the last row. It should be  1993-10-18 instead of
> 2093-10-18
>
> How do I correct this?
> Thank you.
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] Axis whitout all the row, that contains time

2021-02-12 Thread John Kane
With a dat.frame "mydata" create a new variable mydata$num
mydata$num  <-  1:nrow(mydata)

new_data  <-  subset(mydata, num == 10)

plot using new_data

On Fri, 12 Feb 2021 at 10:35, Informatique <
informati...@billard-francois-marie.eu> wrote:

> Hello,
>
> i'm using Rstudio from a few day, and i have some information in a CVS
> file, take every five second, format of the time is HH:MM:SS.
> I use the hour on the X axis, but i don't want having all the time print.
> For example only every 10 values.
>
> I think it will be possible with   scale_x_datetime(breaks =
> date_breaks(XXX)
>
> but i don't understand how select every 20 s.
>
> Thank's for your help
>
> François-marie BILLARD
> --
> Informatique 
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Need help using lattice

2021-02-08 Thread John Kane
 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

On Mon, 8 Feb 2021 at 03:11, PIKAL Petr  wrote:

> Hi
>
> Please do not use HTML formating.
> Please provide some toy data if you want to get reasonable help.
>
> You could also look at ggplot package, e.g.
>
> https://ggplot2.tidyverse.org/reference/facet_grid.html
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help  On Behalf Of Parkhurst,
> David
> > F.
> > Sent: Sunday, February 7, 2021 8:02 PM
> > To: r-help@r-project.org
> > Subject: [R] Need help using lattice
> >
> > I have a dataframe comprising a vector of E. coli concentrations, a
> vector of
> > months when the samples were taken, and a vector of sampled sites.  I�d
> > like to produce a lattice with sites along the horizontal axis, and
> months on
> > the vertical.  Each site-month box would then contain concentrations
> ranging
> > along its x axis.
> >
> >
> >
> > I think this would use dotchart (or possibly stripchart) in the
> lattice.  I�ve
> > been reading the lattice and xyplot documents and I�m overwhelmed.  I�d
> > appreciate help in how to write the call.
> >
> >
> >
> > David
> >
> >
> >   [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] problem installing R and RStudio

2021-01-26 Thread John Kane
A couple of Window solutions
https://community.rstudio.com/t/problems-with-r-4-0-0-windows-error-package-or-namespace-load-failed-for-stats-in-indl-x-as-logical-local-as-logical-now/62958

https://github.com/rdotnet/rdotnet/issues/62

No idea if they are of any use.

On Mon, 25 Jan 2021 at 19:43, Jeff Newmiller 
wrote:

> Your installation of R seems broken. Since RStudio sometimes tries to
> simplify things and sometimes misses and we aren't typically up to speed
> with their latest procedures, please describe what you did to install R in
> terms related to the instructions on CRAN [1] and its install program. When
> you can run R from RGui or the CMD prompt then you may get lucky and
> RStudio will just work. If you aren't lucky connecting your working R to
> RStudio  then you will probably need to ask them [2] for assistance.
>
> Also, the Posting Guide points out that this is a plain text mailing
> list... sending HTML email through this list is erratic... if you want to
> insure we get your message as you sent it, set your email client to send
> plain text format.
>
> [1] https://cran.r-project.org/bin/windows/base/
> [2] https://community.rstudio.com/
>
> On January 25, 2021 2:40:45 PM PST, Carlos Gonzalez 
> wrote:
> >Dear,
> >
> >I've just installed R and RStudio. Opening RStudio the following
> >appears in
> >the console.
> >
> >
> >R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
> >Copyright (C) 2020 The R Foundation for Statistical Computing
> >Platform: x86_64-w64-mingw32/x64 (64-bit)
> >
> >R is free software and comes with ABSOLUTELY NO WARRANTY.
> >You are welcome to redistribute it under certain conditions.
> >Type 'license()' or 'licence()' for distribution details.
> >
> >  Natural language support but running in an English locale
> >
> >R is a collaborative project with many contributors.
> >Type 'contributors()' for more information and
> >'citation()' on how to cite R or R packages in publications.
> >
> >Type 'demo()' for some demos, 'help()' for on-line help, or
> >'help.start()' for an HTML browser interface to help.
> >Type 'q()' to quit R.
> >
> >Error: package or namespace load failed for ‘stats’ in inDL(x,
> >as.logical(local), as.logical(now), ...):
> > unable to load shared object 'C:/Program
> >Files/R/R-4.0.3/library/stats/libs/x64/stats.dll':
> >  LoadLibrary failure:  The specified module could not be found.
> >
> >During startup - Warning message:
> >package ‘stats’ in options("defaultPackages") was not found
> >Error in inDL(x, as.logical(local), as.logical(now), ...) :
> >  unable to load shared object 'C:/Program
> >Files/R/R-4.0.3/library/stats/libs/x64/stats.dll':
> >  LoadLibrary failure:  The specified module could not be found.
> >>
> >I would very much appreciate it if you could help solving this problem.
> >
> >Saludos / Regards
> >
> >Carlos A. Gonzalez
> >Mobile +598 94 234 653
> >cag...@gmail.com
> >
> >   [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] rmarkdown and source call to R file.

2021-01-22 Thread John Kane
You would be better to try https://community.rstudio.com. Shiny is
basically Tidyverse/Rstudio item and there will be a lot more expertise
there.

On Fri, 22 Jan 2021 at 02:02, Georgios via R-help 
wrote:

> Hi!
> I'm new in R and this list.
> I made a shiny app using R studio.
> my files are:
>-server.R
>-ui.R
>-helper.R
>-Report.Rmd.
>
> All the files are on the same directory and helper.R is a file that
> contains a lot of functions used in Report.Rmd and server.R
>
> for some reason I cant call from Report.Rmd the file helper.R
>
> My code in Report.Rmd is
>
>## Summarize table
>```{r, echo=FALSE}
>library(knitr)
>source("helper.R", local = knitr::knit_global())
>summarized_table<-give_table(params$ldf_summary)
>kable(summarized_table,"simple")
>```
> If I use absolute path it works but since I want to upload it to
> https://www.shinyapps.io/ I must make it work with relative path.
>
> The message I get is:
>
>processing file: Report.Rmd
>
>|..
> |  25%
>  ordinary text without R code
>
>
>|
> |  50%
>label: unnamed-chunk-1 (with options)
>List of 1
> $ echo: logi FALSE
>
>Quitting from lines 13-17 (Report.Rmd)
>
>Warning: Error in file: cannot open the connection
>  [No stack trace available]
>
>
> The funny thing is that if I put the cursor inside "" at the beginning
> and I press tab I get the option to choose helper.R. So Im guessing
> that I'm on the right directory.
> Any ideas what I'm missing?
>
> I'm stuck on this lines of code 2 days now.
> I would really appreciate
> any ideas.
>
>
> Thanks in advance for your help!!!
>
>
> ps. I tried all the combinations in Tools->Global Options-> "Evaluate
> chunks in directory" with no luck.
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Find the number of clusters using clusGAP function in R

2021-01-20 Thread John Kane
Crossposted at
https://community.rstudio.com/t/find-the-number-of-clusters-using-clusgap-function-in-r/93586

There is nothing wrong with crossposting but one should mention it to help
avoid duplication of effort

On Wed, 20 Jan 2021 at 09:46, Jovani T. de Souza 
wrote:

> Could you help me find the ideal number of clusters using the `clusGap
> `function? There is a similar example in this link:
>
> https://www.rdocumentation.org/packages/factoextra/versions/1.0.7/topics/fviz_nbclust
>
>  But I would like to do it for my case. My code is below:
>
> library(cluster)
>
> df <- structure(
> list(Propertie = c(1,2,3,4,5,6,7,8), Latitude = c(-24.779225,
> -24.789635, -24.763461, -24.794394,
> -24.747102,-24.781307,-24.761081,-24.761084),
> Longitude = c(-49.934816, -49.922324, -49.911616, -49.906262,
> -49.890796,-49.8875254,-49.8875254,-49.922244),
> waste = c(526, 350, 526, 469, 285, 433, 456,825)),class = "data.frame",
> row.names = c(NA, -8L))
>
> df<-scale(df)
>
> hcluster = clusGap(df, FUN = hcut, K.max = 100, B = 50)
> Clustering k = 1,2,..., K.max (= 100): .. Error in sil.obj[, 1:3] :
> incorrect number of dimensions
>
>
> [image: Mailtrack]
> <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> Remetente
> notificado por
> Mailtrack
> <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> 20/01/21
> 11:45:50
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] writing a function to work with dplyr::mutate()

2021-01-19 Thread John Kane
 %>%
> >>   select(new)
> >>
> >>  res
> >>
> >> }
> >>
> >> test1 <- data.frame(old = c(99,95,93, 8))lup <- data.frame(bif = c(93,
> 95,
> >> 99),
> >>new = c(3, 5, NA))
> >> translate_seer_numeric(test1, 90, lup)
> >>
> >> The above test generates the desired output:
> >>
> >>old1  992  953  934   8
> >>new1  NA2   53   34   8
> >>
> >> My problem comes when I try to put this in line with pipes and the
> mutate
> >> function:
> >>
> >> test1 %>%
> >>   mutate(varb = translate_seer_numeric(var = old, 90, lup))
> >>   Error: Problem with `mutate()` input `varb`.
> >> x Join columns must be present in data.
> >> x Problem with `old`.
> >> i Input `varb` is `translate_seer_numeric(var = test1$old, 90, lup)`.
> >>
> >> Thoughts??
> >>
> >>  [[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-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.
>


-- 
John Kane
Kingston ON Canada

[[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 in is biallelic

2020-11-06 Thread John Kane
Ah, good point.

On Fri, 6 Nov 2020 at 20:24, David Winsemius  wrote:

>
> On 11/6/20 4:11 PM, John Kane wrote:
> > I think we need a lot mole information.
> >
> > see these links for suggestions on how to ask a question.
> >
> >   http://adv-r.had.co.nz/Reproducibility.html
> >
> >
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>
> I agree that more information would be needed for a considered answer
> but I also suspect that placement of the question in a venue that had a
> larger population of persons knowledgeable about the domain of genomics
> might be helpful as well. Two possibilities: The BioConductor mailing
> list and the BioInformatics StackExchange forum.
>
> --
>
> David
>
> >
> >
> > On Fri, 6 Nov 2020 at 14:37, Sakthipriya M <
> sakthipriyamathava...@gmail.com>
> > wrote:
> >
> >> Hi,
> >> am trying to run the following using my SNP data vcf file
> >> maizelight <- vcfR2genlight(maizevcf,n.cores=1)
> >> Why am getting error
> >> Error in is.biallelic(x) :
> >>trying to get slot "fix" from an object (class "spec_tbl_df") that
> is not
> >> an S4 object
> >>
> >> anybody help to solve this, am just trying comments of R newly.
> >> __
> >> 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.
> >>
> >
>


-- 
John Kane
Kingston ON Canada

[[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 in is biallelic

2020-11-06 Thread John Kane
I think we need a lot mole information.

see these links for suggestions on how to ask a question.

 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example


On Fri, 6 Nov 2020 at 14:37, Sakthipriya M 
wrote:

> Hi,
> am trying to run the following using my SNP data vcf file
> maizelight <- vcfR2genlight(maizevcf,n.cores=1)
> Why am getting error
> Error in is.biallelic(x) :
>   trying to get slot "fix" from an object (class "spec_tbl_df") that is not
> an S4 object
>
> anybody help to solve this, am just trying comments of R newly.
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Exporting SPSS Dataset to STATA format

2020-10-28 Thread John Kane
What have you tried so far?

The method shown here https://www.statmethods.net/input/exportingdata.html
should work.

On Wed, 28 Oct 2020 at 11:06, nelgyn tennyson  wrote:

> *Dear Sir/Madam,*
>
> *   Subject : Exporting SPSS Dataset to STATA format*
>
> I have a SPSS file which i am able to import into R via Rcmdr or Rstudio.
> But i am unable to export the same file into STATA format.
> It would be kind of you to kindly help me achieve the same and send me  a
> sample R script whcih could be used for the same purpose.
>
> *Thanks and Regards*
> *Nelgyn Tennyson *
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Reference to cite stats package

2020-10-28 Thread John Kane
citation("packagename")


citation("lubridate")

==
To cite lubridate in publications use:

  Garrett Grolemund, Hadley Wickham (2011). Dates and Times Made
  Easy with lubridate. Journal of Statistical Software, 40(3),
  1-25. URL http://www.jstatsoft.org/v40/i03/.

A BibTeX entry for LaTeX users is

  @Article{,
title = {Dates and Times Made Easy with {lubridate}},
author = {Garrett Grolemund and Hadley Wickham},
journal = {Journal of Statistical Software},
year = {2011},
volume = {40},
number = {3},
pages = {1--25},
url = {http://www.jstatsoft.org/v40/i03/},
  }

==





On Wed, 28 Oct 2020 at 11:07, Iriel Joerin  wrote:

> Hi,
> I´m using the R package stats for some analysis, I would like to know if
> there is any special reference paper to cite this package or just the R
> paper itself.
> Thank you very much for your answer,
> Iriel Joerin
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] [External] Re: Package recommendations for outputting table with cell formatting

2020-10-23 Thread John Kane
Blast it,  *I forgot that and I usually load Hmisc as a default.*


On Fri, 23 Oct 2020 at 23:24, Richard M. Heiberger  wrote:

> To John and everyone else,
>
> Please add Hmisc::latex to your  how-to-make-beautiful-tables-in-r
> document.
> We first included latex() in S in 1995, and it is still actively
> maintained and improved.
>
> Rich
>
> Here are the first few lines of ?latex
>
> Convert an S object to LaTeX, and Related Utilities
>
> Description:
>
>  ‘latex’ converts its argument to a ‘.tex’ file appropriate for
>  inclusion in a LaTeX2e document.  ‘latex’ is a generic function
>  that calls one of ‘latex.default’, ‘latex.function’, ‘latex.list’.
>
>  ‘latex.default’ does appropriate rounding and decimal alignment
>  and produces a file containing a LaTeX tabular environment to
>  print the matrix or data.frame ‘x’ as a table.
>
>  ‘latex.function’ prepares an S function for printing by issuing
>  ‘sed’ commands that are similar to those in the ‘S.to.latex’
>  procedure in the ‘s.to.latex’ package (Chambers and Hastie, 1993).
>  ‘latex.function’ can also produce ‘verbatim’ output or output that
>  works with the ‘Sweavel’ LaTeX style at   http://biostat.mc.vanderbilt.edu/SweaveTemplate>.
>
>
> On Fri, Oct 23, 2020 at 11:11 PM John Kane  wrote:
> >
> > This comes with no guarantee since i have only tried one or two packages
> > mentioned but have a look at https://rfortherestofus.com/2019/11/how-to-make-beautiful-tables-in-r/;>
> R
> > Tables.
> >
> >
> > On Fri, 23 Oct 2020 at 20:28, Dennis Fisher 
> wrote:
> >
> > > R 4.0.2
> > > OS X
> > >
> > > Colleagues
> > >
> > > I have the unfortunate need to create a large number of tables
> (destined
> > > for a Word document).  I need to color cells depending on the contents,
> > > e.g., blue if the value is < 0.5, red if the value is > 1.5.
> > > If the output went initially to Excel, that would work; outputting
> > > directly to Word would be even better.
> > > I expect that several packages can accomplish this.  I am looking for
> > > recommendations as to which package (or combination) of packages is
> best to
> > > accomplish this.
> > >
> > > Dennis
> > >
> > > Dennis Fisher MD
> > > P < (The "P Less Than" Company)
> > > Phone / Fax: 1-866-PLessThan (1-866-753-7784)
> > > www.PLessThan.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.
> > >
> >
> >
> > --
> > John Kane
> > Kingston ON Canada
> >
> > [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Package recommendations for outputting table with cell formatting

2020-10-23 Thread John Kane
This comes with no guarantee since i have only tried one or two packages
mentioned but have a look at https://rfortherestofus.com/2019/11/how-to-make-beautiful-tables-in-r/;> R
Tables.


On Fri, 23 Oct 2020 at 20:28, Dennis Fisher  wrote:

> R 4.0.2
> OS X
>
> Colleagues
>
> I have the unfortunate need to create a large number of tables (destined
> for a Word document).  I need to color cells depending on the contents,
> e.g., blue if the value is < 0.5, red if the value is > 1.5.
> If the output went initially to Excel, that would work; outputting
> directly to Word would be even better.
> I expect that several packages can accomplish this.  I am looking for
> recommendations as to which package (or combination) of packages is best to
> accomplish this.
>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone / Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.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.
>


-- 
John Kane
Kingston ON Canada

[[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] write.csv covert Åland to land

2020-10-20 Thread John Kane
It looks like an encoding problem.

It works fine for me with R encoding set to UTF-8

Here is part of my sessionInfo() results
[1] LC_CTYPE=en_CA.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_CA.UTF-8LC_COLLATE=en_CA.UTF-8
 [5] LC_MONETARY=en_CA.UTF-8LC_MESSAGES=en_CA.UTF-8

I would suggest issuing the command
sessionInfo()
and seeing what your encoding is.



On Tue, 20 Oct 2020 at 08:22, Jinsong Zhao  wrote:

> Hi there,
>
> Why the same string is displayed in different form?
>
>  > abc[,1]
> [1] "Åland"   "Afghanistan"
>  > abc
>   name
> 1land
> 2 Afghanistan
>
> And more...
>
>  > dput(abc, "aa.txt")
>  > dget("aa.txt")
>   name
> 1land
> 2 Afghanistan
>  > dget("aa.txt")[,1]
> [1] "land""Afghanistan"
>
> Best,
> Jinsong
>
> On 2020/10/20 17:13, Jinsong Zhao wrote:
> > Hi there,
> >
> > I tried to export the names of country to a csv file with write.csv().
> > In the resulted file, Åland was coverted to land. Is there any way
> > could prevent this happening? Thanks!
> >
> >  > abc
> > [1] "Åland"
> >  > write.table(abc, file = "")
> > "x"
> > "1" "land"
> >
> > Best,
> > Jinsong
> >
> > __
> > 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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] how to overlay two histograms

2020-09-18 Thread John Kane
Is this what you want?

ggplot(d, aes(counts, fill = name)) +
  geom_bar(stat = "bin", position = "dodge")

Note: You probably should play around with the "bin" width.

On Thu, 17 Sep 2020 at 18:05, Ana Marija 
wrote:

> Hello,
>
> I am trying to overlay two histograms with this:
>
> p <- ggplot(d, aes(CHR, counts, fill = name)) + geom_bar(position =
> "dodge")
> p
>
> but I am getting this error:
> Error: stat_count() can only have an x or y aesthetic.
> Run `rlang::last_error()` to see where the error occurred.
>
> my data is this:
>
> > d
>CHR counts name
> 11 193554  old
> 22 220816  old
> 33 174350  old
> 44 163112  old
> 55 168125  old
> 66 182366  old
> 77 143023  old
> 88 147410  old
> 99 122112  old
> 10  10 138394  old
> 11  11 130069  old
> 12  12 124850  old
> 13  13 104119  old
> 14  14  83931  old
> 15  15  72287  old
> 16  16  71550  old
> 17  17  58380  old
> 18  18  76812  old
> 19  19  37040  old
> 20  20  63407  old
> 21  21  33863  old
> 22  22  33812  old
> 23   1 202783  new
> 24   2 252124  new
> 25   3 213337  new
> 26   4 201001  new
> 27   5 207606  new
> 28   6 228133  new
> 29   7 147218  new
> 30   8 177518  new
> 31   9 121276  new
> 32  10 163447  new
> 33  11 158724  new
> 34  12 142183  new
> 35  13 89  new
> 36  14  83043  new
> 37  15  61063  new
> 38  16  55439  new
> 39  17  32883  new
> 40  18  69135  new
> 41  19  16624  new
> 42  20  48541  new
> 43  21  25479  new
> 44  22  19698  new
>
> Basically I need to show counts per CHR in "old" and "new" side by side.
>
> Please advise,
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Writing Persian (Arabic) in a data frame

2020-07-28 Thread John Kane
Just to agree with the other responses, note my default encoding is UTF-8.

> A<-data.frame(x=c("مریم","ماریا"),y=c(1,1))
> A
  x y
1  مریم 1
2 ماریا 1
> str(A)
'data.frame': 2 obs. of  2 variables:
 $ x: chr  "مریم" "ماریا"
 $ y: num  1 1
>  sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_CA.UTF-8   LC_NUMERIC=C
LC_TIME=en_CA.UTF-8LC_COLLATE=en_CA.UTF-8
 [5] LC_MONETARY=en_CA.UTF-8LC_MESSAGES=en_CA.UTF-8
 LC_PAPER=en_CA.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C

On Tue, 28 Jul 2020 at 08:32, Ivan Krylov  wrote:

> On Tue, 28 Jul 2020 10:31:07 +0430
> Vahid Borji  wrote:
>
> > A<-data.frame(x=c("مریم","ماریا"),y=c(1,1))
>
> > The output is like this:
> >
> >  x y1
> >  12
> >  1
>
> This is one of those problems heavily affected by your version of R
> (does it have stringsAsFactors = TRUE or FALSE by default?), your
> operating system and locale (see [*] for a description of
> Unicode-related problems in R on Windows).
>
> Here is a similar problem from 9 years ago where Unicode characters
> were displayed as escapes on Windows with US English (ANSI-1251)
> locale when data.frame() converted strings to factors:
>
> https://r.789695.n4.nabble.com/gsub-with-unicode-and-escape-character-td3672737.html
>
> --
> Best regards,
> Ivan
>
> P.S.
>
> >   [[alternative HTML version deleted]]
>
> Please post in plain text, not HTML.
>
> [*]
>
> https://developer.r-project.org/Blog/public/2020/05/02/utf-8-support-on-windows/index.html
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Fortune nomination .... Re: Looping through a dataframe

2020-07-24 Thread John Kane
Yes I think so.

On Fri, 24 Jul 2020 at 20:53, David Winsemius 
wrote:

>
> On 7/21/20 2:31 PM, Jim Lemon wrote:
> >   I want to get a total for the number of years of data for each
> company. When I loop through the data 
>
> After two one liners using `table`:
> > I'm too lazy to provide a difficult way.
> >
> > Jim
> >
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Arranging ggplot2 objects with ggplotGrob()

2020-07-24 Thread John Kane
Well, I am not looking for help debugging my code but for information to
better understand arranging plots vertically. The code above aligns them
horizontally as expected.

Sigh, we know the code works but we do not know what the plots are   and we
cannot play around with them to see if we can help you if we have nothing
to work with.

On Fri, 24 Jul 2020 at 12:12, H  wrote:

> On 07/24/2020 05:29 AM, Erich Subscriptions wrote:
> > Hav a look at the packages cowplot and patchwork
> >
> >> On 24.07.2020, at 02:36, H  wrote:
> >>
> >> I am trying to arrange two plots vertically, ie plot 2 below plot 1,
> where I want the plots to align columnwise but have a height ratio of eg
> 3:1.
> >>
> >> My attempts so far after consulting various webpages is that the
> following code aligns them columnwise correctly but I have, so far, failed
> in setting the relative heights...
> >>
> >> g2<-ggplotGrob(s)
> >> g3<-ggplotGrob(v)
> >> g<-rbind(g2, g3, size = "first")
> >> g$widths<-unit.pmax(g2$widths, g3$widths)
> >>
> >> what would the appropriate statement for the relative heights to add
> here be?
> >>
> >> grid.newpage()
> >> grid.draw(g)
> >>
> >> Thank you!
> >>
> >> __
> >> 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.
>
> So this is not possible without using one of those two packages? I got the
> impression I should be able to use grid.arrange to do so but was not able
> to get it to work without disturbing the width alignment above...
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Arranging ggplot2 objects with ggplotGrob()

2020-07-24 Thread John Kane
We reallly need to see more code (a minimum working example and some data.

For some suggestions on how to do this see

 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

On Fri, 24 Jul 2020 at 01:16, H  wrote:

> I am trying to arrange two plots vertically, ie plot 2 below plot 1, where
> I want the plots to align columnwise but have a height ratio of eg 3:1.
>
> My attempts so far after consulting various webpages is that the following
> code aligns them columnwise correctly but I have, so far, failed in setting
> the relative heights...
>
> g2<-ggplotGrob(s)
> g3<-ggplotGrob(v)
> g<-rbind(g2, g3, size = "first")
> g$widths<-unit.pmax(g2$widths, g3$widths)
>
> what would the appropriate statement for the relative heights to add here
> be?
>
> grid.newpage()
> grid.draw(g)
>
> Thank you!
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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 in mice package when trying to use subset of variables for imputation model

2020-07-21 Thread John Kane
: NAs introduced by coercion
>
> 9: In data.matrix(data) : NAs introduced by coercion
>
> 10: In data.matrix(data) : NAs introduced by coercion
>
> 11: In data.matrix(data) : NAs introduced by coercion
>
> 12: In data.matrix(data) : NAs introduced by coercion
>
> 13: In data.matrix(data) : NAs introduced by coercion
>
> 14: In data.matrix(data) : NAs introduced by coercion
>
> >mturk.all.imp <- mice(mturk.all, m = 40, method = 'logreg', pred = pred)
>
> Error in parse(text = x, keep.source = FALSE) :
>
>   :1:1: unexpected '<'
>
> 1: <
>
> ^
>
> ```
>
>
>
> Alternatively, I tried the following:
>
>
>
> ```
>
> >inlist <- mturk.all[c("TSHS_1R", "TSHS_2R", "TSHS_3R", "TSHS_4R",
> "TSHS_5R", "TSHS_6R", "TSHS_7R", "TSHS_8R", "TSHS_9R", "TSHS_10R",
> "TSHS_11R", "TSHS_12R", "TSHS_13R", "TSHS_14R", "TSHS_15R", "TSHS_16R",
> "TSHS_17R", "TSHS_18R", "TSHS_19R", "TSHS_20R", "TSHS_21R", "TSHS_22R",
> "TSHS_23R", "TSHS_24R", "TSHS_25R", "TSHS_26R", "TSHS_27R", "TSHS_28R",
> "TSHS_29R", "TSHS_30R", "TSHS_31R", "TSHS_32R", "TSHS_33R")]
>
> >pred <- quickpred(mturk.all, mincor = .1, minpuc = 0, inc=inlist)
>
> >mturk.all.imp <- mice(mturk.all, m = 40, method = 'logreg', pred = pred)
>
> Error in parse(text = x, keep.source = FALSE) :
>
>   :1:1: unexpected '<'
>
> 1: <
>
> ^
>
> ```
>
>
>
> I have also switched out the 'logreg' imputation method with 'pmm' and
> received the same error message.
>
>
>
> Here is a subset of the dataset, mturk.all, and the version of R Studio I
> am using, plus the version of mice I am using.
>
>
>
> ```
>
> > dput(mturk.all[425:434, 1:33])
>
> structure(list(TSHS_1R = c(0, 1, 1, 0, 0, 0, 1, 1, 0, 1), TSHS_2R = c(0,
>
> 0, 0, 1, 0, 0, 0, 0, 0, 0), TSHS_3R = c(0, 1, 0, 0, 0, 0, 0,
>
> 0, 1, 0), TSHS_4R = c(0, 1, 0, 0, 0, 0, 1, 0, 1, 0), TSHS_5R = c(0,
>
> 0, 0, 1, 0, 0, 0, 0, 1, 0), TSHS_6R = c(0, 0, NA, NA, 0, 0, 1,
>
> 0, 0, 0), TSHS_7R = c(0, 0, 0, 1, 0, 1, 1, 0, 0, 0), TSHS_8R = c(1,
>
> 1, 0, 0, 1, 1, 1, 1, 0, 1), TSHS_9R = c(0, 0, 0, 0, 0, 0, 0,
>
> 1, 1, 0), TSHS_10R = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), TSHS_11R = c(0,
>
> 0, NA, 0, 0, 0, 0, 1, 0, 0), TSHS_12R = c(1, 0, 1, 0, 1, 0, 0,
>
> 0, 0, 0), TSHS_13R = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 1), TSHS_14R = c(0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0), TSHS_15R = c(0, 0, 1, 0, 0, 0, 0,
>
> 0, 0, 0), TSHS_16R = c(0, 0, 1, 0, 0, 0, 0, 0, 0, 0), TSHS_17R = c(0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0), TSHS_18R = c(0, 0, 0, 0, 1, 0, 0,
>
> 0, 0, 0), TSHS_19R = c(0, 0, 0, NA, 0, 0, 0, 0, 0, 0), TSHS_20R = c(0,
>
> 0, 0, 1, 0, 0, 0, 0, 0, 0), TSHS_21R = c(0, 0, 0, 0, 1, 0, 0,
>
> 0, 0, 0), TSHS_22R = c(0, 1, 0, 0, NA, 1, 0, 0, 0, 0), TSHS_23R = c(0,
>
> 0, 0, 0, NA, 1, 0, 0, 0, 1), TSHS_24R = c(0, 0, 0, 1, NA, 1,
>
> 0, 1, 1, 0), TSHS_25R = c(1, 1, 1, 0, 1, 1, 1, 1, 1, 1), TSHS_26R = c(1,
>
> 0, 1, 0, 0, 0, 0, 1, 0, 1), TSHS_27R = c(1, 0, 0, 1, 0, 1, 1,
>
> 0, 0, 1), TSHS_28R = c(0, 0, 0, 0, 0, 0, 0, 0, 1, 0), TSHS_29R = c(1,
>
> 0, 0, 0, 1, 0, 0, 0, 0, 0), TSHS_30R = c(0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0), TSHS_31R = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), TSHS_32R = c(0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0), TSHS_33R = c(0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0)), row.names = c(NA, -10L), class = c("tbl_df", "tbl",
>
> "data.frame"))
>
> > rstudioapi::versionInfo()
>
> $`citation`
>
>
>
> To cite RStudio in publications use:
>
>
>
>   RStudio Team (2018). RStudio: Integrated Development for R. RStudio,
> Inc., Boston, MA URL http://www.rstudio.com/.
>
>
>
> A BibTeX entry for LaTeX users is
>
>
>
>   @Manual{,
>
> title = {RStudio: Integrated Development Environment for R},
>
> author = {{RStudio Team}},
>
> organization = {RStudio, Inc.},
>
> address = {Boston, MA},
>
> year = {2018},
>
> url = {http://www.rstudio.com/},
>
>   }
>
>
>
>
>
> $`mode`
>
> [1] "desktop"
>
>
>
> $version
>
> [1] ‘1.2.1335’
>
>
>
> > packageVersion("mice")
>
> [1] ‘3.8.0’
>
> ```
>
>
>
> Any help identifying what I am doing wrong in the code would be
> appreciated!
>
>
>
> Ian
>
> --
> Ian McPhail, M.A.
> Clinical Psychology Graduate Student
> Department of Psychology, University of Saskatchewan
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Looping through a dataframe

2020-07-21 Thread John Kane
It occurs to me a simple table command will do what you say you want but I
suspect the real analysis is more complicated

dat1  <-  data.frame(aa =  sample(letters[1:5], 10, replace = TRUE),
   bb  =  1:10)

 table(dat1$aa)

On Tue, 21 Jul 2020 at 14:01, John Kane  wrote:

> As Bert says that does not look like R
>
> Have a look an these links for some suggestions on asking questions here.
>
>  http://adv-r.had.co.nz/Reproducibility.html
>
>
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>
> On Tue, 21 Jul 2020 at 13:42, Bert Gunter  wrote:
>
>> What language are you programming in? -- it certainly isn't R.
>>
>> I suggest that you stop what you're doing and go through an R tutorial or
>> two before proceeding. This list cannot serve as a substitute for doing
>> such homework (is this homework, btw? -- that's off topic here) nor can we
>> provide such tutorials.
>>
>> I'm pretty sure the answer is quite simple, though it's a bit unclear as
>> you did not provide a reprex (see the posting guide linked below for how
>> to
>> post here). However, I see no purpose in my blurting it out when you do
>> not
>> seem aware of even the most basic R constructs -- e.g. see ?while. Of
>> course, others may disagree and provide you what you seek.
>>
>>
>> Bert Gunter
>>
>> "The trouble with having an open mind is that people keep coming along and
>> sticking things into it."
>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>>
>>
>> On Tue, Jul 21, 2020 at 10:21 AM e-mail ma015k3113 via R-help <
>> r-help@r-project.org> wrote:
>>
>> > Dear All, I have a dataframe which has a few thousand companies with
>> > unique company numbers and names and  each company has data for several
>> > years and each year is stored in a separate row.
>> >
>> > I want to get a total for the number of years of data for each company.
>> > When I loop through the data with the following command  I get a value
>> of
>> > ‘1’ rather than a total of the rows for each company
>> >
>> > All_companies$count <-0
>> >
>> > while All_companies$COMPANY_NAME == All_companies$COMPANY_NAME + 1
>> >
>> > + {All_companies$count=All_companies$count+1}
>> >
>> > Can you kindly help me on this?
>> >
>> > Ahson
>> > [[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.
>>
>
>
> --
> John Kane
> Kingston ON Canada
>


-- 
John Kane
Kingston ON Canada

[[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] Looping through a dataframe

2020-07-21 Thread John Kane
As Bert says that does not look like R

Have a look an these links for some suggestions on asking questions here.

 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

On Tue, 21 Jul 2020 at 13:42, Bert Gunter  wrote:

> What language are you programming in? -- it certainly isn't R.
>
> I suggest that you stop what you're doing and go through an R tutorial or
> two before proceeding. This list cannot serve as a substitute for doing
> such homework (is this homework, btw? -- that's off topic here) nor can we
> provide such tutorials.
>
> I'm pretty sure the answer is quite simple, though it's a bit unclear as
> you did not provide a reprex (see the posting guide linked below for how to
> post here). However, I see no purpose in my blurting it out when you do not
> seem aware of even the most basic R constructs -- e.g. see ?while. Of
> course, others may disagree and provide you what you seek.
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Tue, Jul 21, 2020 at 10:21 AM e-mail ma015k3113 via R-help <
> r-help@r-project.org> wrote:
>
> > Dear All, I have a dataframe which has a few thousand companies with
> > unique company numbers and names and  each company has data for several
> > years and each year is stored in a separate row.
> >
> > I want to get a total for the number of years of data for each company.
> > When I loop through the data with the following command  I get a value of
> > ‘1’ rather than a total of the rows for each company
> >
> > All_companies$count <-0
> >
> > while All_companies$COMPANY_NAME == All_companies$COMPANY_NAME + 1
> >
> > + {All_companies$count=All_companies$count+1}
> >
> > Can you kindly help me on this?
> >
> > Ahson
> > [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Creating xts objects from csv file

2020-07-21 Thread John Kane
Are you sure you loaded the xts library?

On Mon, 20 Jul 2020 at 16:32, Jeff Reichman  wrote:

> R-Help Forum
>
>
>
> Starting to work with xts objects but can't figure out what I'm doing wrong
> when converting *.csv file with a dtg variable to a *.xts object. When I'm
> converting to an appropriate time object all I get are NA, so that's my
> first issue.
>
>
>
> dtg <- c("1/5/2010 2:30", "1/5/2010 10:32", "1/5/2010 12:03")
>
> seq <- c(1,2,3)
>
>
>
> dat <- data.frame(dtg, seq)
>
>
>
> dat$dtg <- as.POSIXlt(dat$dtg, format = "%m/%d/%Y %H:%M")
>
>
>
> dat.xts <- xts(x = dat[,-1], order.by = dat[,1])
>
>
>
> head(dat.xts)
>
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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 Compied for Mac OS X

2020-06-25 Thread John Kane
What you probably have downloaded and installed is R base.  I am not
familiar with "movavg" but "ggplot" is a command from the "ggplot2"
package.  R, in total, consists of R baase and at least 1,000+ packages
that do different things. One installs and uses various packages depending
on the work one is doing. Have a look at https://cran.r-project.org/ for
most of the packages available.

You need to install "ggplot2" independently or install "tidyverse" which
will install "ggplot2" and a number of other often useful programs.

Try 'install.packages("tidyverse") and see what happens.
Or 'install.packages("gplot2")

On Thu, 25 Jun 2020 at 19:09, Gregory Coats via R-help 
wrote:

> Today, I downloaded, and installed the June 6, 2020 version of R, from the
> CRAN official site at Carnegie Mellon University. Unfortunately, while the
> CMU compiled Mac OS X R application provides access to base R stat
> functions, like mean, it does not provide me with access to any of R’s more
> advanced functions like movavg, and ggplot.
> From where can I download a more complete R executable, compiled for Mac
> OS X?
> Greg Coats
>
> http://lib.stat.cmu.edu/R/CRAN/ <http://lib.stat.cmu.edu/R/CRAN/>
> Download R for (Mac) OS X
> R-4.0.2.pkg (notarized and signed)
> > version
> platform   x86_64-apple-darwin17.0
> arch   x86_64
> os darwin17.0
> system x86_64, darwin17.0
> status
> major  4
> minor  0.1
> year   2020
> month  06
> day06
> svn rev78648
> language   R
> version.string R version 4.0.1 (2020-06-06)
> nickname   See Things Now
> > mean
> function (x, ...)
> UseMethod("mean")
> 
> 
> > movavg
> Error: object 'movavg' not found
> > ggplot
> Error: object 'ggplot' not found
> >
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] to read data for GCalignR package

2020-06-08 Thread John Kane
I am not sure what they are doing but have a look at
https://rdrr.io/cran/GCalignR/man/read_peak_list.html




On Mon, 8 Jun 2020 at 17:38, Hui Liu  wrote:

> Dear R-help colleagues,
>
> I am looking for a way to read my txt file into R such that it can pass
> the check_input() function and be processed by in GCalignR.
>
> The vignette mentioned to save data in txt format, with first row listing
> items, 2nd row listing RT and Area, third rows and afterwards concatenate
> multiple RT and area from items listed in first row.
>
> I did this but did not find an effective way to import this data. Tried
> read.delim, scan, read individual and combine into a list. Saved to
> system.file and read as the example data. None worked.
>
> Any suggestions?
>
> Thank you very much.
>
> Hui
>
> Wave Life Sciences Email Confidentiality Notice: This message, including
> any attachments, is for use by the intended recipient(s) and may be
> proprietary, confidential and/or privileged. If you are not the intended
> recipient(s), please destroy all copies of this message and any
> attachments. Any use, forwarding, copying, or printing of this message or
> portion thereof by anyone other than the intended recipient(s) is
> prohibited. This email neither constitutes an agreement to conduct
> transactions by electronic means nor creates any legally binding contract
> or enforceable obligation in the absence of a fully signed written contract.
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] How to fix an error in nonlinear regression

2020-05-27 Thread John Kane
You have subset=state==”treated”). You need to change "treated” to
"treated". Tho " " are formatted in your example.

On Wed, 27 May 2020 at 15:48, Vahid Borji  wrote:

> Hello my R friends,
> I am using the below commands in R:
>
> attach(Puromycin)
> Puromycin
> plot(Puromycin$conc,Puromycin$rate)
> mm=function(conc,vmax,k) vmax*conc/(k+conc)
> mm
>
> mm1=nls(rate~mm(conc,vmax,k),data=Puromycin,start=c(vmax=50,k=0.05),subset=state==”treated”)
> mm1
>
> Unfortunately,  I receive the below error:
>
> Error: unexpected input in
>
> "mm1=nls(rate~mm(conc,vmax,k),data=Puromycin,start=c(vmax=50,k=0.05),subset=state==”"
>
> How can I fix this error?
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Wordcloud warnings

2020-05-23 Thread John Kane
Hi Brian,
i think we may need a bit more information. It looks like you are doing
some text mining; can you tell us what libraries you have loaded and
perhaps provide us with some sample data?
And an example of what you are doing?

See the links below for some suggestions

 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example




On Sat, 23 May 2020 at 02:53, Bryan Mac  wrote:

> Hi,
>
> I am having trouble understanding why I am getting this warning and how to
> fix it. I don’t have any of these functions in my script..
>
> This is the warning:
>
> warning messages:
> 1: in tm_map.simplecorpus(corpus, tm::removepunctuation) : transformation
> drops documents
> 2: in tm_map.simplecorpus(corpus, function(x) tm::removewords(x,
> tm::stopwords())) : transformation drops documents
> 3: in tm_map.simplecorpus(corpus, tm::removepunctuation) : transformation
> drops documents
> 4: in tm_map.simplecorpus(corpus, function(x) tm::removewords(x,
> tm::stopwords())) : transformation drops documents
> 5: in tm_map.simplecorpus(corpus, tm::removepunctuation) : transformation
> drops documents
> 6: in tm_map.simplecorpus(corpus, function(x) tm::removewords(x,
> tm::stopwords())) : transformation drops documents
>
>
> This is the script:
>
>  if (runtype=="native") {
> words <- Corpus(VectorSource(test123b[,2]))
> wordcloud(words, min.freq = minfreq, max.words=300, random.order =
> FALSE ,colors=brewer.pal(9,"Reds")[0:-3])
>
>   }   else {
> wordcloud((as.character(test123[,2])), min.freq = minfreq,
> max.words=300, random.order = FALSE ,colors=brewer.pal(9,"Reds")[0:-3])
>
>   }
>
>
> Best,
> Bryan
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Attribute Combinations

2020-05-21 Thread John Kane
One possible way
library(tidyr)

dat1  <-  structure(list(V1 = c("A", "A", "A", "A", "A", "A", "A", "A",
"A", "A"), V2 = c("A", "B", "A", "A", "A", "B", "C", "C", "B",
"C"), V3 = c("B", "C", "D", "B", "B", "C", "B", "B", "C", "C"
)), class = "data.frame", row.names = c(NA, -10L))

dat2  <-  unite(dat1, att, V1, V2, V3, sep = ",")

prop.table(table(dat2$att))

A,A,B A,A,D A,B,C A,C,B A,C,C
  0.3   0.1   0.3   0.2   0.1

On Thu, 21 May 2020 at 13:22, Jeff Reichman  wrote:

> R-help forum
>
>
>
> Looking for a function or some guidance for obtaining the percentage of
> attribute combinations, for example
>
>
>
> V1   V2   V3
>
> A A B
>
> A B C
>
> A A D
>
> A A B
>
> A A B
>
> A B C
>
> A C B
>
> A C B
>
> A B C
>
> A C C
>
>
>
> Results
>
> A,A,B 0.30
>
> A,B,C 0.30
>
> A,A,D0.10
>
> A,C,B 0.20 etc
>
>
>
> Sincerely
>
>
>
> Jeff Reichman
>
> (314) 457-1966
>
>
>
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] survival anaylsis with tabulated data

2020-05-21 Thread John Kane
 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example



On Thu, 21 May 2020 at 09:16, PIKAL Petr  wrote:

> Hallo
>
> I am not private consultant so please keep your messages on help list.
>
> From help page I understand that the function survtab_ag needs to have
> **specially prepared** data as input. We could only guess if your data are
> in correct format and most probably they are not.
>
> Without knowing details I wonder if anybody is able to help you.
>
> Cheers
> Petr
>
> From: Ergin Artun 
> Sent: Thursday, May 21, 2020 3:08 PM
> To: PIKAL Petr 
> Subject: Re: [R] survival anaylsis with tabulated data
>
> Dear Pical,
> I'm also not  an expert and had a typo error while translating colum names
> at code.
>
> At my data set time(as day), at.risk(people), from0to1(as people with
> event), from0to0(censored values for the function) are integers, Country,
> and the other two columns are charecter strings.
>
> Best regards...
> Tanju
>
> PIKAL Petr <mailto:petr.pi...@precheza.cz>, 21 May 2020 Per, 12:53
> tarihinde şunu yazdı:
> Hi
>
> I am not an expert and cannot give you canned solution, but here are few
> comments:
>
> Without knowing data structure it is hard to decipher where is the problem.
> So posting result of
> str(yourata) or at least part of it hardly anybody could help.
> Cuntry is typo?
> The error could by result of typo or not properly structured data.
>
> This is plain text mail list, please do not use HTML formating.
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help <mailto:r-help-boun...@r-project.org> On Behalf Of Ergin
> Artun
> > Sent: Wednesday, May 20, 2020 2:01 PM
> > To: mailto:r-help@r-project.org
> > Subject: [R] survival anaylsis with tabulated data
> >
> >   Dear R Friends,
> >
> > I'm a medical doctor with some knowledge about statistic and programming.
> > I want to analysis and compare data of different countries with survival
> or
> > popEpi tools in R.
> > I couldn't able to make tables with one row for every people of countries
> > without illness. I can made a data table look like as:
> >
> > time
> > country at.risk from0to1 sk zf from0to0
> > 1 AFG 40363639 1 K F 0
> >
> > I try to prepare for analysis with survtab_ag function of Epi package.
> When
> > I run
> > st <- survtab_ag(time ~ cuntry, data = , surv.type =
> > "surv.obs",surv.breaks=list($time),
> > +  surv.method = "lifetable",
> > +  d = "from0to1")
> > I see just the error message:
> > Error in http://sort.int(x, na.last = na.last, decreasing = decreasing,
> ...) :
> >   'x' must be atomic
> >
> > Can any body help me for preparing this kind tabulated data without
> surv()
> > to other survival functions?
> > Best regards from Turkey
> >
> > Tanju Aktug
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > 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.
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Extracting the first currency value from PDF files

2020-05-13 Thread John Kane
It looks like you are using the str_nth_currency() function from the strex
package but we have no idea of what the pdf files are or how you are
importing them is to R.
We need a lot more information on what you are doing "before" you use the
function.

Have a look at
http://adv-r.had.co.nz/Reproducibility.html
or
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example



On Wed, 13 May 2020 at 09:33, Manish Mukherjee 
wrote:

> Hi All,
>
> Need some help with the following code , i have a number of pdf files ,
> and the first page of those files gives a currency value $xxx,xxx,xxx . How
> to extract this value from a number of PDF files and put it in a data frame
> . I am able to do it for a single file
> with the code where opinions is the text data and 1 is the first currency
> value
> ```
> d=str_nth_currency(opinions, 1)
> df = subset(d, select = c(amount) )
> df
>
> I want this to loop over multiple pdf files
>
> I have tried somesthing like this but not working
> for (i in 1:length(files)){
>   print(i)
>   pdf_text(paste("filepath ", files[i],sep = ""))
>   str_nth_currency(files[i], 1)
> }
>
>
> Please help.
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Need a suggestion on a package to make a figure

2020-05-08 Thread John Kane
What are you doing?

 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

On Fri, 8 May 2020 at 10:50, aiguo li via R-help 
wrote:

> Hello all,
> I need to make a table with a value imaged by greater than certain value
> as attached.  Could you give me a suggestions on which R package will be
> good for this type of table?
> Thanks and stay safe!
> Aiguo__
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Question about package "SentimentAnalysis"

2020-05-08 Thread John Kane
I think your best bet is to ask the author/maintainer, Stefan Feuerriegel
,about this. The reference manual
https://cran.r-project.org/web/packages/SentimentAnalysis/SentimentAnalysis.pdf
gives his email address as 

On Fri, 8 May 2020 at 08:32, Mehdi Dadkhah  wrote:

> Hi,
> I hope you are doing well!
> I read a vignette (
>
> https://cran.r-project.org/web/packages/SentimentAnalysis/vignettes/SentimentAnalysis.html
> )
> about interested package, "SentimentAnalysis". But i faced with a question.
> In mentioned  vignette, the sentiment has been applied on a sentence or
> multiple sentences separately. Can this package calculate sentiment
> direction/score for a long texts?
> for example:
>
> # Create a vector of strings
> documents <- "Wow, I really like the new light sabers!That book was
> excellent.R is a fantastic language.The service in this restaurant was
> miserable.This is neither positive or negative."
>
> # Analyze sentiment
> sentiment <- analyzeSentiment(documents)
>
> Many thanks!
> With best regards,
>
> --
> *Mehdi Dadkhah*
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Web-scraping newbie - dynamic table into R?

2020-04-21 Thread John Kane
Hi Julio,

I am just working on my first cup of tea of the morning so I am not
functioning all that well but I finally noticed that we have dropped the
R-help list.  I have put it back as a recipient as there are a lot of
people that know about 99%+ more than I do about the topic.

I'll keep poking around and see what I can find.

On Sun, 19 Apr 2020 at 22:34, Julio Farach  wrote:

> John,
>
> I again thank you for the reply and continued support.  After a few hours,
> I arrived at the point you describe below; namely extracting elements, but
> from a different tab than the Last 10 Draws, or Winning Numbers tab.
>
> On the website, there are 5 tabs.  The elements you describe below are
> from the 3rd tab, "Odds & Prizes."  Instead of results, that tab describes
> the general odds of the Keno game.  But, I'm seeking the last 10 draws
> shown on the "Winning Numbers," or 4th tab.  I've played around with a CSS
> Selector tool, but I'm unable to extract any details (e.g., a draw number
> or Keno number) from the 4th tab.  I could extract elements of other tabs,
> like you did below, from the 3rd tab.
>
> Please let me know if you learn more or if you have other ideas for me to
> consider.
>
> Regards,
> Julio
>
> On Sun, Apr 19, 2020 at 7:00 PM John Kane  wrote:
>
>> I am a comple newbie too but try this
>> library(rvest)
>>Kenopage <- "
>> https://www.galottery.com/en-us/games/draw-games/keno.html#tab-winningNumbers
>> "
>>
>> Keno <- read_html(Kenopage)
>>
>> tt  <-  html_table(Keno, fill= TRUE)
>>
>> This should give you a list with 10 elements, each of which should be a
>> data.frame
>> Example
>>
>> ken1  <-  tt[[1]]
>> str(ken1)
>>
>> > str(ken1)
>> 'data.frame': 12 obs. of  4 variables:
>>  $ Numbers Matched : chr  "10" "9" "8" "7" ...
>>  $ Base Keno! Prize: chr  "$100,000*" "$5,000" "$500" "$50" ...
>>  $ + Bulls-Eye Prize   : chr  "$200,000*" "$20,000" "$1,500" "$100"
>> ...
>>  $ Keno! w/ Bulls-Eye Prize: chr  "$300,000" "$25,000" "$2,000" "$150" ...
>> >
>>
>> I figured this out a little a few ago and just manually stepped through
>> the data.frames to get what I wanted. Brute force and stupidity but it
>> worked
>>
>> Someday I may figure out how to use things like SelectorGadget!
>>
>>
>>
>>
>> On Sun, 19 Apr 2020 at 17:46, Julio Farach  wrote:
>>
>>> John - I corrected my email below for typos.
>>>
>>> On Sun, Apr 19, 2020 at 5:42 PM Julio Farach  wrote:
>>>
>>>> John,
>>>>
>>>> Yes, while I can execute the line of code that I provided, I am still
>>>> unable to capture the table shown in the browser.  The last 10 draws are
>>>> shown in a table if you view the page:
>>>>
>>>> https://www.galottery.com/en-us/games/draw-games/keno.html#tab-winningNumbers
>>>>
>>>>
>>>> But, despite using CSS and XPath combinations of
>>>> >html_nodes(x, CSS or XPath)
>>>> I am unable to copy that table into R.
>>>>
>>>> One commenter on another forum received an error and suggested that
>>>> perhaps bots lack permission to access the page.  But, I've used the
>>>> Robotstxt package to ensure that bots are indeed permitted.
>>>>
>>>> Any thoughts?
>>>>
>>>> Regards,
>>>> Julio
>>>>
>>>> On Sun, Apr 19, 2020 at 4:38 PM John Kane  wrote:
>>>>
>>>>> Keno <- read_html(Kenopage) ?
>>>>>
>>>>> Or Am I misunderstanding the problem?
>>>>>
>>>>> On Sun, 19 Apr 2020 at 15:10, Julio Farach  wrote:
>>>>>
>>>>>> How do I scrape the last 10 Keno draws from the Georgia lottery into
>>>>>> R?
>>>>>>
>>>>>>
>>>>>> I'm trying to pull the last 10 draws of a Keno lottery game into R.
>>>>>> I've
>>>>>> read several tutorials on how to scrape websites using the rvest
>>>>>> package,
>>>>>> Chrome's Inspect Element, and CSS or XPath, but I'm likely stuck
>>>>>> because
>>>>>> the table I seek is dynamically generated using Javascript.
>>>>>>
>>>>>>
>>>>>>
&g

Re: [R] how to create a sorted barplot and colored by groups

2020-04-19 Thread John Kane
"MYC"   "MYCL"  "MYCN"  "types"
"DIPG_IV_1" 13.63   0.290   "DIPG"
"DIPG_IV_2" 15.20.170   "DIPG"
"DIPG_IV_3" 11.68   0.080   "DIPG"
"BT142_1"   45.95   2.028.23"MCL"
"BT142_2"   45.43   2.399.77"MCL"
"BT142_3"   48.88   1.7110.31   "MCL"
"DIPG_24_1" 35.75   0.4614.92   "DIPG"
"DIPG_24_2" 38.48   0.7813.08   "DIPG"
"DIPG_24_3" 34.22   0.7511.73   "DIPG"
"GSC923_1"  16.93   5.75207.18  "glioma"
"GSC923_2"  15.63   5.75226.94  "glioma"
"GSC923_3"  14.93   6.59216.57  "glioma"
"DIPG_38_1" 3.4 14.48   10.2"DIPG"
"DIPG_38_2" 5.6212.27   12.37   "DIPG"
"DIPG_38_3" 3.1814.08   8.52"DIPG"
"CA1_1" 253.36  0.180   "GSC"
"CA1_2" 266.96  0.070.02"GSC"
"CA1_3" 240.43  0.090   "GSC"
"DIPG_45_1" 63.19   2.599.7 "DIPG"
"DIPG_45_2" 60.23   2.799.32"DIPG"
"DIPG_45_3" 59.56   2.349.1 "DIPG"
"CA4_1" 273.27  0.110.04"GSC"
"CA4_2" 260.43  0.050   "GSC"
"CA4_3" 266.39  0.070.06"GSC"
"DIPG_XIX_1"1.276   25.63   "DIPG"
"DIPG_XIX_2"1.126.1824.37   "DIPG"
"DIPG_XIX_3"1.637.1926.06   "DIPG"
"L0_1"  16.48   3.350.4 "GSC"
"L0_2"  19.14.110.6 "GSC"
"L0_3"  17.54   3.590.49"GSC"
"DIPG_13_1" 32.57   1.4114.78   "DIPG"
"DIPG_13_2" 26.44   1.4 13.88   "DIPG"
"DIPG_13_3" 26.36   1.3 13.89   "DIPG"
"L1_1"  21.54   3.821   "GSC"
"L1_2"  17.38   3.360.93"GSC"
"L1_3"  22.71   3.570.9 "GSC"
"DIPG_SCG-1_1"  96.95   3.1 481.64  "DIPG"
"DIPG_SCG-1_2"  109.77  2.88523.27  "DIPG"
"DIPG_SCG-1_3"  106.77  3.79481.03  "DIPG"
"GSC403_1"  38.83   5.1116.2"GSC"
"GSC403_2"  38.07   5.5918.46   "GSC"
"GSC403_3"  37.44   4.8617.64   "GSC"
"TB096_1"   71.38   5.550   "glioma"
"TB096_2"   80.34   4.370   "glioma"
"TB096_3"   74.87   4.550.03"glioma"
"U251_1"21.40.310   "MCL"
"U251_2"23.51   0.450   "MCL"
"U251_3"19.74   0.450   "MCL"
"A172_1"49.68   0.810.02"MCL"
"A172_2"41.43   0.720.03"MCL"
"A172_3"49.98   0.590   "MCL"
"DIPG_36_1" 6.650.454.86"DIPG"
"DIPG_36_2" 8.180.413   "DIPG"
"DIPG_36_3" 7.040.284.55"DIPG"
"TS603_1"   13.86   0.8833.5"AnaplasticOligo"
"TS603_2"   14.02   0.8836.12   "AnaplasticOligo"
"TS603_3"   15.99   0.9535.67   "AnaplasticOligo"
"SW1088_1"  18  0.110   "MCL"
"SW1088_2"  11.59   0.140   "MCL"
"SW1088_3"  15.17   0.370   "MCL"
"LN229_1"   6.3 0.6724.38   "MCL"
"LN229_2"   5.090.5622.21   "MCL"
"LN229_3"   5.410.9620.27   "MCL"
"HW7_1_1"   23.98   7.2626.06   "HW"
"HW7_1_2"   22.81   7.5 34.93   "HW"
"HW7_1_3"   27.04   9.3132.27   "HW"
"HW7_2_1"   30.47   7.5831.84   "HW"
"HW7_2_2"   17.31   6.3823.78   "HW"
"HW7_2_3"   22.87   7.7222.19   "HW"
"HW10_R132H_1"  62.03   9.2928.2"HW"
"HW10_R132H_2"  47.78   9.3335.61   "HW"
"HW10_R132H_3"  55.78   10.55   30.24   "HW"
"HW8_1" 18.19   7.3820.54   "HW"
"HW8_2" 15.39   7.5623.16   "HW"
"HW8_3" 19.71   7.4223.85   "HW"
"HW10_1"35.38   9.7432.4"HW"
"HW10_2"39.95   9.5837  "HW"
"HW10_3"37.45   9.5942.56   "HW"
"HW5_1" 22.64   7.4241.08   "HW"
"HW5_2" 25.16   7.4739.44   "HW"
"HW5_3" 24.64   7.0636.65   "HW"
"HW8_R132_1"20.08   6.2327  "HW"
"HW8_R132_2"24.77   6.0925.01   "HW"
"HW8_R132_3"26.31   5.8121.03   "HW"
"SF10602_1" 25.38   2.720.43"glioma"
"SF10602_2" 25.61   2.5 0.55"glioma"
"SF10602_3" 23.81   2.390.47"glioma"
"DIPG_43_1" 22.87   3.429.24"DIPG"
"DIPG_43_2" 17.77   3.7210.33   "DIPG"
"DIPG_43_3" 22.04   3.029.52"DIPG"
"NCH612_1"  9.043.940.28"AnaplasticOligo"
"NCH612_2"  9.353.290.33"AnaplasticOligo"
"NCH612_3"  7.972.980.48"AnaplasticOligo"
"SF10417_1" 43.93   2.930.21"glioma"
"SF10417_2" 44.77   2.430.32"glioma"
"SF10417_3" 48.88   2.810.27"glioma"
"GSC711_1"  192.15  1.95155.15  "glioma"
"GSC711_2"  192.85  2.11141.35  "glioma"
"GSC711_3"  198.1   2.1 154.15  "glioma"
"GSC17_1"   9.8 4.7757.33   "glioma"
"GSC17_2"   8.383.8960.65   "glioma"
"GSC17_3"   7.543.8959.22   "glioma"
"GSC274_1"  135.93  0.380.04"glioma"
"GSC274_2"  134.37  0.280.03"glioma"
"GSC274_3"  169.64  0.270.06"glioma"
"GSC268_1"  17.80.018.25"glioma"
"GSC268_2"  19.97   0.116.24"glioma"
"GSC268_3"  16.94   0.147.14

Re: [R] how to create a sorted barplot and colored by groups

2020-04-19 Thread John Kane
.01 | 8.25 |
> | GSC268_2 | glioma | 19.97 | 0.11 | 6.24 |
> | SF10602_3 | glioma | 23.81 | 2.39 | 0.47 |
> | SF10602_1 | glioma | 25.38 | 2.72 | 0.43 |
> | MGG119_1 | glioma | 25.49 | 6.84 | 9.8 |
> | SF10602_2 | glioma | 25.61 | 2.5 | 0.55 |
> | GSC827_2 | glioma | 27.67 | 2.32 | 128.56 |
> | GSC827_3 | glioma | 28.2 | 3.22 | 128.85 |
> | GSC827_1 | glioma | 30.6 | 3.15 | 126.77 |
> | MGG119_2 | glioma | 31.43 | 5.86 | 9.02 |
> | BT054_3 | glioma | 35.26 | 0.46 | 2.89 |
> | MGG119_3 | glioma | 35.57 | 6.52 | 9.42 |
> | BT054_2 | glioma | 39.74 | 0.53 | 3.29 |
> | BT054_1 | glioma | 42.22 | 0.28 | 3.54 |
> | SF10417_1 | glioma | 43.93 | 2.93 | 0.21 |
> | SF10417_2 | glioma | 44.77 | 2.43 | 0.32 |
> | GBM196_1 | glioma | 47.28 | 0.33 | 1.75 |
> | GBM196_2 | glioma | 48.85 | 0.34 | 1.9 |
> | SF10417_3 | glioma | 48.88 | 2.81 | 0.27 |
> | GBM196_3 | glioma | 50.5 | 0.4 | 2.25 |
> | BT088_1 | glioma | 65.83 | 4.3 | 12.17 |
> | BT088_2 | glioma | 66.96 | 4.13 | 10.33 |
> | TB096_1 | glioma | 71.38 | 5.55 | 0 |
> | TB096_3 | glioma | 74.87 | 4.55 | 0.03 |
> | TB096_2 | glioma | 80.34 | 4.37 | 0 |
> | BT088_3 | glioma | 93.29 | 4.1 | 12.14 |
> | GSC274_2 | glioma | 134.37 | 0.28 | 0.03 |
> | GSC274_1 | glioma | 135.93 | 0.38 | 0.04 |
> | GSC274_3 | glioma | 169.64 | 0.27 | 0.06 |
> | GSC711_1 | glioma | 192.15 | 1.95 | 155.15 |
> | GSC711_2 | glioma | 192.85 | 2.11 | 141.35 |
> | GSC711_3 | glioma | 198.1 | 2.1 | 154.15 |
> | XO1_1 | GSC | 0.22 | 0.35 | 661.86 |
> | XO6_2 | GSC | 0.23 | 0.06 | 539.81 |
> | XO1_3 | GSC | 0.31 | 0.32 | 709.18 |
> | XO9_3 | GSC | 0.34 | 0.17 | 999.27 |
> | XO6_1 | GSC | 0.37 | 0.09 | 523.3 |
> | XO1_2 | GSC | 0.41 | 0.03 | 683.86 |
> | XO9_2 | GSC | 0.48 | 0.15 | 992.87 |
> | XO6_3 | GSC | 0.52 | 0.15 | 531.36 |
> | XO9_1 | GSC | 0.67 | 0.32 | 919.95 |
> | XO10_1 | GSC | 5 | 0.08 | 409.65 |
> | XO10_3 | GSC | 5.49 | 0.11 | 335.44 |
> | XO10_2 | GSC | 6.06 | 0.03 | 369.5 |
> | L0_1 | GSC | 16.48 | 3.35 | 0.4 |
> | L1_2 | GSC | 17.38 | 3.36 | 0.93 |
> | L0_3 | GSC | 17.54 | 3.59 | 0.49 |
> | L0_2 | GSC | 19.1 | 4.11 | 0.6 |
> | L1_1 | GSC | 21.54 | 3.82 | 1 |
> | L1_3 | GSC | 22.71 | 3.57 | 0.9 |
> | GSC403_3 | GSC | 37.44 | 4.86 | 17.64 |
> | GSC403_2 | GSC | 38.07 | 5.59 | 18.46 |
> | GSC403_1 | GSC | 38.83 | 5.11 | 16.2 |
> | XO2_2 | GSC | 78.66 | 0.01 | 0.88 |
> | XO2_1 | GSC | 80.11 | 0.03 | 0.93 |
> | XO2_3 | GSC | 90.97 | 0 | 1.01 |
> | CA4_1_1 | GSC | 153.82 | 0.05 | 0 |
> | CA4_1_3 | GSC | 155.24 | 0.13 | 0 |
> | CA4_2_1 | GSC | 161 | 0 | 0.04 |
> | CA4_1_2 | GSC | 162.61 | 0.08 | 0 |
> | CA4_2_2 | GSC | 164.36 | 0.08 | 0 |
> | CA4_2_3 | GSC | 175.21 | 0.11 | 0 |
> | CA4_ONC201_2 | GSC | 196.03 | 0.21 | 0 |
> | CA4_ONC201_3 | GSC | 208.01 | 0.15 | 0 |
> | CA4_ONC201_1 | GSC | 217.87 | 0.03 | 0 |
> | CA1_3 | GSC | 240.43 | 0.09 | 0 |
> | CA1_1 | GSC | 253.36 | 0.18 | 0 |
> | CA4_2 | GSC | 260.43 | 0.05 | 0 |
> | CA4_ONC206_2 | GSC | 261.34 | 0.35 | 0.06 |
> | CA4_3 | GSC | 266.39 | 0.07 | 0.06 |
> | CA1_2 | GSC | 266.96 | 0.07 | 0.02 |
> | CA4_1 | GSC | 273.27 | 0.11 | 0.04 |
> | CA4_ONC206_1 | GSC | 279.86 | 0.36 | 0 |
> | CA4_ONC206_3 | GSC | 281.32 | 0.37 | 0 |
> | HW8_2 | HW | 15.39 | 7.56 | 23.16 |
> | HW7_2_2 | HW | 17.31 | 6.38 | 23.78 |
> | HW8_1 | HW | 18.19 | 7.38 | 20.54 |
> | HW8_3 | HW | 19.71 | 7.42 | 23.85 |
> | HW8_R132_1 | HW | 20.08 | 6.23 | 27 |
> | HW5_1 | HW | 22.64 | 7.42 | 41.08 |
> | HW7_1_2 | HW | 22.81 | 7.5 | 34.93 |
> | HW7_2_3 | HW | 22.87 | 7.72 | 22.19 |
> | HW7_1_1 | HW | 23.98 | 7.26 | 26.06 |
> | HW5_3 | HW | 24.64 | 7.06 | 36.65 |
> | HW8_R132_2 | HW | 24.77 | 6.09 | 25.01 |
> | HW5_2 | HW | 25.16 | 7.47 | 39.44 |
> | HW8_R132_3 | HW | 26.31 | 5.81 | 21.03 |
> | HW7_1_3 | HW | 27.04 | 9.31 | 32.27 |
> | HW7_2_1 | HW | 30.47 | 7.58 | 31.84 |
> | HW10_1 | HW | 35.38 | 9.74 | 32.4 |
> | HW10_3 | HW | 37.45 | 9.59 | 42.56 |
> | HW10_2 | HW | 39.95 | 9.58 | 37 |
> | HW10_R132H_2 | HW | 47.78 | 9.33 | 35.61 |
> | HW10_R132H_3 | HW | 55.78 | 10.55 | 30.24 |
> | HW10_R132H_1 | HW | 62.03 | 9.29 | 28.2 |
> | LN229_2 | MCL | 5.09 | 0.56 | 22.21 |
> | LN229_3 | MCL | 5.41 | 0.96 | 20.27 |
> | LN229_1 | MCL | 6.3 | 0.67 | 24.38 |
> | SW1088_2 | MCL | 11.59 | 0.14 | 0 |
> | SW1088_3 | MCL | 15.17 | 0.37 | 0 |
> | SW1088_1 | MCL | 18 | 0.11 | 0 |
> | U251_3 | MCL | 19.74 | 0.45 | 0 |
> | U251_1 | MCL | 21.4 | 0.31 | 0 |
> | U251_2 | MCL | 23.51 | 0.45 | 0 |
> | A172_2 | MCL | 41.43 | 0.72 | 0.03 |
> | BT142_2 | MCL | 45.43 | 2.39 | 9.77 |
> | BT142_1 | MCL | 45.95 | 2.02 | 8.23 |
> | BT142_3 | MCL | 48.88 | 1.71 | 10.31 |
> | A172_1 | MCL | 49.68 | 0.81 | 0.02 |
> | A172_3 | MCL | 49.98 | 0.59 | 0 |
> | NHA_R132H_1 | Normal astrocyte | 43.67 

Re: [R] Web-scraping newbie - dynamic table into R?

2020-04-19 Thread John Kane
Keno <- read_html(Kenopage) ?

Or Am I misunderstanding the problem?

On Sun, 19 Apr 2020 at 15:10, Julio Farach  wrote:

> How do I scrape the last 10 Keno draws from the Georgia lottery into R?
>
>
> I'm trying to pull the last 10 draws of a Keno lottery game into R.  I've
> read several tutorials on how to scrape websites using the rvest package,
> Chrome's Inspect Element, and CSS or XPath, but I'm likely stuck because
> the table I seek is dynamically generated using Javascript.
>
>
>
> I started with:
>
> >install.packages("rvest")
>
> >   library(rvest)
>
> >Kenopage <- "
>
> https://www.galottery.com/en-us/games/draw-games/keno.html#tab-winningNumbers
> "
>
> > Keno <- Read.hmtl(Kenopage)
>
> From there, I've been unable to progress, despite hours spend on
> combinations of CSS and XPath calls with "html_notes."
>
> Failed example: DrawNumber <- Keno %>% rvest::html_nodes("body") %>%
> xml2::xml_find_all("//span[contains(@class,'Draw Number')]") %>%
> rvest::html_text()
>
>
>
> Someone mentioned using the V8 package in R, but it's new to me.
>
> How do I get started?
>
> --
>
> Julio Farach
> https://www.linkedin.com/in/farach
> cell phone:  804/363-2161
> email:  jfar...@gmail.com
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] how do I add text lables on QQ plot

2020-03-11 Thread John Kane
No idua how it works but the name suggests it in out of the Hadley universe
and not basic graphics.

On Wed, 11 Mar 2020 at 21:14, Abby Spurdle  wrote:

> One more thing, I can't find a CRAN package named "ggman".
>
> On Thu, Mar 12, 2020 at 1:59 PM Abby Spurdle  wrote:
> >
> > Ok, then.
> >
> > What graphics system is the qq function using?
> > Assuming that it's using the base graphics system, look at the
> > graphics::text function.
> >
> > text (1:10, 1:10, LETTERS [1:10])
> >
> > If it's a different graphics system, then I don't know, but hopefully
> > someone else will help.
> >
> > On Thu, Mar 12, 2020 at 1:48 PM Ana Marija 
> wrote:
> > >
> > > Thanks for getting back to me but I would need this text labels added
> in this particular instance
> > >
> > > On Wed, 11 Mar 2020 at 19:37, Abby Spurdle 
> wrote:
> > >>
> > >> > and I would like to get the plot like the one in attach.
> > >> > Please advise,
> > >>
> > >> This is a bad idea.
> > >> Plots should be *easy* to interpret.
> > >>
> > >> Try to keep plots relatively simple, avoiding unnecessary details.
> > >> For nontrivial plots, use a caption to describe the main features of
> the plot.
> > >> (That's where your text should go).
> > >>
> > >> I note that you've asked a number of questions about QQ plots.
> > >> I'd recommend that you use QQ plots in a standard way, without
> > >> frequently trying to modify/customize them.
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] Help

2020-02-20 Thread John Kane
Are you trying it install the package from within an IDE or working at a
common line level?

Sometimes it seems better to start R on the command line and work there

On Thu, 20 Feb 2020 at 17:56, mohi uddin  wrote:

> Hi,
> Good day,
> Sir,
> I am PhD student and using metaSem by R package 3.6.2. For meta analysis.
> I am using tssem. On stage 2, I type install.packages("semPlot")
> Require("semPlot")
> And then got given below message.
>
> package ‘semPlot’ is not available (for R version 3.6.2)
>
> Plz help me in making model.
> Thanks
> Sincerely
> Mohiyuddin
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] Help

2020-02-20 Thread John Kane
That's okay Caitlin, the Queen will have you on this year's honour's list.

On Thu, 20 Feb 2020 at 18:31, Caitlin Gibbons 
wrote:

> Hi.
>
> Not all of us are “Sirs”.
>
>
>
> > On Feb 20, 2020, at 3:56 PM, mohi uddin  wrote:
> >
> > Hi,
> > Good day,
> > Sir,
> > I am PhD student and using metaSem by R package 3.6.2. For meta analysis.
> > I am using tssem. On stage 2, I type install.packages("semPlot")
> > Require("semPlot")
> > And then got given below message.
> >
> > package ‘semPlot’ is not available (for R version 3.6.2)
> >
> > Plz help me in making model.
> > Thanks
> > Sincerely
> > Mohiyuddin
> >
> >[[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Unintended behaviour (possibly bugs)

2020-02-16 Thread John Kane
Try aa <- as.matrix(table(c(1, 1, 1, 2, 2, 3)))
dotchart(aa, ylab="Ylab")

It may wock

On Sun, 16 Feb 2020 at 07:22, Alexey Shipunov 
wrote:

> Dear list,
>
> I have been advised to share these with R-help instead of filling the
> bug report:
>
> 1) dotchart() does not allow to see the left axis title ('ylab') and
> cannot change the left margin (outer margin 2) of the plot
>
> The code:
>
> aa <- table(c(1, 1, 1, 2, 2, 3))
> dotchart(aa, ylab="Ylab") # does not show 'ylab'
> old.par <- par(mar=c(1, 10, 1, 1)) ; dotchart(aa, ylab="Ylab") ;
> par(old.par) # does not change left margin
>
> Possible solution:
>
> I researched the problem and think that the dotchart() code will need
> few corrections. If there is an interest, I can post it here; or you
> can look at the code of shipunov::Dotchart1() function.
>
> 2) example(hist) includes two "wrong" and "extreme" examples which
> slow down and even crash R on some systems; this make it unsuitable
> for demonstration in the class and strikes beginners in R who just
> want to understand how hist() works. Actually, I did it last week (I
> was not aware of these examples), and in the class two computers hang,
> and many others were extremely slow.
>
> The code:
>
> example(hist)
>
> Possible solution:
>
> If R maintainers will enclose parts of "hist" example in \dontrun{},
> this will allow to see the code but in the same time will not strike
> beginners in R who just
> want to understand how hist() works. They will still be possible to
> run with example(..., run.dontrun=TRUE).
>
> With best wishes,
>
> Alexey Shipunov
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] how to create density plot in R with p value

2020-02-11 Thread John Kane
Please supply sample data in dput() format See ?dput.

You might find these links helpful.

 http://adv-r.had.co.nz/Reproducibility.html

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example



On Tue, 11 Feb 2020 at 15:07, Ana Marija 
wrote:

> so I transformed my data from the previous email to look like this:
>
> > head(tot)
>  dat  type
> 1 -3.962 inter.individual.variance
> 2 -4.301 inter.individual.variance
> 3 -1.690 inter.individual.variance
> 4 -0.375 inter.individual.variance
> 5  1.816 inter.individual.variance
> 6  0.138 inter.individual.variance
> > tail(tot)
> dat  type
> 31177 -4.09 intra.individual.variance
> 31178 -4.64 intra.individual.variance
> 31179 -5.57 intra.individual.variance
> 31180 -2.96 intra.individual.variance
> 31181 -4.43 intra.individual.variance
> 31182 -3.60 intra.individual.variance
>
> then I can make plot using this:
>
> densityplot(~dat,data=tot,
>groups=type,
>par.settings = list(superpose.line = list(col = c("blue","red"))),
>xlab="log2 (variance)",
>plot.points=FALSE,
>auto.key=TRUE)
>
> and calculate my p value with t test, say it is 0.005
>
> But how to add that p value in between distribution of the curves?
>
> Thanks
> Ana
>
> On Tue, Feb 11, 2020 at 12:54 PM Ana Marija 
> wrote:
> >
> > Hi,
> >
> > I have data like this:
> >
> > > head(a)
> >X   geneID inter.individual.variance
> > intra.individual.variance F.value  p.value CV
> > 1 3iUZ.47hLFki49VR4o   MLLT100.0642
> >0.013954.60 1.00e-05 0.0222
> > 2 fEn1QlU0MCVe9GeR64 C1orf1230.0507
> >0.006717.57 1.00e-08 0.0172
> > 3 ud_tTlU5LtB478JxIkFSD1L0.3100
> >0.02682   11.56 1.00e-11 0.0639
> > 4 3KV3OJIIRuJ5KJ6VkI  TXNDC110.7710
> >0.02813   27.41 9.99e-19 0.0688
> > 5 o_rupcEAKnQqnoh6ec   CYB5R23.5209
> >0.03391  103.83 9.99e-31 0.1357
> > 6 Nk_t6ULcQ7VDNChBRU GBP11.1005
> >0.09522   11.56 9.98e-12 0.0773
> >
> > I would like to create density plot, like the attached between
> > "inter.individual.variance" and "intra.individual.variance" and have p
> > value between those two curves.
> >
> > Please advise,
> > 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.
>


-- 
John Kane
Kingston ON Canada

[[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] scatter plot

2020-02-10 Thread John Kane
In line

On Mon, 10 Feb 2020 at 15:12, Ana Marija 
wrote:

> Hi,
>
> Thanks for getting back to me. I need to have there two groups:
>
> "nPDR.rg  and "PDR.rg"
>

Your sample data only contains NoD.rg &  nPDR.rg.  To start with, I think
we need some representative data supplied in dput format just as I supplied
an "mds" dataset.  If I understand your mds$col statement correctly there
is only 22 rows of data. Just issue the command "dput(mds) and copy the
output into your e-mail. This will allow R-help readers to use the exact
same data set that you have on your computer.

>
> can you please let me know how my loop would look like just with those
> two groups
>

Well no I cannot  because I am still trying ta figure out where "d1 and d2
came from or why you need that loop. It looks like you are renaming the
columns in "mbs" three times but why? And why do it in a loop?

If all that you are doing is renaming the columns from the "ar_diff" data
set names just do it once,
colnames(mds)  <-  c("Dim.1", Dim.2, Dim.3) before you even create the
"cols" column.

We really need to see the data.

I have never used library("ggpubr") and I cannot see why cols is appearing
in the legend---well it does with my data set. Actually, given my version
of the data set I don't see why it it printing the graph.


Also do you really want all three grcaphs in one .pdf file?



> Thanks
> Ana
>
>










> On Mon, Feb 10, 2020 at 2:03 PM John Kane  wrote:
> >
> > I must admit that I do not understand what you are doing but can you
> notm just subset the data?
> > Note I am using a data.frame not a tibble.  It would be helpful if you
> could supply sample data in dput() forest.
> >
> > library("ggpubr")
> > mds  <-  structure(list(Dim.1 = c(0.41, 0.184, 0.394, -0.49, 0.635,
> -0.723,
> > 0.76, -0.0918, -0.336, -0.439, -1.9, 0.631), Dim.2 = c(-0.984,
> > 1.11, -0.159, -0.326, -0.112, 0.153, -0.732, 0.645, 0.756, -0.557,
> > -0.858, -0.093), Dim.3 = c(-0.87, 0.101, 0.0272, 0.535, -0.0503,
> > -0.245, 0.568, -0.189, 0.12, 0.556, -0.949, 1.43), cols = c("nPDR.rg",
> > "nPDR.rg", "nPDR.rg", "nPDR.rg", "nPDR.rg", "nPDR.rg", "NoD.rg",
> > "NoD.rg", "NoD.rg", "NoD.rg", "NoD.rg", "NoD.rg")), class =
> "data.frame", row.names = c(NA,
> > -12L))
> >
> > mm1  <-  subset(mds, cols =="nPDR.rg")
> > ggscatter(mds, x = d1, y = d2, size=3, color = "red")
> >
> > On Mon, 10 Feb 2020 at 14:04, Ana Marija 
> wrote:
> >>
> >> Hello,
> >>
> >> I have a code like this:
> >>
> >> mds <- (ar_diff) %>% dist() %>% cmdscale(k=3) %>% as_tibble()
> >> mds$cols <- as.factor(c(rep("nPDR.rg",7),  rep("PDR.rg",8),
> rep("NoD.rg",7)))
> >>
> >> pdf(file = "RG.pdf")
> >>
> >>
> >> for (dim1 in 1:2){
> >>   for (dim2 in (dim1+1):3){
> >> d1 = paste0("Dim.",dim1); d2 = paste0("Dim.",dim2)
> >> colnames(mds)[c(dim1,dim2)] <- c(d1,d2)
> >> print(colnames(mds))
> >> print(ggscatter(mds, x = d1, y = d2, color ="cols" ,size=3
> >> ,palette=c("blue","red","green")))
> >>   }
> >> }
> >> dev.off()
> >>
> >> How do I run the same plot but excluding NoD.rg? What do I need to
> >> change in this for loop?
> >>
> >> > head(mds)
> >> # A tibble: 6 x 4
> >>Dim.1  Dim.2   Dim.3 cols
> >>  
> >> 1  1.41  -0.984 -0.870  nPDR.rg
> >> 2  0.184  1.11   0.101  nPDR.rg
> >> 3  0.394 -0.159  0.0272 nPDR.rg
> >> 4 -0.490 -0.326  0.535  nPDR.rg
> >> 5  0.635 -0.112 -0.0503 nPDR.rg
> >> 6 -0.723  0.153 -0.245  nPDR.rg
> >>
> >> > tail(mds)
> >> # A tibble: 6 x 4
> >> Dim.1   Dim.2  Dim.3 cols
> >>   
> >> 1  0.760  -0.732   0.568 NoD.rg
> >> 2 -0.0918  0.645  -0.189 NoD.rg
> >> 3 -0.336   0.756   0.120 NoD.rg
> >> 4 -0.439  -0.557   0.556 NoD.rg
> >> 5 -1.90   -0.858  -0.949 NoD.rg
> >> 6  0.631  -0.0930  1.43  NoD.rg
> >>
> >> 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.
> >
> >
> >
> > --
> > John Kane
> > Kingston ON Canada
>


-- 
John Kane
Kingston ON Canada

[[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] scatter plot

2020-02-10 Thread John Kane
I must admit that I do not understand what you are doing but can you notm
just subset the data?
Note I am using a data.frame not a tibble.  It would be helpful if you
could supply sample data in dput() forest.

library("ggpubr")
mds  <-  structure(list(Dim.1 = c(0.41, 0.184, 0.394, -0.49, 0.635, -0.723,
0.76, -0.0918, -0.336, -0.439, -1.9, 0.631), Dim.2 = c(-0.984,
1.11, -0.159, -0.326, -0.112, 0.153, -0.732, 0.645, 0.756, -0.557,
-0.858, -0.093), Dim.3 = c(-0.87, 0.101, 0.0272, 0.535, -0.0503,
-0.245, 0.568, -0.189, 0.12, 0.556, -0.949, 1.43), cols = c("nPDR.rg",
"nPDR.rg", "nPDR.rg", "nPDR.rg", "nPDR.rg", "nPDR.rg", "NoD.rg",
"NoD.rg", "NoD.rg", "NoD.rg", "NoD.rg", "NoD.rg")), class = "data.frame",
row.names = c(NA,
-12L))

mm1  <-  subset(mds, cols =="nPDR.rg")
ggscatter(mds, x = d1, y = d2, size=3, color = "red")

On Mon, 10 Feb 2020 at 14:04, Ana Marija 
wrote:

> Hello,
>
> I have a code like this:
>
> mds <- (ar_diff) %>% dist() %>% cmdscale(k=3) %>% as_tibble()
> mds$cols <- as.factor(c(rep("nPDR.rg",7),  rep("PDR.rg",8),
> rep("NoD.rg",7)))
>
> pdf(file = "RG.pdf")
>
>
> for (dim1 in 1:2){
>   for (dim2 in (dim1+1):3){
> d1 = paste0("Dim.",dim1); d2 = paste0("Dim.",dim2)
> colnames(mds)[c(dim1,dim2)] <- c(d1,d2)
> print(colnames(mds))
> print(ggscatter(mds, x = d1, y = d2, color ="cols" ,size=3
> ,palette=c("blue","red","green")))
>   }
> }
> dev.off()
>
> How do I run the same plot but excluding NoD.rg? What do I need to
> change in this for loop?
>
> > head(mds)
> # A tibble: 6 x 4
>Dim.1  Dim.2   Dim.3 cols
>  
> 1  1.41  -0.984 -0.870  nPDR.rg
> 2  0.184  1.11   0.101  nPDR.rg
> 3  0.394 -0.159  0.0272 nPDR.rg
> 4 -0.490 -0.326  0.535  nPDR.rg
> 5  0.635 -0.112 -0.0503 nPDR.rg
> 6 -0.723  0.153 -0.245  nPDR.rg
>
> > tail(mds)
> # A tibble: 6 x 4
> Dim.1   Dim.2  Dim.3 cols
>   
> 1  0.760  -0.732   0.568 NoD.rg
> 2 -0.0918  0.645  -0.189 NoD.rg
> 3 -0.336   0.756   0.120 NoD.rg
> 4 -0.439  -0.557   0.556 NoD.rg
> 5 -1.90   -0.858  -0.949 NoD.rg
> 6  0.631  -0.0930  1.43  NoD.rg
>
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] Value Labels: SPSS Dataset to R

2020-02-08 Thread John Kane
Best of luck.

On Sat, 8 Feb 2020 at 10:36, Yawo Kokuvi  wrote:

> Thanks again - I realized after posting that sjlabelled is indirectly
> referencing haven's read_sav function.  For a moment I thought you were
> referring to the read.spss under the older foreign package.  But then
> realized that read_sav and read_spss are equivalent. So that's clear now.
>
> And I also realized there are so many ways to do the same thing in R - so
> as part of learning, I am discovering these different ways, and knowing
> when to use one over the other.
>
> Thanks for the references - I will read further on them.
>
> cheers, cY
>
> On Sat, Feb 8, 2020 at 10:28 AM John Kane  wrote:
>
>> "use a different function (read_spss) as John has suggested to import the
>> file. "
>>
>> No! As far as I can see sjlabelled is simply using haven"s function "
>> read_sav()" to read in the data. It is just wrapped in the "read.spss()
>> function.There should be no difference between read_sav(sdata.sav) and
>> read_spss(sdata.sav).
>>
>> It just seems to keep the code simpler (more aesthetically pleasing?) if
>> you do not load more packages than needed. Likewise you do not need to load
>> "labels" as sjlabelledis taking care of this for you.
>>
>> Oh, BTW  Scratch$sex %>% attr('labels') can be replaced by something like
>> get_labels(dat1) in my example. There usually are a multitude of ways to do
>> the same thing in R.
>>
>> You might want to have a look at
>> https://cran.r-project.org/web/packages/labelled/vignettes/intro_labelled.html
>> and https://strengejacke.github.io/sjlabelled/articles/labelleddata.html
>> for more about working with labels.
>>
>> On Sat, 8 Feb 2020 at 09:35, Yawo Kokuvi  wrote:
>>
>>> Thanks so much for all your assistance.  I admit R's learning curve is a
>>> bit steep, but I am eager to learn ... and hopefully teach with it.
>>>
>>> with regard to my problem, I can now see two options:  either declare
>>> each categorical variable as factors, specifying the needed levels and
>>> labels.
>>>
>>> OR
>>>
>>> use a different function (read_spss) as John has suggested to import the
>>> file.
>>>
>>> I will experiment with both.
>>>
>>> With much appreciation, cY
>>>
>>> On Sat, Feb 8, 2020 at 9:25 AM John Kane  wrote:
>>>
>>>> Hi Yawo Kokuvi;
>>>> As an R newbie transitioning from SPSS to R expect culture shock and
>>>> the possible feeling that yor brain is twisting within your skull but it is
>>>> well worth.
>>>>
>>>> Try something like this:
>>>> ##+
>>>> dat1  <- structure(list(Animal = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0,
>>>> 0), label = "Animal", labels = c(Cat = 0, Dog = 1), class =
>>>> "haven_labelled"),
>>>> Training = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), label = "Type
>>>> of Training", labels = c(`Food as Reward` = 0,
>>>> `Affection as Reward` = 1), class = "haven_labelled"), Dance =
>>>> structure(c(1,
>>>> 1, 1, 1, 1, 1, 1, 1, 1, 1), label = "Did they dance?", labels =
>>>> c(No = 0,
>>>> Yes = 1), class = "haven_labelled")), row.names = c(NA, -10L
>>>> ), class = c("tbl_df", "tbl", "data.frame"))
>>>>
>>>>
>>>> library(sjlabelled)
>>>> str(dat1)
>>>> get_labels(dat1)
>>>> barplot(table(as_label(dat1$Dance)))
>>>> ##==
>>>> Your problem sees to be omitting the as_label().
>>>>
>>>> You do not need to load "haven"
>>>> read_spss() in sjlabelled should do the trick.
>>>>
>>>>
>>>> On Sat, 8 Feb 2020 at 05:44, Rui Barradas  wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> Try
>>>>>
>>>>> aux_fun <- function(x){
>>>>>levels <- attr(x, "labels")
>>>>>factor(x, labels = names(levels), levels = levels)
>>>>> }
>>>>>
>>>>> newCatsDogs <- as.data.frame(lapply(CatsDogs, aux_fun))
>>>>>
>>>>> str(newCatsDogs)
>>>>> #'data.frame':  10 obs. of  3 variables:
>>>>> # $

Re: [R] Value Labels: SPSS Dataset to R

2020-02-08 Thread John Kane
"use a different function (read_spss) as John has suggested to import the
file. "

No! As far as I can see sjlabelled is simply using haven"s function "
read_sav()" to read in the data. It is just wrapped in the "read.spss()
function.There should be no difference between read_sav(sdata.sav) and
read_spss(sdata.sav).

It just seems to keep the code simpler (more aesthetically pleasing?) if
you do not load more packages than needed. Likewise you do not need to load
"labels" as sjlabelledis taking care of this for you.

Oh, BTW  Scratch$sex %>% attr('labels') can be replaced by something like
get_labels(dat1) in my example. There usually are a multitude of ways to do
the same thing in R.

You might want to have a look at
https://cran.r-project.org/web/packages/labelled/vignettes/intro_labelled.html
and https://strengejacke.github.io/sjlabelled/articles/labelleddata.html
for more about working with labels.

On Sat, 8 Feb 2020 at 09:35, Yawo Kokuvi  wrote:

> Thanks so much for all your assistance.  I admit R's learning curve is a
> bit steep, but I am eager to learn ... and hopefully teach with it.
>
> with regard to my problem, I can now see two options:  either declare each
> categorical variable as factors, specifying the needed levels and labels.
>
> OR
>
> use a different function (read_spss) as John has suggested to import the
> file.
>
> I will experiment with both.
>
> With much appreciation, cY
>
> On Sat, Feb 8, 2020 at 9:25 AM John Kane  wrote:
>
>> Hi Yawo Kokuvi;
>> As an R newbie transitioning from SPSS to R expect culture shock and the
>> possible feeling that yor brain is twisting within your skull but it is
>> well worth.
>>
>> Try something like this:
>> ##+
>> dat1  <- structure(list(Animal = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0,
>> 0), label = "Animal", labels = c(Cat = 0, Dog = 1), class =
>> "haven_labelled"),
>> Training = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), label = "Type
>> of Training", labels = c(`Food as Reward` = 0,
>> `Affection as Reward` = 1), class = "haven_labelled"), Dance =
>> structure(c(1,
>> 1, 1, 1, 1, 1, 1, 1, 1, 1), label = "Did they dance?", labels = c(No
>> = 0,
>> Yes = 1), class = "haven_labelled")), row.names = c(NA, -10L
>> ), class = c("tbl_df", "tbl", "data.frame"))
>>
>>
>> library(sjlabelled)
>> str(dat1)
>> get_labels(dat1)
>> barplot(table(as_label(dat1$Dance)))
>> ##==
>> Your problem sees to be omitting the as_label().
>>
>> You do not need to load "haven"
>> read_spss() in sjlabelled should do the trick.
>>
>>
>> On Sat, 8 Feb 2020 at 05:44, Rui Barradas  wrote:
>>
>>> Hello,
>>>
>>> Try
>>>
>>> aux_fun <- function(x){
>>>levels <- attr(x, "labels")
>>>factor(x, labels = names(levels), levels = levels)
>>> }
>>>
>>> newCatsDogs <- as.data.frame(lapply(CatsDogs, aux_fun))
>>>
>>> str(newCatsDogs)
>>> #'data.frame':  10 obs. of  3 variables:
>>> # $ Animal  : Factor w/ 2 levels "Cat","Dog": 1 1 1 1 1 1 1 1 1 1
>>> # $ Training: Factor w/ 2 levels "Food as Reward",..: 1 1 1 1 1 1 1 1 1 1
>>> # $ Dance   : Factor w/ 2 levels "No","Yes": 2 2 2 2 2 2 2 2 2 2
>>>
>>>
>>> As for the
>>>   - frequencies: ?table, ?tapply, ?aggregate,
>>>   - barplots: ?barplot
>>>
>>> You can find lots and lots of examples online of both covering what
>>> seems to simple use cases.
>>>
>>> Hope this helps,
>>>
>>> Rui Barradas
>>>
>>> Às 06:03 de 08/02/20, Yawo Kokuvi escreveu:
>>> > Thanks for all. Here is output from dput.  I used a different dataset
>>> > containing categorical variables since the previous one is on a
>>> different
>>> > computer.
>>> >
>>> > In the following dataset, my interest is in getting frequencies and
>>> > barplots for the two variables: Training and Dance, with value labels
>>> > displayed.
>>> >
>>> > thanks again - cY
>>> >
>>> >
>>> > =
>>> > dput(head(CatsDogs, n = 10))
>>> > structure(
>>> >list(
>>> >  Animal = structure(
>>> >c(0

Re: [R] Value Labels: SPSS Dataset to R

2020-02-08 Thread John Kane
Hi Yawo Kokuvi;
As an R newbie transitioning from SPSS to R expect culture shock and the
possible feeling that yor brain is twisting within your skull but it is
well worth.

Try something like this:
##+
dat1  <- structure(list(Animal = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0,
0), label = "Animal", labels = c(Cat = 0, Dog = 1), class =
"haven_labelled"),
Training = structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), label = "Type of
Training", labels = c(`Food as Reward` = 0,
`Affection as Reward` = 1), class = "haven_labelled"), Dance =
structure(c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1), label = "Did they dance?", labels = c(No =
0,
Yes = 1), class = "haven_labelled")), row.names = c(NA, -10L
), class = c("tbl_df", "tbl", "data.frame"))


library(sjlabelled)
str(dat1)
get_labels(dat1)
barplot(table(as_label(dat1$Dance)))
##==
Your problem sees to be omitting the as_label().

You do not need to load "haven"
read_spss() in sjlabelled should do the trick.


On Sat, 8 Feb 2020 at 05:44, Rui Barradas  wrote:

> Hello,
>
> Try
>
> aux_fun <- function(x){
>levels <- attr(x, "labels")
>factor(x, labels = names(levels), levels = levels)
> }
>
> newCatsDogs <- as.data.frame(lapply(CatsDogs, aux_fun))
>
> str(newCatsDogs)
> #'data.frame':  10 obs. of  3 variables:
> # $ Animal  : Factor w/ 2 levels "Cat","Dog": 1 1 1 1 1 1 1 1 1 1
> # $ Training: Factor w/ 2 levels "Food as Reward",..: 1 1 1 1 1 1 1 1 1 1
> # $ Dance   : Factor w/ 2 levels "No","Yes": 2 2 2 2 2 2 2 2 2 2
>
>
> As for the
>   - frequencies: ?table, ?tapply, ?aggregate,
>   - barplots: ?barplot
>
> You can find lots and lots of examples online of both covering what
> seems to simple use cases.
>
> Hope this helps,
>
> Rui Barradas
>
> Às 06:03 de 08/02/20, Yawo Kokuvi escreveu:
> > Thanks for all. Here is output from dput.  I used a different dataset
> > containing categorical variables since the previous one is on a different
> > computer.
> >
> > In the following dataset, my interest is in getting frequencies and
> > barplots for the two variables: Training and Dance, with value labels
> > displayed.
> >
> > thanks again - cY
> >
> >
> > =
> > dput(head(CatsDogs, n = 10))
> > structure(
> >list(
> >  Animal = structure(
> >c(0, 0, 0, 0, 0, 0, 0, 0, 0,
> >  0),
> >label = "Animal",
> >labels = c(Cat = 0, Dog = 1),
> >class = "haven_labelled"
> >  ),
> >  Training = structure(
> >c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
> >label = "Type of Training",
> >labels = c(`Food as Reward` = 0,
> >   `Affection as Reward` = 1),
> >class = "haven_labelled"
> >  ),
> >  Dance = structure(
> >c(1,
> >  1, 1, 1, 1, 1, 1, 1, 1, 1),
> >label = "Did they dance?",
> >labels = c(No = 0,
> >   Yes = 1),
> >    class = "haven_labelled"
> >  )
> >),
> >row.names = c(NA,-10L),
> >class = c("tbl_df", "tbl", "data.frame")
> > )
> >
> >
> > On Fri, Feb 7, 2020 at 10:14 PM Bert Gunter 
> wrote:
> >
> >> Yes. Most attachments are stripped by the server.
> >>
> >> 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 7, 2020 at 5:34 PM John Kane  wrote:
> >>
> >>> Hi,
> >>> Could you upload some sample data in dput form?  Something like
> >>> dput(head(Scratch, n=13)) will give us some real data to examine. Just
> >>> copy
> >>> and paste the output of dput(head(Scratch, n=13))into the email. This
> is
> >>> the best way to ensure that R-help denizens are getting the data in the
> >>> exact format that you have.
> >>>
> >>> On Fri, 7 Feb 2020 at 15:32, Yawo Kokuvi  wrote:
> >>>
> >>>> Thanks for all your assistance
> >>>>
> >>>> Attached please is the Rdata scratch I have been using
> >>>

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread John Kane
 transitioning from SPSS to R.
> > >
> > > I used the haven library to import some of my spss data files to R.
> > >
> > > However, when I run procedures such as frequencies or crosstabs, value
> > > labels for categorical variables such as gender (1=male, 2=female) are
> > not
> > > shown. The same applies to many other output.
> > >
> > > I am confused.
> > >
> > > 1. Is there a global setting that I can use to force all categorical
> > > variables to display labels?
> > >
> > > 2. Or, are these labels to be set for each function or package?
> > >
> > > 3. How can I request the value labels for each function I run?
> > >
> > > Thanks in advance for your help..
> > >
> > > Best, Yawo
> > >
> > > [[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.
> >
> >
> >
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

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


Re: [R] how to read a database in R?

2020-02-01 Thread John Kane
What happens if you run "dbListTables(db) "?
That is a warning not an error.

I am a real novice with data bases so I may not be of much help but do you
know where the db file came from?

When I suggested the code above. i checked that ii worked on a sqlite file
I had, and hoped that Ivan's miraculous inspiration  was correct.  It could
possibly be some other db type

I will attach my sample db here and if it makes it through, you should be
able to load it if RSQLite is functioning on your machine.

On Sat, 1 Feb 2020 at 10:10, Ana Marija  wrote:

> Hi John,
>
> I tried it but this is what I got:
>
> > library(RSQLite)
> > filename <- "DGN-WB_0.5.db"
> > sqlite.driver <- dbDriver("SQLite")
> > db <- dbConnect(sqlite.driver,
> + dbname = filename)
> Warning message:
> Couldn't set synchronous mode: disk I/O error
> Use `synchronous` = NULL to turn off this warning.
>
> Please advise,
> Ana
>
> On Sat, Feb 1, 2020 at 8:55 AM John Kane  wrote:
> >
> > Hi Ana
> > Stolen from https://gist.github.com/jwolfson/72bc7d7fd8d339955b38
> > I cannot remember if you will need to install any other packages besides
> RSQLite
> >
> > library(RSQLite)
> > filename <- "your_db_file.db"
> > sqlite.driver <- dbDriver("SQLite")
> > db <- dbConnect(sqlite.driver,
> > dbname = filename)
> >
> > ## Some operations
> > dbListTables(db)
> > mytable <- dbReadTable(db,"your_table_name"
> >
> > Best of luck
> >
> >
> > On Sat, 1 Feb 2020 at 07:53, Ana Marija 
> wrote:
> >>
> >> Hi Ivan
> >>
> >> Thanks for getting back to me. Can you please share with me some code I
> >> would use to see what is in my database?
> >>
> >> On Sat, 1 Feb 2020 at 06:19, Ivan Krylov  wrote:
> >>
> >> > On Fri, 31 Jan 2020 17:02:16 -0600
> >> > Ana Marija  wrote:
> >> >
> >> > > I have a database DGN-WB_0.5.db is there is a way to explore its
> >> > > content in R?
> >> >
> >> > My psychic debugging powers tell me that it's an SQLite database, so
> >> > the answer to your question is: yes, it should be possible to both
> find
> >> > out the schema and run SQL queries on your file from R.
> >> >
> >> > --
> >> > Best regards,
> >> > Ivan
> >> >
> >>
> >> [[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.
> >
> >
> >
> > --
> > John Kane
> > Kingston ON Canada
>


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


Re: [R] how to read a database in R?

2020-02-01 Thread John Kane
Hi Ana
Stolen from https://gist.github.com/jwolfson/72bc7d7fd8d339955b38
I cannot remember if you will need to install any other packages besides
RSQLite

library(RSQLite)
filename <- "your_db_file.db"
sqlite.driver <- dbDriver("SQLite")
db <- dbConnect(sqlite.driver,
dbname = filename)

## Some operations
dbListTables(db)
mytable <- dbReadTable(db,"your_table_name"

Best of luck


On Sat, 1 Feb 2020 at 07:53, Ana Marija  wrote:

> Hi Ivan
>
> Thanks for getting back to me. Can you please share with me some code I
> would use to see what is in my database?
>
> On Sat, 1 Feb 2020 at 06:19, Ivan Krylov  wrote:
>
> > On Fri, 31 Jan 2020 17:02:16 -0600
> > Ana Marija  wrote:
> >
> > > I have a database DGN-WB_0.5.db is there is a way to explore its
> > > content in R?
> >
> > My psychic debugging powers tell me that it's an SQLite database, so
> > the answer to your question is: yes, it should be possible to both find
> > out the schema and run SQL queries on your file from R.
> >
> > --
> > Best regards,
> > Ivan
> >
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] "In sqrt(VS) : NaNs produced"

2020-01-20 Thread John Kane
As a follow-up to Michael's post, here is a link to some advice on how
create the example.
/http://adv-r.had.co.nz/Reproducibility.html "> How to write a
reproducible example 


On Mon, 20 Jan 2020 at 08:49, Michael Dewey  wrote:

> Your script and data were stripped so we are none the wiser I am afraid.
> You need to embed the script in your post and give a minimal data-set
> which exhibits the problem using dput() and embed that in the post too.
>
> Michael
>
> On 19/01/2020 08:25, Atul Saini wrote:
> > Hello R,
> >   I am attaching the script and data please help me to solve
> the
> > problem of
> >
> > "In sqrt(VS) : NaNs produced"  with the p value of dumy$Mar
> >
> > Regards,
> > __
> > 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.
> >
>
> --
> Michael
> http://www.dewey.myzen.co.uk/home.html
>
> __
> 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.
>


-- 
John Kane
Kingston ON Canada

[[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] What is best way to calculate % of time?

2019-12-25 Thread John Kane
 LyX Document
Hi Bruce,
 Combining date and times does not provide for sampling nights that roll
over after midnight. 
Ah yesss legacies
The location, date and time does provide unique variables.
Ah, i thought so
Rounding to nearest minute suffices for a summary of total minutes spent
with "feeding attempts" vs total active time.
Okay, that removes my worry about durations. We can just treat each entry
as one elapsed minute?
however I still do not grasp the duplicated issue. we have in my dataframe:
Species Location dtime
Ptedav 7717 2000-07-03 20:15:00
Ptedav 7717 2000-07-03 20:15:00
Ptedav 7717 2000-07-03 20:15:00
Ptedav 7717 2000-07-03 20:15:00
Ptedav 7717 2000-07-03 20:15:00
I assume that this represents 5 separate recording but that they can be
collapsed into one 1-minute data point?  If so then would not all you need
to do is run a simple table() command? To handle the Buzz one mould produce
the Buzz data.frame and merge it with the new species data.frame?
I must be missing something. It looks too simple.



On Wed, 25 Dec 2019 at 18:11, Neotropical bat risk assessments <
neotropical.b...@gmail.com> wrote:

> Hi Bert,
>
> Tnx for taking time to reply.
> For clarification... the data do EXPLICITLY indicate when each species
> is active and when a feeding buzz is recorded.
> That is ALL it provides based on acoustic data recorded in the field.
> Only when a species is recorded  is it identified as active.
> How this is accomplished is of no importance to the question I asked.
>
> Note this is Not "individuals" per se. but species as a group.
>
> I appreciate you taking time to reply.
> Clearly this is not a simple solution to what I assumed to be a simple
> question.
> Restated as...
> *How best to use R to calculate occurrence of event( (A) over time vs
> all events (b...n) over the same time period give the data frame work I
> have.*
>
> Cheers,
> Bruce
>
>
> > I will not get into your explanation of details that, like John, I
> > find opaque. Please DO read Hadley's manifesto, as it appears that you
> > need to organize your data more appropriately.
> >
> > AFAICS, however, strictly speaking your data cannot answer the
> > question you have posed. **Strictly speaking** to know the proportion
> > of active time bats spend feeding, **for each bat** you would need to
> > know when it is active and when it is feeding during that time. You
> > could then summarize this for all bats (e.g. take the average or
> > median proportion) in a species or whatever. As you cannot identify
> > individual bats in your data, you cannot do this -- i.e. you cannot
> > answer your question.
> >
> > So the question then becomes: precisely **how** exactly do you propose
> > using the data you have to determine when a *group* of bats are active
> > and when they are feeding? How are the groups explicitly identified
> > and how are their times active and feeding determined? In short, you
> > need to have information that is something like:
> >
> > Bat.Group date   active.time.start  active.time.end
> > feeding.time.start feeding.time.end
> >
> > ( for a given date and bat group, there may be many multiple entries;
> > perhaps for a given group, date, and active time start and end,
> > several feeding time start/stop entries ( I have no idea how bats
> > behave)).
> >
> > Until you can expicitly explain how your data can generate such
> > information, I think it will be difficult/impossible to help you.
> >
> > Cheers,
> > Bert
> >
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] What is best way to calculate % of time?

2019-12-25 Thread John Kane
Dec 2019 at 07:29, Neotropical bat risk 
> assessments  wrote:
>
> Hi all,
>
> It seems R has gotten better/more packages in dealing with time data.
>
> I want to create "simple" summaries of time for bat activity.
> Data is all in an Access relational database and exported as a CSV file
> with 4 columns in this format:
> Species = a 6 letter code or "Buzz" to indicated when bats are feeding
> Location = a 4 digit number
> Date= MMDD
> Time=HH:MM (24 hr format)
>
> SpeciesLocationDateTime
> Buzz77161/25/20000:05
> Buzz77161/25/20000:05
> Buzz77161/25/20000:05
> Buzz77161/25/20000:47
> Buzz77161/25/20000:47
> Buzz77161/25/20000:47
> Buzz77161/25/20000:47
> Buzz77177/3/200020:17
> Buzz77177/3/200020:17
> Buzz77177/3/200020:17
> Buzz77177/3/200020:17
> Buzz77177/3/200020:30
> Buzz77177/3/200020:30
> Buzz77177/3/200020:30
> Buzz77177/3/200020:30
> Ptedav77177/3/200020:14
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:17
> Ptedav77177/3/200020:17
> Ptedav77177/3/200020:17
> Ptedav77177/3/200020:18
> Ptedav77177/3/200020:18
> Ptedav77177/3/200020:18
> Ptedav77177/3/200020:18
> Ptedav77177/3/200020:18
> Ptemes77177/3/200023:15
> Ptemes77177/3/200023:21
> Ptemes77177/3/200023:22
> Ptemes77177/3/200023:23
> Ptemes77177/3/200023:25
> Ptemes77177/3/200023:26
> Ptemes77177/3/200023:27
> Ptemes77177/3/200023:28
> Ptemes77177/3/200023:29
> Ptemes77177/3/200023:33
> Ptemes77177/3/200023:35
> Ptemes77177/3/200023:36
> Ptemes77177/3/200023:37
>
> The above is clearly not a complete DF but only a format sample. Data
> begins when the first bat was recorded and ends when the last bat was
> recorded.  So all are times from sunset to sunrise.  Dates roll over so
> for example one night of data would begin at 18:00 1/1/2000 and end
> 06:00 1/2/2000.
>
> What I need to do is have a summary of Buzz events (feeding) and
> calculate the percentage of total time bats were active and have a
> summary of time feeding buzz was recorded and total bat activity to
> determine what percentage of time was spent with feeding attempts over
> the active period.
>
> This by all bats by survey night and by single species by survey night.
> Any suggestions welcomed.
>
> Happy holidays all
>
>
> --
> Bruce W. Miller, PhD.
> Neotropical bat risk assessments
> Conservation Fellow - Wildlife Conservation Society
>
> If we lose the bats, we may lose much of the tropical vegetation and the 
> lungs of the planet
>
> Using acoustic sampling to identify and map species distributions
> and pioneering acoustic tools for ecology and conservation of bats for >25 
> years.
>
> Key projects include providing free interactive identification keys and call 
> fact sheets for the vocal signatures of New World Bats
>
> __r-h...@r-project.org mailing 
> list -- To UNSUBSCRIBE and more, 
> seehttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> --
> John Kane
> Kingston ON Canada
>
>
>
> --
> Bruce W. Miller, PhD.
> Neotropical bat risk assessments
> Conservation Fellow - Wildlife Conservation Society
>
> If we lose the bats, we may lose much of the tropical vegetation and the 
> lungs of the planet
>
> Using acoustic sampling to identify and map species distributions
> and pioneering acoustic tools for ecology and conservation of bats for >25 
> years.
>
> Key projects include providing free interactive identification keys and call 
> fact sheets for the vocal signatures of New World Bats
>
>
>

-- 
John Kane
Kingston ON Canada

[[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] What is best way to calculate % of time?

2019-12-25 Thread John Kane
I am sorry but I am at a loss here.
According to your sample data you have 3 Species : Buzz,  Ptedav,
Ptemes, but you say that "Buzz" indicates that the bat is feeding.
What has that to do with feeding?

Assuming Buzz is feeding activity, are all incidents of feeding
activity a single point in time?

Likewise the data has multiple entries such as
Ptedav77177/3/200020:15
Ptedav77177/3/200020:15
Ptedav77177/3/200020:15
Ptedav77177/3/200020:15

What does that represent?


On Wed, 25 Dec 2019 at 07:29, Neotropical bat risk assessments
 wrote:
>
> Hi all,
>
> It seems R has gotten better/more packages in dealing with time data.
>
> I want to create "simple" summaries of time for bat activity.
> Data is all in an Access relational database and exported as a CSV file
> with 4 columns in this format:
> Species = a 6 letter code or "Buzz" to indicated when bats are feeding
> Location = a 4 digit number
> Date= MMDD
> Time=HH:MM (24 hr format)
>
> SpeciesLocationDateTime
> Buzz77161/25/20000:05
> Buzz77161/25/20000:05
> Buzz77161/25/20000:05
> Buzz77161/25/20000:47
> Buzz77161/25/20000:47
> Buzz77161/25/20000:47
> Buzz77161/25/20000:47
> Buzz77177/3/200020:17
> Buzz77177/3/200020:17
> Buzz77177/3/200020:17
> Buzz77177/3/200020:17
> Buzz77177/3/200020:30
> Buzz77177/3/200020:30
> Buzz77177/3/200020:30
> Buzz77177/3/200020:30
> Ptedav77177/3/200020:14
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:15
> Ptedav77177/3/200020:17
> Ptedav77177/3/200020:17
> Ptedav77177/3/200020:17
> Ptedav77177/3/200020:18
> Ptedav77177/3/200020:18
> Ptedav77177/3/200020:18
> Ptedav77177/3/200020:18
> Ptedav77177/3/200020:18
> Ptemes77177/3/200023:15
> Ptemes77177/3/200023:21
> Ptemes77177/3/200023:22
> Ptemes77177/3/200023:23
> Ptemes77177/3/200023:25
> Ptemes77177/3/200023:26
> Ptemes77177/3/200023:27
> Ptemes77177/3/200023:28
> Ptemes77177/3/200023:29
> Ptemes77177/3/200023:33
> Ptemes77177/3/200023:35
> Ptemes77177/3/200023:36
> Ptemes77177/3/200023:37
>
> The above is clearly not a complete DF but only a format sample. Data
> begins when the first bat was recorded and ends when the last bat was
> recorded.  So all are times from sunset to sunrise.  Dates roll over so
> for example one night of data would begin at 18:00 1/1/2000 and end
> 06:00 1/2/2000.
>
> What I need to do is have a summary of Buzz events (feeding) and
> calculate the percentage of total time bats were active and have a
> summary of time feeding buzz was recorded and total bat activity to
> determine what percentage of time was spent with feeding attempts over
> the active period.
>
> This by all bats by survey night and by single species by survey night.
> Any suggestions welcomed.
>
> Happy holidays all
>
>
> --
> Bruce W. Miller, PhD.
> Neotropical bat risk assessments
> Conservation Fellow - Wildlife Conservation Society
>
> If we lose the bats, we may lose much of the tropical vegetation and the 
> lungs of the planet
>
> Using acoustic sampling to identify and map species distributions
> and pioneering acoustic tools for ecology and conservation of bats for >25 
> years.
>
> Key projects include providing free interactive identification keys and call 
> fact sheets for the vocal signatures of New World Bats
>
> ______
> 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.



--
John Kane
Kingston ON Canada

__
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

2019-12-17 Thread John Kane
library(lubridate)
gs$dat1  <-  mdy(gs$date)

On Tue, 17 Dec 2019 at 18:38, peter dalgaard  wrote:
>
> ...and switch the order, and use %y for 2-digit years.
>
> > On 17 Dec 2019, at 23:57 , Patrick (Malone Quantitative) 
> >  wrote:
> >
> > Try putting / instead of - in your format, to match the data.
> >
> > On Tue, Dec 17, 2019 at 5:52 PM Val  wrote:
> >>
> >> Hi All,
> >>
> >> I wanted to to convert character date  mm/dd/yy  to -mm-dd
> >> The sample data and my attempt is shown below
> >>
> >> gs <-read.table(text="ID date
> >> A1   09/27/03
> >> A2   05/27/16
> >> A3   01/25/13
> >> A4   09/27/19",header=TRUE,stringsAsFactors=F)
> >>
> >> Desired output
> >>  ID date  d1
> >> A1 09/27/03 2003-09-27
> >> A2 05/27/16 2016-05-27
> >> A3 01/25/13 2012-04-25
> >> A4 09/27/19 2019-09-27
> >>
> >> I used this
> >> gs$d1 = as.Date(as.character(gs$date), format = "%Y-%m-%d")
> >>
> >> but I got NA's.
> >>
> >> How do I get my desired result?
> >> Thank you.
> >>
> >> __
> >> 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.
>
> --
> 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.



-- 
John Kane
Kingston ON Canada

__
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] Another Real Basic Question

2019-10-18 Thread John Kane
Can you open in a text editor?

On Wed, 16 Oct 2019 at 23:11, Phillip Heinrich  wrote:
>
> In the Source window of RStudio (upper left) I save my code (File/Save) but 
> can not reload it.  There is a file labeled (RECode.R) but neither File/Open 
> file or File/Recent Files gets me anywhere.
>
> Any ideas what I’m doing wrong.
> [[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.



-- 
John Kane
Kingston ON Canada

__
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 corrupted in R/magic number

2019-08-27 Thread John Kane
To be honest , we would probably have to see a sample of the data.
Can you supply a location for small data sample. Other than that  we
are guessing.

Other than that , can you open it in a text editor?  That will help
assure it is really not a corrupt file.

After using R for over 15 years, the worst thing is importing data files !

On Tue, 27 Aug 2019 at 14:00, pusuluri madhu  wrote:
>
> Please help me to get rid out of this situation. While loading the csv file
> error msg like
> Error: bad restore file manager (file may be corrupted)-- no data loaded.
> In addition warning message: file "S_D.csv" has magic number GeneN. Use of
> save versions more than 2 is deprecated.
>
> Please kindly suggest
>
> --
>
> *Madhu Pusuluri, Ph D*
> *Visiting Scientist.*
> *Genomics & Trait discovery- Genetic Gains*
>
> *International Crops Research Institute for the Semi-Arid Tropics (ICRISAT)*
>
> *Patancheru, Hyderabad,  Telangana 502324, INDIA.*
>
> *E-mail: **m.pusul...@cgiar.org **;
> madhupusul...@gmail.com
> <https://outlook.office.com/owa/madhupusul...@gmail.com>*
>
> *Tel: +91 9912241982.*
>
> [[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.



-- 
John Kane
Kingston ON Canada

__
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] Plotting in R

2019-07-06 Thread John Kane
Please do not post in html.

You could use ggplot to do this. But you need to do a bit of work yourself.

On Sat, 6 Jul 2019 at 10:51,  wrote:
>
> Hello,
>
> Please don't post inHTML, the data is unreadable.
>
> As for the question, it is very basic. try any of
>
>
> plot(rate ~ year, data = df)# df is your dataframe
> plot(df$year, df$rate)
>
>
> Then read ?plot and ?par to see how to customize the graph, by
> changing the plot type, how to add colors, etc.
>
> Hope this helps,
>
> Rui Barradas
>
>
>
> Citando Steven Yen :
>
> > I have a data frame containing two variables: year and rate (shown below).
> > Which function can I use to plot rate (y-axis) against year (x-axis)?
> > There will be more columns of rate later on.
> > Thank you.
> >
> > year rate 1 1993 0.608 2 1994 0.622 3 1996 0.623 4 1998 0.647 5 2000
> > 0.646 6 2002 0.625 7 2004 0.628 8 2006 0.685 9 2008 0.679 10 2010 0.595
> > 11 2012 0.567 12 2014 0.599 13 2016 0.642 14 2018 0.685
> >
> >
> > --
> > st...@ntu.edu.tw (S.T. Yen)
> >
> >
> >
> > ---
> > This email has been checked for viruses by Avast antivirus software.
> > https://www.avast.com/antivirus
> >
> >   [[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.



-- 
John Kane
Kingston ON Canada

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


Re: [R] How to change x axes labels in plot_ly?

2019-06-23 Thread John Kane
Could you supply some code and sample data. The data should be in
dput() format. The way the data has arrived is very difficult to read.

I have never heard of ploty. Is that a typo?

To answer your direct question, yes you should be able to change the
x-axis labels but we need to get some idea of what exactly you are
doing before we can easily suggest a solution.

I would recommend reading this two links to get an idea of how to
present a question in order to get the besc reply
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

 http://adv-r.had.co.nz/Reproducibility.html

On Thu, 20 Jun 2019 at 11:05,  wrote:
>
> Hi everyone,
>
>
>
> I have been struggling with this for a while, and I hope someone can give me
> some advice.
>
> I have built a line chart that shows a cumulated value of number of
> transactions, and there are 2 lines on the chart comparing last year with
> this year.
>
> The way I matched last year's data with this year's data is by the month and
> day (without the year), so my data looks like this:
>
>
> Month-Day
>
> FiscalYear_Days
>
> Last_year
>
> This_Year
>
>
> 05-01
>
> 0
>
> 16
>
> 10
>
>
> 05-02
>
> 1
>
> 17
>
> 14
>
>
> 05-03
>
> 2
>
> 22
>
> 18
>
>
> 05-04
>
> 3
>
> 25
>
> 18
>
>
>
> chart_data <- matrix(c("05-01", "05-02", "05-03", "05-04",
>
> "0", "1", "2", "3",
>
> "16", "17", "22", "25",
>
> "10", "14", "18", "18"),
>
> nrow=4, ncol=4, dimnames=list(c("A","B","C","D"),
> c("Month-Day","FiscalYear_Days", "Last_year", "This_Year")))
>
>
>
> Since our fiscal year doesn't start on January 1st, I had to introduce this
> column called "FiscalYear_Days", which is the number of days passed since
> 1st day of fiscal year, and matched last year and current year by that
> instead. Otherwise I had a problem with plot_ly() showing the chart starting
> with January 1st on the left.
>
>
>
> Now I figured out a way to change the order of the x axis labels to make it
> based on the "FiscalYear_Days" instead. This is a simplified plot:
>
> plot_ly(renewals_chart_data,
>
> x = ~`Month-Day`,
>
> y = ~Last_Year,
>
> type = 'scatter',
>
> mode = 'lines'
>
> ) %>%
>
>   layout(xaxis = list(categoryarray = renewals_chart_data$FiscalYear_Days,
> categoryorder = "array"))
>
>
>
> My problem now is that if the period is longer than 1 year, under Month-Day
> column I will have some repeating values starting from following year May
> 1st (05-01, 05-02, etc.), and the plotly chart shows an increasing line that
> returns back to the left side when reaches the next year's May 1st.
>
> How can I make the line to continue on the right?
>
> If I change plotly to show the x axis based on "FiscalYear_Days", the line
> is right, but I want at the bottom to show the month and day as labels:
>
> plot_ly(renewals_chart_data,
>
> x = ~`FiscalYear_Days`,
>
> y = ~Last_Year,
>
> type = 'scatter',
>
> mode = 'lines'
>
> ) %>%
>
>   layout(xaxis = list(categoryarray = renewals_chart_data$FiscalYear_Days,
> categoryorder = "array"))
>
>
>
> Is it possible to just change the x axis label values?
>
>
>
> Thanks a lot,
>
> Steven
>
> __
> 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.



-- 
John Kane
Kingston ON Canada

__
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] Color-coding data points in complex dotplot (ggplot2)

2019-04-06 Thread John Kane
6L, 2L, 3L, 5L, 1L, 4L,
>
> 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L,
>
> 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L,
>
> 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L,
>
> 5L, 1L, 4L, 6L, 2L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L,
>
> 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L,
>
> 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L,
>
> 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L,
>
> 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L,
>
> 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L,
>
> 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L, 2L, 3L, 5L, 1L, 4L, 6L,
>
> 2L, 3L, 5L, 1L), .Label = c("HighCon", "HighExp", "LowCon",
>
> "LowExp", "MidCon", "MidExp"), class = "factor"), CT = c(4.61538,
>
> 3.96739, 7.34797, 3.58108, 2.89655, 2.7993, 10.56122, 10.68396,
>
> 15.57252, 6.79245, 9.23469, 9.18, 1.1087, 4.26136, 1.14504,
>
> 2.20238, 3.15789, 9.54082, 11.05263, 15.84783, 10.48986,
>
> 12.62195, 15.12931, 5.51471, 8.20313, 11.85811, 3.38115,
>
> 7.5, 9.69512, 8.64407, 11.30597, 14.42797, 8.8125, 11.82482,
>
> 11.53061, 6.97674, 9.62766, 10.88028, 5.50403, 9.73558, 8.56419,
>
> 11.84524, 16.34892, 18.15789, 10.58036, 14.80932, 12.06081,
>
> 12.96992, 9.86014, 12.45652, 6.625, 6.93396, 9.10714, 3.66142,
>
> 9.19811, 10.88346, 2.88851, 6.85096, 10.27778, 8.29787, 13.00885,
>
> 14.38017, 7.5, 11.77734, 13.84615, 2.22772, 5.28, 5.25641,
>
> 1.0514, 2.73256, 4.1, 11.39098, 11.10236, 13.00781, 7.95259,
>
> 10.15748, 13.16327, 8.90625, 10.04587, 13.625, 6.27049, 9.27966,
>
> 10.94037, 5.80189, 7.76978, 7.34266, 3.80952, 3.75, 7.29545,
>
> 10.45872, 16.83206, 5.95238, 7.70833, 10.92391, 11.03659,
>
> 14.39338, 14.88281, 8.22917, 11.63603, 14.7561, 11.9469,
>
> 14.65649, 16.84615, 8.37209, 13.27982, 13.69128, 7.8,
>
> 12.59124, 12.32955, 7.00472, 8.41121, 7.2, 9.43878, 10.33613,
>
> 14.16667, 9.60526, 8.77232, 11.91589, 7.01786, 12.29592,
>
> 11.83673, 8.55634, 11.17347, 12.68836, 2.7551, 6, 7.21374,
>
> 2.52101, 4.03846, 4.80634, 5.49569, 4.78723, 6.02273, 3.04511,
>
> 3.59244, 2.48239, 1.54412, 5.74219, 7.68595, 1.33065, 2.625,
>
> 4.42164, 9.66942, 11.875, 17.91667, 10.81731, 13.05288, 16.23853,
>
> 11.93662, 14.31818, 14.09396, 7.82374, 15.5042, 10.86207,
>
> 6.87023, 11.69492, 12.65957, 3.48684, 5.29018, 7.89474, 10.53309,
>
> 17.05479, 16.63866, 7.43119, 12.06522, 12.05607, 6.14865,
>
> 10.44, 14.69512, 9.24757, 9.04018, 12.38255, 2.2, 3.90756,
>
> 5.85616, 2.23958, 3.8125, 3.01056, 11.60256, 12.2, 11.8007,
>
> 7.76316, 10.08197, 12.78777, 9.20455, 12.1875, 16.59449,
>
> 6.82331, 10.91518, 11.5748)), row.names = 192:381, class = "data.frame")
>
>
>
>
>
>
>
>
>
>
>
> __
> 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.



-- 
John Kane
Kingston ON Canada

__
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] Problems install R package "Caret" in Rstudio version 3.3.3

2019-04-01 Thread John Kane
Hi Chaoyang,
R 3.3.3 is rather old. If possible you should upgrade to 3.5.3. I
believe 'caret' will install properly under R 3.5.3

On Mon, 1 Apr 2019 at 02:49, Chaoyang Li  wrote:
>
> Hi, everyone,
> I was trying to use the ‘caret’ for splitting dataset and cross 
> validation function, but I couldn’t install this package and it always gives 
> me following warning:
> Warning in install.packages :
>  package ‘caretEnsembles’ is not available (for R version 3.3.3).
> Thank you so much!!
>
> Chaoyang
> __
> 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.



-- 
John Kane
Kingston ON Canada

__
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] Structuring data for Correspondence Analysis

2019-03-30 Thread John Kane
Hi Alfredo,
I have not used SAS nor done a correspondence analysis in many years
but to give R-help readers an idea of what you are doing, we probably
need a short statement of the substantive  problem  that would lead to
the SAS program:
proc corresp data=table dim=2 outc=_coord;
   table Preference, Sex Age Time;

I believe that there are several packages in R that will do a
correspondence analysis (For one see
https://www.statmethods.net/advstats/ca.html). Have you checked out
any of the packages? If so which one are you thinking of using?

Next, we need to see some sample data. Have a look at these two links
that may help you give us more information on the problem and what you
are looking for.  It is important to supply some sample data. It does
not have to be much.  The very best way to supply the sample data is
to use the dput() function that you will find described in the links.

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

 http://adv-r.had.co.nz/Reproducibility.html

On Fri, 29 Mar 2019 at 17:35, jim holtman  wrote:
>
> I am not familiar with SAS, so what did you want your output to look like.
> There is the 'table' function that might do the job and then there is
> always 'dplyr' which can do the hard stuff.  So we need more information on
> what you want.
>
> Jim Holtman
> *Data Munger Guru*
>
>
> *What is the problem that you are trying to solve?Tell me what you want to
> do, not how you want to do it.*
>
>
> On Fri, Mar 29, 2019 at 6:35 AM Alfredo 
> wrote:
>
> > Hi, I am very new to r and need help from you to do a correspondence
> > analysis because I don't know how to structure the following data:
> >
> > Thank you.
> >
> > Alfredo
> >
> >
> >
> > library(ca,lib.loc=folder)
> >
> > table <- read.csv(file="C:\\Temp\\Survey_Data.csv", header=TRUE, sep=",")
> >
> > head (table, n=20)
> >
> > Preference   SexAge   Time
> >
> > 1   News/Info/Talk M  25-30  06-09
> >
> > 2Classical F  >3509-12
> >
> > 3  Rock and Top 40 F  21-25  12-13
> >
> > 4 Jazz M  >3513-16
> >
> > 5   News/Info/Talk F  25-30  16-18
> >
> > 6 Don't listen F  30-35  18-20
> >
> > ...
> >
> > 19 Rock and Top 40 M  25-30  16-18
> >
> > 20  Easy Listening F  >3518-20
> >
> >
> >
> > In SAS I would simply do this:
> >
> > proc corresp data=table dim=2 outc=_coord;
> >
> >table Preference, Sex Age Time;
> >
> > run;
> >
> >
> >
> > I don't know how convert in R a data frame to a frequency table to execute
> > properly this function:
> >
> > ca <- ca(, graph=FALSE)
> >
> >
> > [[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.



-- 
John Kane
Kingston ON Canada

__
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] Analysing diallel and line x tester mating design with multiple location in R

2019-03-28 Thread John Kane
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

 http://adv-r.had.co.nz/Reproducibility.html

On Thu, 28 Mar 2019 at 11:17, oluwayemisi ige via R-help
 wrote:
>
> Good morning.
> My name is Gbemisola, am a PhD student in Plant Breeding. Please am having 
> difficulties in analyzing diallel and line x tester mating design with 
> multiple location in R, can you be of help?
>
> Thanks for your response.
> Gbemisola
>
> Sent from Mail for Windows 10
>
>
> [[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.



-- 
John Kane
Kingston ON Canada

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


  1   2   3   4   5   6   7   8   9   10   >