[R] reg expr that retains only bracketed text from strings

2019-06-11 Thread nevil amos
Hi

I am trying to extract only the text contained in brackets from a vector of
strings
not all of the strings contain closed bracketed text, they should return an
empty string or NA

this is what I have at the moment


mystrings<-c("ABC","A(B)C","AB(C)")

substring(mystrings, regexpr("\\(|\\)", mystrings))


#this returns the whole string  if there are no brackets.
[1] "ABC"  "(B)C" "(C)"


# my desired desired output:
#[1]  ""  "(B)" "(C)"

many thanks for any suggestions
Nevil Amos

[[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] Changing the label name in the plot

2019-06-11 Thread Subhamitra Patra
Hello Sir,

Thank you very much for your help for which I shall be always grateful to
you.

Concerning your questions,
"*1) Are the states in column 3 the same as those in column 1? As
you initially named the data frame "ts", perhaps the values in columns 2
and are taken at different times. If not, perhaps they are measured in
another set of countries, as yet unknown. Perhaps "DMs" and "EMs" are codes
that will resolve this.", *
I would like to answer that
the states in column 3 are not the same as in column 1. The data points in
column 2, and 4 are the values measured for different sets of countries.
Thus, they are a different set of values for a different set of countries,
and will not require one label for both the points in column 2 and 4 (i.e.
data columns). In particular, column 2 consists of the 45 data points that
measured for 45 countries (state names in column 1) whereas column 4
contains the 42 data points that measured for 42 another set of countries
(state name mentioned in column 3).  I tried both the column 2, and 4
separately along with their respective name columns, but unable to do
because K-mean test clusters only the numeric data points and is not
considering any non-numeric columns (i.e. state names). Thus, I considered
both the data points simultaneously, and after removing NAs from the data
table, both columns consist of the 42 data points. Hence, the number of
observations rather than the states name is coming in the clustered plot.
In this case, I stuck with the problem of setting a different label
(mentioned in column 1, and 3) for the different data points of column 2,
and 4.

Hope I successfully answered your question.

Thank you.



[image: Mailtrack]

Sender
notified by
Mailtrack

06/12/19,
9:47:04 AM

On Wed, Jun 12, 2019 at 6:04 AM Jim Lemon  wrote:

> Hi Subhamitra,
> It is time to admit that I had the wrong idea about what you wanted to
> do, due to the combination of trying to solve two problems at once
> while I was very tired. I appreciate your patience.
>
> From your last email, you have a data frame with four columns. The
> first and third are cryptic names for political states and the second
> and fourth are values that I assume are measured in those states.
> 1) Are the states in column 3 the same as those in column 1? As you
> initially named the data frame "ts", perhaps the values in columns 2
> and 4 are taken at different times. If not, perhaps they are measured
> in another set of countries, as yet unknown. Perhaps "DMs" and "EMs"
> are codes that will resolve this.
>
> I assumed that "DMs" and "EMs" should be used as the X and Y values on
> a scatterplot, as your initial example seemed to indicate. If so, they
> are different values for the same country and only require one label
> for each point. Proceeding from this, you can do something like this:
>
> spdf<-read.table(text="State DMs EMs
> JP 2.071 2.038
> CH 2.0548 2.017
> AT 2.0544 2.007
> CL 2.047 1.963
> ES 2.033 1.947
> PT 2.0327 1.942
> PL 2.0321 1.932
> FR 2.031 1.924
> SE 2.0293 1.913
> DE 2.0291 1.906
> DK 2.027 1.892
> UK 2.022 1.877
> TW 1.9934 1.869
> NL 1.993 1.849
> HK 1.989 1.848
> LU 1.988 1.836
> CA 1.987 1.835
> NZ 1.9849 1.819
> US 1.9842 1.798
> AU 1.981 1.771
> MY 1.978 1.762
> HU 1.968 1.717
> LT 1.96 1.707
> SG 1.958 1.688
> FI 1.955 1.683
> CR 1.953 1.671
> BY 1.952 1.664
> IL 1.95 1.646
> EE 1.948 1.633
> NO 1.945 1.624
> IE 1.937 1.621
> SI 1.913 1.584
> LV 1.901 1.487
> SK 1.871 1.482
> BH 1.801 1.23
> SK 1.761 1.129
> AE 1.751 1.168
> IS 1.699 0.941
> BM 1.687 0.591
> KW 1.668 0.387
> CY 1.633 0.16
> AP 1.56 0.0002",
> header = TRUE,stringsAsFactors=FALSE)
> library(cluster)
> k2 <- kmeans(spdf[,c(2,3)], centers = 2, nstart = 25)
> plot(spdf[,c(2,3)],col=k2$cluster,pch=19,xlim=c(1.55,2.1))
> text(spdf[,2]+rep(c(0.02,-0.02),42),
>  spdf[,3]+rep(c(-0.05,0.05),42),spdf[,1],col=k2$cluster)
> segments(spdf[,2],spdf[,3],spdf[,2]+rep(c(0.02,-0.02),42),
>  spdf[,3]+rep(c(-0.05,0.05),42),col=k2$cluster)
>
> I took the liberty of replacing your abbreviations with internet top
> level domains. As I hope you can see, you have a problem with crowded
> points and labels, even with the trick of spreading the labels out.
> You could modify the X and Y offsets by hand and get a much more
> readable plot.
>
> If this is not what you want, a bit more explanation of what you do
> want may get you there.
>
> Jim
>


-- 
*Best Regards,*
*Subhamitra Patra*
*Phd. Research Scholar*
*Department of Humanities and Social Sciences*
*Indian Institute of Technology, Kharagpur*
*INDIA*

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

Re: [R] Changing the label name in the plot

2019-06-11 Thread Jim Lemon
Hi Subhamitra,
It is time to admit that I had the wrong idea about what you wanted to
do, due to the combination of trying to solve two problems at once
while I was very tired. I appreciate your patience.

>From your last email, you have a data frame with four columns. The
first and third are cryptic names for political states and the second
and fourth are values that I assume are measured in those states.
1) Are the states in column 3 the same as those in column 1? As you
initially named the data frame "ts", perhaps the values in columns 2
and 4 are taken at different times. If not, perhaps they are measured
in another set of countries, as yet unknown. Perhaps "DMs" and "EMs"
are codes that will resolve this.

I assumed that "DMs" and "EMs" should be used as the X and Y values on
a scatterplot, as your initial example seemed to indicate. If so, they
are different values for the same country and only require one label
for each point. Proceeding from this, you can do something like this:

spdf<-read.table(text="State DMs EMs
JP 2.071 2.038
CH 2.0548 2.017
AT 2.0544 2.007
CL 2.047 1.963
ES 2.033 1.947
PT 2.0327 1.942
PL 2.0321 1.932
FR 2.031 1.924
SE 2.0293 1.913
DE 2.0291 1.906
DK 2.027 1.892
UK 2.022 1.877
TW 1.9934 1.869
NL 1.993 1.849
HK 1.989 1.848
LU 1.988 1.836
CA 1.987 1.835
NZ 1.9849 1.819
US 1.9842 1.798
AU 1.981 1.771
MY 1.978 1.762
HU 1.968 1.717
LT 1.96 1.707
SG 1.958 1.688
FI 1.955 1.683
CR 1.953 1.671
BY 1.952 1.664
IL 1.95 1.646
EE 1.948 1.633
NO 1.945 1.624
IE 1.937 1.621
SI 1.913 1.584
LV 1.901 1.487
SK 1.871 1.482
BH 1.801 1.23
SK 1.761 1.129
AE 1.751 1.168
IS 1.699 0.941
BM 1.687 0.591
KW 1.668 0.387
CY 1.633 0.16
AP 1.56 0.0002",
header = TRUE,stringsAsFactors=FALSE)
library(cluster)
k2 <- kmeans(spdf[,c(2,3)], centers = 2, nstart = 25)
plot(spdf[,c(2,3)],col=k2$cluster,pch=19,xlim=c(1.55,2.1))
text(spdf[,2]+rep(c(0.02,-0.02),42),
 spdf[,3]+rep(c(-0.05,0.05),42),spdf[,1],col=k2$cluster)
segments(spdf[,2],spdf[,3],spdf[,2]+rep(c(0.02,-0.02),42),
 spdf[,3]+rep(c(-0.05,0.05),42),col=k2$cluster)

I took the liberty of replacing your abbreviations with internet top
level domains. As I hope you can see, you have a problem with crowded
points and labels, even with the trick of spreading the labels out.
You could modify the X and Y offsets by hand and get a much more
readable plot.

If this is not what you want, a bit more explanation of what you do
want may get you there.

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.


Re: [R] LaTeX Error in creating manual from Rd files

2019-06-11 Thread Duncan Murdoch

On 11/06/2019 5:54 p.m., Helmut Schütz wrote:

Hi,

I’m getting -- many -- errors/warnings (both when uploading to
win-builder.r-project.org as well as locally):
* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! LaTeX Error: Something's wrong--perhaps a missing \item.
   ...
* checking PDF version of manual without hyperrefs or index ... ERROR
* DONE
Status: 1 ERROR, 1 WARNING, 0 NOTE

All errors are generated in man-pages where I describe datasets of my
package.
Snippet causing the error (confirmed by my.package-manual.log,
my.package-manual.tex, Rdlatex.log):


You have \describe with no \item.  That leads to illegal LaTeX.

Instead of

 \describe{
   bar
   \tabular{ll}{
   ...

you should have


 \describe{
   \item{bar}{
 \tabular{ll}{
 ...
   }

Duncan Murdoch




Rd:
\format{
    \itemize{
      \item an item\cr
      foo
    \describe{
    bar
    \tabular{ll}{
      \code{a} \tab a factor with x levels: 1, 2, \ldots, x\cr
      \code{b} \tab a factor with 4 levels: 1, 2, 3, 4\cr
      \code{c} \tab a numeric vector of responses
    }
    baz
    \tabular{ll}{
      \code{x} \tab x.x\%\cr
      \code{y} \tab y.y\%
    }
      }
      \item yet another item\cr
      foo
    \describe{
    bar
    \tabular{ll}{
      \code{a} \tab a factor with x levels: 1, 2, \ldots, x\cr
      \code{b} \tab a factor with 4 levels: 1, 2, 3, 4\cr
      \code{c} \tab a numeric vector of responses
    }
    baz
    \tabular{ll}{
      \code{x} \tab x.x\%\cr
      \code{y} \tab y.y\%
    }
      }
    }
}

Translated to:

\begin{Format}
    \begin{itemize}
      \item an item\\{}
      foo
      \begin{description}
    bar
    \Tabular{ll}{
      \code{a} & a factor with x levels: 1, 2, \ldots, x\\{}
      \code{b} & a factor with 4 levels: 1, 2, 3, 4\\{}
      \code{c} & a numeric vector of responses{}
    }
    baz
      \Tabular{ll}{
      \code{x} & n.n\%\\{}
      \code{y} & n.n\%
    }
      \end{description}
      \item yet another item\\{}
      foo
      \begin{description}
    bar
    \Tabular{ll}{
    \code{x} & a factor with x levels: 1, 2, \ldots, x\\{}
    \code{y} & a factor with 4 levels: 1, 2, 3, 4\\{}
    \code{z} & a numeric vector of responses
    }
    baz
      \Tabular{ll}{
      \code{x} & n.n\%\\{}
      \code{y} & n.n\%
    }
      \end{description}
    \end{itemize}
\end{Format}

Maybe I’m blind but (a) I think that the nesting is correct and (b) I
don’t see a missing item. BTW, translating the Rd to HTML in building
gives valid XHTML 1.0Strict -- as expected.

Cheers,
Helmut

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7050 64-bit)



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] LaTeX Error in creating manual from Rd files

2019-06-11 Thread Helmut Schütz

Hi,

I’m getting -- many -- errors/warnings (both when uploading to 
win-builder.r-project.org as well as locally):

* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! LaTeX Error: Something's wrong--perhaps a missing \item.
 ...
* checking PDF version of manual without hyperrefs or index ... ERROR
* DONE
Status: 1 ERROR, 1 WARNING, 0 NOTE

All errors are generated in man-pages where I describe datasets of my 
package.
Snippet causing the error (confirmed by my.package-manual.log, 
my.package-manual.tex, Rdlatex.log):


Rd:
\format{
  \itemize{
    \item an item\cr
    foo
  \describe{
  bar
  \tabular{ll}{
    \code{a} \tab a factor with x levels: 1, 2, \ldots, x\cr
    \code{b} \tab a factor with 4 levels: 1, 2, 3, 4\cr
    \code{c} \tab a numeric vector of responses
  }
  baz
  \tabular{ll}{
    \code{x} \tab x.x\%\cr
    \code{y} \tab y.y\%
  }
    }
    \item yet another item\cr
    foo
  \describe{
  bar
  \tabular{ll}{
    \code{a} \tab a factor with x levels: 1, 2, \ldots, x\cr
    \code{b} \tab a factor with 4 levels: 1, 2, 3, 4\cr
    \code{c} \tab a numeric vector of responses
  }
  baz
  \tabular{ll}{
    \code{x} \tab x.x\%\cr
    \code{y} \tab y.y\%
  }
    }
  }
}

Translated to:

\begin{Format}
  \begin{itemize}
    \item an item\\{}
    foo
    \begin{description}
  bar
  \Tabular{ll}{
    \code{a} & a factor with x levels: 1, 2, \ldots, x\\{}
    \code{b} & a factor with 4 levels: 1, 2, 3, 4\\{}
    \code{c} & a numeric vector of responses{}
  }
  baz
    \Tabular{ll}{
    \code{x} & n.n\%\\{}
    \code{y} & n.n\%
  }
    \end{description}
    \item yet another item\\{}
    foo
    \begin{description}
  bar
  \Tabular{ll}{
  \code{x} & a factor with x levels: 1, 2, \ldots, x\\{}
  \code{y} & a factor with 4 levels: 1, 2, 3, 4\\{}
  \code{z} & a numeric vector of responses
  }
  baz
    \Tabular{ll}{
    \code{x} & n.n\%\\{}
    \code{y} & n.n\%
  }
    \end{description}
  \end{itemize}
\end{Format}

Maybe I’m blind but (a) I think that the nesting is correct and (b) I 
don’t see a missing item. BTW, translating the Rd to HTML in building 
gives valid XHTML 1.0Strict -- as expected.


Cheers,
Helmut

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7050 64-bit)

--
Ing. Helmut Schütz
BEBAC – Consultancy Services for
Bioequivalence and Bioavailability Studies
Neubaugasse 36/11
1070 Vienna, Austria
T +43 1 2311746
M +43 699 10792458
E helmut.schu...@bebac.at
W https://bebac.at/
C https://bebac.at/Contact.htm
F https://forum.bebac.at/

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] [Rd] Open a file which name contains a tilde

2019-06-11 Thread Travers Ching
Hi Gabriel,

It may be bad practice, but you don't always have control over the file
name.

E.g. if someone shares a file with a tilde in it -- yes it is simple to
rename but it is extra time, and you might not bother to rename a file
without foreknowledge of this bug in the first place.

Even worse, if someone points you to a read only location on a shared
server, you won't even be able to rename the file, and copying might be
prohibitive if it's a large file.

There are also tilde files created automatically by other programs, notably
microsoft office.

Travers




On Tue, Jun 11, 2019 at 9:49 AM Gabriel Becker 
wrote:

> Hi Frank,
>
> I'm hesitant to be "that guy", but in case no one else has brought this up
> to you, having files with a tilde in their names (generally but especially
> on a linux system, where ~ in file names has a very important special
> meaning in some cases, as we know) strikes me as an exceptionally bad
> practice anyway. In light of that, the solution with the smallest amount of
> pain for you is almost surely to just... not do that. Your filenames will
> be better for it anyway.
>
> There is a reason no one has complained about this before, and while I
> haven't run a study or anything, I strongly suspect its that "everyone"
> else is already on the "no tildes in filenames" bandwagon, so this
> behavior, even if technically a bug, has no ability to cause them problems.
>
> Best,
> ~G
>
> On Tue, Jun 11, 2019 at 8:25 AM Frank Schwidom  wrote:
>
> > Hi,
> >
> > yes, I have seen this package and it has the same tilde expanding
> problem.
> >
> > Please excuse me I will cc this answer to r-help and r-devel to keep the
> > discussion running.
> >
> > Kind regards,
> > Frank Schwidom
> >
> > On 2019-06-11 09:12:36, Gábor Csárdi wrote:
> > > Just in case, have you seen the fs package?
> > > https://fs.r-lib.org/
> > >
> > > Gabor
> > >
> > > On Tue, Jun 11, 2019 at 7:51 AM Frank Schwidom 
> wrote:
> > > >
> > > > Hi,
> > > >
> > > > to get rid of any possible filename modification I started a little
> > project to cover my usecase:
> > > >
> > > > https://github.com/schwidom/simplefs
> > > >
> > > > This is my first R package, suggestions and a review are welcome.
> > > >
> > > > Thanks in advance
> > > > Frank Schwidom
> > > >
> > > > On 2019-06-07 09:04:06, Richard O'Keefe wrote:
> > > > >How can expanding tildes anywhere but the beginning of a file
> > name NOT be
> > > > >considered a bug?
> > > > >On Thu, 6 Jun 2019 at 23:04, Ivan Krylov <[1]
> > krylov.r...@gmail.com> wrote:
> > > > >
> > > > >  On Wed, 5 Jun 2019 18:07:15 +0200
> > > > >  Frank Schwidom <[2]schwi...@gmx.net> wrote:
> > > > >
> > > > >  > +> path.expand("a ~ b")
> > > > >  > [1] "a /home/user b"
> > > > >
> > > > >  > How can I switch off any file crippling activity?
> > > > >
> > > > >  It doesn't seem to be possible if readline is enabled and
> works
> > > > >  correctly.
> > > > >
> > > > >  Calls to path.expand [1] end up [2] in R_ExpandFileName [3],
> > which
> > > > >  calls R_ExpandFileName_readline [4], which uses libreadline
> > function
> > > > >  tilde_expand [5]. tilde_expand seems to be designed to expand
> > '~'
> > > > >  anywhere in the string it is handed, i.e. operate on whole
> > command
> > > > >  lines, not file paths.
> > > > >
> > > > >  I am taking the liberty of Cc-ing R-devel in case this can be
> > > > >  considered a bug.
> > > > >
> > > > >  --
> > > > >  Best regards,
> > > > >  Ivan
> > > > >
> > > > >  [1]
> > > > >  [3]
> >
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807
> > > > >
> > > > >  [2]
> > > > >  [4]
> >
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/platform.c#L1915
> > > > >
> > > > >  [3]
> > > > >  [5]
> >
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-unix.c#L147
> > > > >
> > > > >  [4]
> > > > >  [6]
> >
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-std.c#L494
> > > > >
> > > > >  [5]
> > > > >  [7]
> > https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187
> > > > >
> > > > >  __
> > > > >  [8]R-help@r-project.org mailing list -- To UNSUBSCRIBE and
> > more, see
> > > > >  [9]https://stat.ethz.ch/mailman/listinfo/r-help
> > > > >  PLEASE do read the posting guide
> > > > >  [10]http://www.R-project.org/posting-guide.html
> > > > >  and provide commented, minimal, self-contained, reproducible
> > code.
> > > > >
> > > > > References
> > > > >
> > > > >Visible links
> > > > >1. mailto:krylov.r...@gmail.com
> > > > >2. mailto:schwi...@gmx.net
> > > > >3.
> >
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807
> > 

Re: [R] [Rd] Open a file which name contains a tilde

2019-06-11 Thread Gabriel Becker
Hi Frank,

I'm hesitant to be "that guy", but in case no one else has brought this up
to you, having files with a tilde in their names (generally but especially
on a linux system, where ~ in file names has a very important special
meaning in some cases, as we know) strikes me as an exceptionally bad
practice anyway. In light of that, the solution with the smallest amount of
pain for you is almost surely to just... not do that. Your filenames will
be better for it anyway.

There is a reason no one has complained about this before, and while I
haven't run a study or anything, I strongly suspect its that "everyone"
else is already on the "no tildes in filenames" bandwagon, so this
behavior, even if technically a bug, has no ability to cause them problems.

Best,
~G

On Tue, Jun 11, 2019 at 8:25 AM Frank Schwidom  wrote:

> Hi,
>
> yes, I have seen this package and it has the same tilde expanding problem.
>
> Please excuse me I will cc this answer to r-help and r-devel to keep the
> discussion running.
>
> Kind regards,
> Frank Schwidom
>
> On 2019-06-11 09:12:36, Gábor Csárdi wrote:
> > Just in case, have you seen the fs package?
> > https://fs.r-lib.org/
> >
> > Gabor
> >
> > On Tue, Jun 11, 2019 at 7:51 AM Frank Schwidom  wrote:
> > >
> > > Hi,
> > >
> > > to get rid of any possible filename modification I started a little
> project to cover my usecase:
> > >
> > > https://github.com/schwidom/simplefs
> > >
> > > This is my first R package, suggestions and a review are welcome.
> > >
> > > Thanks in advance
> > > Frank Schwidom
> > >
> > > On 2019-06-07 09:04:06, Richard O'Keefe wrote:
> > > >How can expanding tildes anywhere but the beginning of a file
> name NOT be
> > > >considered a bug?
> > > >On Thu, 6 Jun 2019 at 23:04, Ivan Krylov <[1]
> krylov.r...@gmail.com> wrote:
> > > >
> > > >  On Wed, 5 Jun 2019 18:07:15 +0200
> > > >  Frank Schwidom <[2]schwi...@gmx.net> wrote:
> > > >
> > > >  > +> path.expand("a ~ b")
> > > >  > [1] "a /home/user b"
> > > >
> > > >  > How can I switch off any file crippling activity?
> > > >
> > > >  It doesn't seem to be possible if readline is enabled and works
> > > >  correctly.
> > > >
> > > >  Calls to path.expand [1] end up [2] in R_ExpandFileName [3],
> which
> > > >  calls R_ExpandFileName_readline [4], which uses libreadline
> function
> > > >  tilde_expand [5]. tilde_expand seems to be designed to expand
> '~'
> > > >  anywhere in the string it is handed, i.e. operate on whole
> command
> > > >  lines, not file paths.
> > > >
> > > >  I am taking the liberty of Cc-ing R-devel in case this can be
> > > >  considered a bug.
> > > >
> > > >  --
> > > >  Best regards,
> > > >  Ivan
> > > >
> > > >  [1]
> > > >  [3]
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807
> > > >
> > > >  [2]
> > > >  [4]
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/platform.c#L1915
> > > >
> > > >  [3]
> > > >  [5]
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-unix.c#L147
> > > >
> > > >  [4]
> > > >  [6]
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-std.c#L494
> > > >
> > > >  [5]
> > > >  [7]
> https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187
> > > >
> > > >  __
> > > >  [8]R-help@r-project.org mailing list -- To UNSUBSCRIBE and
> more, see
> > > >  [9]https://stat.ethz.ch/mailman/listinfo/r-help
> > > >  PLEASE do read the posting guide
> > > >  [10]http://www.R-project.org/posting-guide.html
> > > >  and provide commented, minimal, self-contained, reproducible
> code.
> > > >
> > > > References
> > > >
> > > >Visible links
> > > >1. mailto:krylov.r...@gmail.com
> > > >2. mailto:schwi...@gmx.net
> > > >3.
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807
> > > >4.
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/platform.c#L1915
> > > >5.
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-unix.c#L147
> > > >6.
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-std.c#L494
> > > >7.
> https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187
> > > >8. mailto:R-help@r-project.org
> > > >9. https://stat.ethz.ch/mailman/listinfo/r-help
> > > >   10. http://www.r-project.org/posting-guide.html
> > >
> > > __
> > > r-de...@r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
> __
> r-de...@r-project.org mailing list
> 

Re: [R] [Rd] Open a file which name contains a tilde

2019-06-11 Thread Duncan Murdoch

On 11/06/2019 4:34 p.m., William Dunlap via R-devel wrote:

Note that R treats tildes in file names differently on Windows and Linux.
On Windows, it is only replaced if it it at the beginning of the line and
is followed by a forward or backward slash or end-of-line.  On Linux it is
replaced no matter where it is in the text and ~someUser will be replaced
by someUser's home directory (if 'someUser' is a user with a home
directory).


That's not quite true:  On Linux the bug is in the code that uses 
libreadline, which you don't have to use.  If you just specify
"--no-readline" when you start R, it will be fine on Linux, as far as I 
can see.


I wouldn't choose that as the default way to run R (it's pretty 
irritating not to have readline support), but it is a workaround for 
this bug.


Duncan Murdoch



Hence, if you have a Windows machine that can look at the file system on
your Linux machine you can use file.rename on Windows to change the names.
My inclination would be to use a bash script on Linux to change the names,
but if you are not comfortable with bash try the Windows approach.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Tue, Jun 11, 2019 at 1:13 PM Frank Schwidom  wrote:


Hi Gabriel,

I actually want to make renames over thousands of files. But if I am not
able to express the source filename of the rename operation I will not be
able to get the work done. Besides the fact that there are issues I think
that R is qualified for solving my problem by the method how it can handle
long vectors of strings, booleans and also lists.

Kind regards,
Frank

On 2019-06-11 09:49:17, Gabriel Becker wrote:

Hi Frank,
I'm hesitant to be "that guy", but in case no one else has brought

this up

to you, having files with a tilde in their names (generally but

especially

on a linux system, where ~ in file names has a very important special
meaning in some cases, as we know) strikes me as an exceptionally bad
practice anyway. In light of that, the solution with the smallest

amount

of pain for you is almost surely to just... not do that. Your

filenames

will be better for it anyway.
There is a reason no one has complained about this before, and while I
haven't run a study or anything, I strongly suspect its that

"everyone"

else is already on the "no tildes in filenames" bandwagon, so this
behavior, even if technically a bug, has no ability to cause them
problems.
Best,
~G
On Tue, Jun 11, 2019 at 8:25 AM Frank Schwidom <[1]schwi...@gmx.net>
wrote:

  Hi,

  yes, I have seen this package and it has the same tilde expanding
  problem.

  Please excuse me I will cc this answer to r-help and r-devel to

keep the

  discussion running.

  Kind regards,
  Frank Schwidom

  On 2019-06-11 09:12:36, Gábor Csárdi wrote:
  > Just in case, have you seen the fs package?
  > [2]https://fs.r-lib.org/
  >
  > Gabor
  >
  > On Tue, Jun 11, 2019 at 7:51 AM Frank Schwidom <[3]

schwi...@gmx.net>

  wrote:
  > >
  > > Hi,
  > >
  > > to get rid of any possible filename modification I started a

little

  project to cover my usecase:
  > >
  > > [4]https://github.com/schwidom/simplefs
  > >
  > > This is my first R package, suggestions and a review are

welcome.

  > >
  > > Thanks in advance
  > > Frank Schwidom
  > >
  > > On 2019-06-07 09:04:06, Richard O'Keefe wrote:
  > > >How can expanding tildes anywhere but the beginning of a

file

  name NOT be
  > > >considered a bug?
  > > >On Thu, 6 Jun 2019 at 23:04, Ivan Krylov
  <[1][5]krylov.r...@gmail.com> wrote:
  > > >
  > > >  On Wed, 5 Jun 2019 18:07:15 +0200
  > > >  Frank Schwidom <[2][6]schwi...@gmx.net> wrote:
  > > >
  > > >  > +> path.expand("a ~ b")
  > > >  > [1] "a /home/user b"
  > > >
  > > >  > How can I switch off any file crippling activity?
  > > >
  > > >  It doesn't seem to be possible if readline is enabled and
  works
  > > >  correctly.
  > > >
  > > >  Calls to path.expand [1] end up [2] in R_ExpandFileName

[3],

  which
  > > >  calls R_ExpandFileName_readline [4], which uses

libreadline

  function
  > > >  tilde_expand [5]. tilde_expand seems to be designed to

expand

  '~'
  > > >  anywhere in the string it is handed, i.e. operate on

whole

  command
  > > >  lines, not file paths.
  > > >
  > > >  I am taking the liberty of Cc-ing R-devel in case this

can be

  > > >  considered a bug.
  > > >
  > > >  --
  > > >  Best regards,
  > > >  Ivan
  > > >
  > > >  [1]
  > > >
  [3][7]

https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807

  > > >
  > > >  [2]
  > > >
  

Re: [R] [Rd] Open a file which name contains a tilde

2019-06-11 Thread William Dunlap via R-help
Note that R treats tildes in file names differently on Windows and Linux.
On Windows, it is only replaced if it it at the beginning of the line and
is followed by a forward or backward slash or end-of-line.  On Linux it is
replaced no matter where it is in the text and ~someUser will be replaced
by someUser's home directory (if 'someUser' is a user with a home
directory).

Hence, if you have a Windows machine that can look at the file system on
your Linux machine you can use file.rename on Windows to change the names.
My inclination would be to use a bash script on Linux to change the names,
but if you are not comfortable with bash try the Windows approach.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Tue, Jun 11, 2019 at 1:13 PM Frank Schwidom  wrote:

> Hi Gabriel,
>
> I actually want to make renames over thousands of files. But if I am not
> able to express the source filename of the rename operation I will not be
> able to get the work done. Besides the fact that there are issues I think
> that R is qualified for solving my problem by the method how it can handle
> long vectors of strings, booleans and also lists.
>
> Kind regards,
> Frank
>
> On 2019-06-11 09:49:17, Gabriel Becker wrote:
> >Hi Frank,
> >I'm hesitant to be "that guy", but in case no one else has brought
> this up
> >to you, having files with a tilde in their names (generally but
> especially
> >on a linux system, where ~ in file names has a very important special
> >meaning in some cases, as we know) strikes me as an exceptionally bad
> >practice anyway. In light of that, the solution with the smallest
> amount
> >of pain for you is almost surely to just... not do that. Your
> filenames
> >will be better for it anyway.
> >There is a reason no one has complained about this before, and while I
> >haven't run a study or anything, I strongly suspect its that
> "everyone"
> >else is already on the "no tildes in filenames" bandwagon, so this
> >behavior, even if technically a bug, has no ability to cause them
> >problems.
> >Best,
> >~G
> >On Tue, Jun 11, 2019 at 8:25 AM Frank Schwidom <[1]schwi...@gmx.net>
> >wrote:
> >
> >  Hi,
> >
> >  yes, I have seen this package and it has the same tilde expanding
> >  problem.
> >
> >  Please excuse me I will cc this answer to r-help and r-devel to
> keep the
> >  discussion running.
> >
> >  Kind regards,
> >  Frank Schwidom
> >
> >  On 2019-06-11 09:12:36, Gábor Csárdi wrote:
> >  > Just in case, have you seen the fs package?
> >  > [2]https://fs.r-lib.org/
> >  >
> >  > Gabor
> >  >
> >  > On Tue, Jun 11, 2019 at 7:51 AM Frank Schwidom <[3]
> schwi...@gmx.net>
> >  wrote:
> >  > >
> >  > > Hi,
> >  > >
> >  > > to get rid of any possible filename modification I started a
> little
> >  project to cover my usecase:
> >  > >
> >  > > [4]https://github.com/schwidom/simplefs
> >  > >
> >  > > This is my first R package, suggestions and a review are
> welcome.
> >  > >
> >  > > Thanks in advance
> >  > > Frank Schwidom
> >  > >
> >  > > On 2019-06-07 09:04:06, Richard O'Keefe wrote:
> >  > > >How can expanding tildes anywhere but the beginning of a
> file
> >  name NOT be
> >  > > >considered a bug?
> >  > > >On Thu, 6 Jun 2019 at 23:04, Ivan Krylov
> >  <[1][5]krylov.r...@gmail.com> wrote:
> >  > > >
> >  > > >  On Wed, 5 Jun 2019 18:07:15 +0200
> >  > > >  Frank Schwidom <[2][6]schwi...@gmx.net> wrote:
> >  > > >
> >  > > >  > +> path.expand("a ~ b")
> >  > > >  > [1] "a /home/user b"
> >  > > >
> >  > > >  > How can I switch off any file crippling activity?
> >  > > >
> >  > > >  It doesn't seem to be possible if readline is enabled and
> >  works
> >  > > >  correctly.
> >  > > >
> >  > > >  Calls to path.expand [1] end up [2] in R_ExpandFileName
> [3],
> >  which
> >  > > >  calls R_ExpandFileName_readline [4], which uses
> libreadline
> >  function
> >  > > >  tilde_expand [5]. tilde_expand seems to be designed to
> expand
> >  '~'
> >  > > >  anywhere in the string it is handed, i.e. operate on
> whole
> >  command
> >  > > >  lines, not file paths.
> >  > > >
> >  > > >  I am taking the liberty of Cc-ing R-devel in case this
> can be
> >  > > >  considered a bug.
> >  > > >
> >  > > >  --
> >  > > >  Best regards,
> >  > > >  Ivan
> >  > > >
> >  > > >  [1]
> >  > > >
> >  [3][7]
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807
> >  > > >
> >  > > >  [2]
> >  > > >
> >  [4][8]
> https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/platform.c#L1915
> >  > > >
> >  > 

Re: [R] [Rd] Open a file which name contains a tilde

2019-06-11 Thread Frank Schwidom
Hi Gabriel,

I actually want to make renames over thousands of files. But if I am not able 
to express the source filename of the rename operation I will not be able to 
get the work done. Besides the fact that there are issues I think that R is 
qualified for solving my problem by the method how it can handle long vectors 
of strings, booleans and also lists.

Kind regards,
Frank

On 2019-06-11 09:49:17, Gabriel Becker wrote:
>Hi Frank,
>I'm hesitant to be "that guy", but in case no one else has brought this up
>to you, having files with a tilde in their names (generally but especially
>on a linux system, where ~ in file names has a very important special
>meaning in some cases, as we know) strikes me as an exceptionally bad
>practice anyway. In light of that, the solution with the smallest amount
>of pain for you is almost surely to just... not do that. Your filenames
>will be better for it anyway.
>There is a reason no one has complained about this before, and while I
>haven't run a study or anything, I strongly suspect its that "everyone"
>else is already on the "no tildes in filenames" bandwagon, so this
>behavior, even if technically a bug, has no ability to cause them
>problems.
>Best,
>~G
>On Tue, Jun 11, 2019 at 8:25 AM Frank Schwidom <[1]schwi...@gmx.net>
>wrote:
>
>  Hi,
>
>  yes, I have seen this package and it has the same tilde expanding
>  problem.
>
>  Please excuse me I will cc this answer to r-help and r-devel to keep the
>  discussion running.
>
>  Kind regards,
>  Frank Schwidom
>
>  On 2019-06-11 09:12:36, Gábor Csárdi wrote:
>  > Just in case, have you seen the fs package?
>  > [2]https://fs.r-lib.org/
>  >
>  > Gabor
>  >
>  > On Tue, Jun 11, 2019 at 7:51 AM Frank Schwidom <[3]schwi...@gmx.net>
>  wrote:
>  > >
>  > > Hi,
>  > >
>  > > to get rid of any possible filename modification I started a little
>  project to cover my usecase:
>  > >
>  > > [4]https://github.com/schwidom/simplefs
>  > >
>  > > This is my first R package, suggestions and a review are welcome.
>  > >
>  > > Thanks in advance
>  > > Frank Schwidom
>  > >
>  > > On 2019-06-07 09:04:06, Richard O'Keefe wrote:
>  > > >    How can expanding tildes anywhere but the beginning of a file
>  name NOT be
>  > > >    considered a bug?
>  > > >    On Thu, 6 Jun 2019 at 23:04, Ivan Krylov
>  <[1][5]krylov.r...@gmail.com> wrote:
>  > > >
>  > > >      On Wed, 5 Jun 2019 18:07:15 +0200
>  > > >      Frank Schwidom <[2][6]schwi...@gmx.net> wrote:
>  > > >
>  > > >      > +> path.expand("a ~ b")
>  > > >      > [1] "a /home/user b"
>  > > >
>  > > >      > How can I switch off any file crippling activity?
>  > > >
>  > > >      It doesn't seem to be possible if readline is enabled and
>  works
>  > > >      correctly.
>  > > >
>  > > >      Calls to path.expand [1] end up [2] in R_ExpandFileName [3],
>  which
>  > > >      calls R_ExpandFileName_readline [4], which uses libreadline
>  function
>  > > >      tilde_expand [5]. tilde_expand seems to be designed to expand
>  '~'
>  > > >      anywhere in the string it is handed, i.e. operate on whole
>  command
>  > > >      lines, not file paths.
>  > > >
>  > > >      I am taking the liberty of Cc-ing R-devel in case this can be
>  > > >      considered a bug.
>  > > >
>  > > >      --
>  > > >      Best regards,
>  > > >      Ivan
>  > > >
>  > > >      [1]
>  > > >     
>  
> [3][7]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807
>  > > >
>  > > >      [2]
>  > > >     
>  
> [4][8]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/platform.c#L1915
>  > > >
>  > > >      [3]
>  > > >     
>  
> [5][9]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-unix.c#L147
>  > > >
>  > > >      [4]
>  > > >     
>  
> [6][10]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-std.c#L494
>  > > >
>  > > >      [5]
>  > > >     
>  
> [7][11]https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187
>  > > >
>  > > >      __
>  > > >      [8][12]R-help@r-project.org mailing list -- To UNSUBSCRIBE
>  and more, see
>  > > >      [9][13]https://stat.ethz.ch/mailman/listinfo/r-help
>  > > >      PLEASE do read the posting guide
>  > > >      [10][14]http://www.R-project.org/posting-guide.html
>  > > >      and provide commented, minimal, self-contained, reproducible
>  code.
>  > > >
>  > > > References
>  > > >
>  > > >    Visible 

Re: [R] Changing the label name in the plot

2019-06-11 Thread Bert Gunter
OK. Thanks, Petr.

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, Jun 11, 2019 at 7:22 AM PIKAL Petr  wrote:

> Hi Bert
>
> names(ts)
> [1] "Name"   "DMs""Name.1" "EMs"
> >
> R is clever enough not to end with same name.
>
> My error comes from ts not to be all numeric. However OP error is
> different therefore it is something weird with original data.
>
> Cheers.
> Petr
>
> From: Bert Gunter 
> Sent: Tuesday, June 11, 2019 3:15 PM
> To: PIKAL Petr 
> Cc: Subhamitra Patra ; Jim Lemon <
> drjimle...@gmail.com>; r-help mailing list 
> Subject: Re: [R] Changing the label name in the plot
>
> There appear to be two columns with the same name. Surely this will cause
> problems.
>
> 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, Jun 11, 2019 at 3:19 AM PIKAL Petr 
> wrote:
> Hi
>
> Ts should be numeric matrix if I read the help page correctly. However I
> get different error message
>
> > k2 <- kmeans(ts, centers = 2, nstart = 25)
> Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
> In addition: Warning message:
> In storage.mode(x) <- "double" : NAs introduced by coercion
>
> So there must be another issue with your data.
>
> Cheers
> Petr
>
> -Original Message-
> From: R-help  On Behalf Of
> Subhamitra Patra
> Sent: Tuesday, June 11, 2019 10:49 AM
> To: Jim Lemon ; r-help mailing list  r-help@r-project.org>
> Subject: Re: [R] Changing the label name in the plot
>
> Hello Sir,
>
> Thank you very much for your help. I tried your suggestion but got some
> error, which I am pasting below.
>
>
> Error: unexpected symbol in:
> "
>   header"
> > library(cluster)
> Warning message:
> package ‘cluster’ was built under R version 3.5.3
> > k2 <- kmeans(ts, centers = 2, nstart = 25)
> Error in as.vector(x, mode) :
>   cannot coerce type 'closure' to vector of type 'any'
> >plot(ts[c(2,4)],col=k2$cluster,type="n")
> Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
> >text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
> Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
>
>
> Please help me.
>
> Thank you.
>
> [image: Mailtrack]
> <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> Sender
> notified by
> Mailtrack
> <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> 06/11/19,
> 3:17:19 PM
>
> On Tue, Jun 11, 2019 at 3:00 PM Jim Lemon 
> wrote:
>
> > Hi Subhamitra,
> > I don't have the factoextra package, but this may give you what you want:
> >
> > ts<-read.table(text="Name DMs Name EMs A 2.071 a 2.038 B 2.0548 b
> > 2.017 C 2.0544 c 2.007 D 2.047 d 1.963 E 2.033 f 1.947 F 2.0327 g
> > 1.942 G 2.0321 h 1.932 H 2.031 i 1.924 I 2.0293 j 1.913 J 2.0291 k
> > 1.906 K 2.027 l 1.892 L 2.022 m 1.877 M 1.9934 n 1.869 N 1.993 o 1.849
> > O 1.989 p 1.848 P 1.988 q 1.836 Q 1.987 r 1.835 R 1.9849 s 1.819 S
> > 1.9842 t 1.798 T 1.981 u 1.771 U 1.978 v 1.762 V 1.968 w 1.717 W 1.96
> > x 1.707 X 1.958 y 1.688 Y 1.955 z 1.683 Z 1.953 aa 1.671 AA 1.952 ab
> > 1.664 AB 1.95 ac 1.646 AC 1.948 ad 1.633 AD 1.945 ae 1.624 AE 1.937 af
> > 1.621 AF 1.913 ag 1.584 AG 1.901 ah 1.487 AH 1.871 ai 1.482 AI 1.801
> > aj 1.23 AJ 1.761 ak 1.129 AK 1.751 al 1.168 AL 1.699 am 0.941 AM 1.687
> > an 0.591 AN 1.668 ao 0.387 AO 1.633 ap 0.16 AP 1.56 aq 0.0002",
> > header=TRUE,stringsAsFactors=FALSE)
> > library(cluster)
> > k2 <- kmeans(ts, centers = 2, nstart = 25)
> > plot(ts[c(2,4)],col=k2$cluster,type="n")
> > text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
> >
> > Jim
> >
> > On Tue, Jun 11, 2019 at 2:44 PM Subhamitra Patra
> >  wrote:
> > >
> > > Dear R-users,
> > >
> > > I am doing cluster analysis, but when I am plotting the results, the
> no.
> > of
> > > observation is coming as the level. Hence, I have a different level
> > > name for each observation differently for each column. I have 2
> > > columns,
> > namely
> > > DMs, and EMs, which will be clustered, but I am unable to label each
> > > dot
> > in
> > > the cluster as per their different name. In other words, the dots in
> > > the cluster are being labeled as per their number of observation
> > > which I want to rename as per their different name in the data. But,
> > > sometimes in
> > code,
> > > both the columns indicating the cluster names are not supporting due
> > > to their non-numerical texts.
> > >
> > > Hence, my query is how to rename or change the label of each dot in
> > > a cluster. Here is my code.
> > >
> > > library(tidyverse)
> > > 

Re: [R] Changing the label name in the plot

2019-06-11 Thread Subhamitra Patra
Hello Sir,

No, two data columns don't have the same names. 1st columns contain the
data from the developed markets, whereas the 2nd columns from the emerging
markets, but I provided the same header name as name, and name.1.

But, whatever clustering method I got from the R bloggers that they are
using the same name column for the multi-data column. So, easily they are
getting plotted along with the clustered values.

But, in my case, 2 data columns have different name columns, so while
plotting, one is suppressing upon others, and thus making the plot unclear.
I tried to do clustering separately for DMs, and EMs, as they have
different name columns. But, somehow it is not working.

Ok, considering your suggestion, I will check by changing the header name
for both data column and will let you know the result.

Thank you.



[image: Mailtrack]

Sender
notified by
Mailtrack

06/11/19,
7:52:59 PM

On Tue, Jun 11, 2019 at 7:44 PM Bert Gunter  wrote:

> There appear to be two columns with the same name. Surely this will cause
> problems.
>
> 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, Jun 11, 2019 at 3:19 AM PIKAL Petr  wrote:
>
>> Hi
>>
>> Ts should be numeric matrix if I read the help page correctly. However I
>> get different error message
>>
>> > k2 <- kmeans(ts, centers = 2, nstart = 25)
>> Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
>> In addition: Warning message:
>> In storage.mode(x) <- "double" : NAs introduced by coercion
>>
>> So there must be another issue with your data.
>>
>> Cheers
>> Petr
>>
>> -Original Message-
>> From: R-help  On Behalf Of Subhamitra Patra
>> Sent: Tuesday, June 11, 2019 10:49 AM
>> To: Jim Lemon ; r-help mailing list <
>> r-help@r-project.org>
>> Subject: Re: [R] Changing the label name in the plot
>>
>> Hello Sir,
>>
>> Thank you very much for your help. I tried your suggestion but got some
>> error, which I am pasting below.
>>
>>
>> Error: unexpected symbol in:
>> "
>>   header"
>> > library(cluster)
>> Warning message:
>> package ‘cluster’ was built under R version 3.5.3
>> > k2 <- kmeans(ts, centers = 2, nstart = 25)
>> Error in as.vector(x, mode) :
>>   cannot coerce type 'closure' to vector of type 'any'
>> >plot(ts[c(2,4)],col=k2$cluster,type="n")
>> Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
>> >text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
>> Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
>>
>>
>> Please help me.
>>
>> Thank you.
>>
>> [image: Mailtrack]
>> <
>> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
>> >
>> Sender
>> notified by
>> Mailtrack
>> <
>> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
>> >
>> 06/11/19,
>> 3:17:19 PM
>>
>> On Tue, Jun 11, 2019 at 3:00 PM Jim Lemon  wrote:
>>
>> > Hi Subhamitra,
>> > I don't have the factoextra package, but this may give you what you
>> want:
>> >
>> > ts<-read.table(text="Name DMs Name EMs A 2.071 a 2.038 B 2.0548 b
>> > 2.017 C 2.0544 c 2.007 D 2.047 d 1.963 E 2.033 f 1.947 F 2.0327 g
>> > 1.942 G 2.0321 h 1.932 H 2.031 i 1.924 I 2.0293 j 1.913 J 2.0291 k
>> > 1.906 K 2.027 l 1.892 L 2.022 m 1.877 M 1.9934 n 1.869 N 1.993 o 1.849
>> > O 1.989 p 1.848 P 1.988 q 1.836 Q 1.987 r 1.835 R 1.9849 s 1.819 S
>> > 1.9842 t 1.798 T 1.981 u 1.771 U 1.978 v 1.762 V 1.968 w 1.717 W 1.96
>> > x 1.707 X 1.958 y 1.688 Y 1.955 z 1.683 Z 1.953 aa 1.671 AA 1.952 ab
>> > 1.664 AB 1.95 ac 1.646 AC 1.948 ad 1.633 AD 1.945 ae 1.624 AE 1.937 af
>> > 1.621 AF 1.913 ag 1.584 AG 1.901 ah 1.487 AH 1.871 ai 1.482 AI 1.801
>> > aj 1.23 AJ 1.761 ak 1.129 AK 1.751 al 1.168 AL 1.699 am 0.941 AM 1.687
>> > an 0.591 AN 1.668 ao 0.387 AO 1.633 ap 0.16 AP 1.56 aq 0.0002",
>> > header=TRUE,stringsAsFactors=FALSE)
>> > library(cluster)
>> > k2 <- kmeans(ts, centers = 2, nstart = 25)
>> > plot(ts[c(2,4)],col=k2$cluster,type="n")
>> > text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
>> >
>> > Jim
>> >
>> > On Tue, Jun 11, 2019 at 2:44 PM Subhamitra Patra
>> >  wrote:
>> > >
>> > > Dear R-users,
>> > >
>> > > I am doing cluster analysis, but when I am plotting the results, the
>> no.
>> > of
>> > > observation is coming as the level. Hence, I have a different level
>> > > name for each observation differently for each column. I have 2
>> > > columns,
>> > namely
>> > > DMs, and EMs, which will be clustered, but I am unable to label each
>> > > dot
>> > in
>> > > the cluster as per their different name. In other words, the dots in
>> > > the cluster are being labeled as per their number of observation
>> > > which I want to rename as per their 

Re: [R] Changing the label name in the plot

2019-06-11 Thread PIKAL Petr
Hi Bert

names(ts)
[1] "Name"   "DMs""Name.1" "EMs"   
>
R is clever enough not to end with same name.

My error comes from ts not to be all numeric. However OP error is different 
therefore it is something weird with original data.

Cheers.
Petr

From: Bert Gunter  
Sent: Tuesday, June 11, 2019 3:15 PM
To: PIKAL Petr 
Cc: Subhamitra Patra ; Jim Lemon 
; r-help mailing list 
Subject: Re: [R] Changing the label name in the plot

There appear to be two columns with the same name. Surely this will cause 
problems.

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, Jun 11, 2019 at 3:19 AM PIKAL Petr  
wrote:
Hi

Ts should be numeric matrix if I read the help page correctly. However I get 
different error message

> k2 <- kmeans(ts, centers = 2, nstart = 25)
Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
In storage.mode(x) <- "double" : NAs introduced by coercion

So there must be another issue with your data.

Cheers
Petr

-Original Message-
From: R-help  On Behalf Of Subhamitra Patra
Sent: Tuesday, June 11, 2019 10:49 AM
To: Jim Lemon ; r-help mailing list 

Subject: Re: [R] Changing the label name in the plot

Hello Sir,

Thank you very much for your help. I tried your suggestion but got some error, 
which I am pasting below.


Error: unexpected symbol in:
"
              header"
> library(cluster)
Warning message:
package ‘cluster’ was built under R version 3.5.3
> k2 <- kmeans(ts, centers = 2, nstart = 25)
Error in as.vector(x, mode) :
  cannot coerce type 'closure' to vector of type 'any'
>                plot(ts[c(2,4)],col=k2$cluster,type="n")
Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
>                text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
Error in ts[c(2, 4)] : object of type 'closure' is not subsettable


Please help me.

Thank you.

[image: Mailtrack]

Sender
notified by
Mailtrack

06/11/19,
3:17:19 PM

On Tue, Jun 11, 2019 at 3:00 PM Jim Lemon  wrote:

> Hi Subhamitra,
> I don't have the factoextra package, but this may give you what you want:
>
> ts<-read.table(text="Name DMs Name EMs A 2.071 a 2.038 B 2.0548 b
> 2.017 C 2.0544 c 2.007 D 2.047 d 1.963 E 2.033 f 1.947 F 2.0327 g
> 1.942 G 2.0321 h 1.932 H 2.031 i 1.924 I 2.0293 j 1.913 J 2.0291 k
> 1.906 K 2.027 l 1.892 L 2.022 m 1.877 M 1.9934 n 1.869 N 1.993 o 1.849
> O 1.989 p 1.848 P 1.988 q 1.836 Q 1.987 r 1.835 R 1.9849 s 1.819 S
> 1.9842 t 1.798 T 1.981 u 1.771 U 1.978 v 1.762 V 1.968 w 1.717 W 1.96
> x 1.707 X 1.958 y 1.688 Y 1.955 z 1.683 Z 1.953 aa 1.671 AA 1.952 ab
> 1.664 AB 1.95 ac 1.646 AC 1.948 ad 1.633 AD 1.945 ae 1.624 AE 1.937 af
> 1.621 AF 1.913 ag 1.584 AG 1.901 ah 1.487 AH 1.871 ai 1.482 AI 1.801
> aj 1.23 AJ 1.761 ak 1.129 AK 1.751 al 1.168 AL 1.699 am 0.941 AM 1.687
> an 0.591 AN 1.668 ao 0.387 AO 1.633 ap 0.16 AP 1.56 aq 0.0002",
> header=TRUE,stringsAsFactors=FALSE)
> library(cluster)
> k2 <- kmeans(ts, centers = 2, nstart = 25)
> plot(ts[c(2,4)],col=k2$cluster,type="n")
> text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
>
> Jim
>
> On Tue, Jun 11, 2019 at 2:44 PM Subhamitra Patra
>  wrote:
> >
> > Dear R-users,
> >
> > I am doing cluster analysis, but when I am plotting the results, the no.
> of
> > observation is coming as the level. Hence, I have a different level
> > name for each observation differently for each column. I have 2
> > columns,
> namely
> > DMs, and EMs, which will be clustered, but I am unable to label each
> > dot
> in
> > the cluster as per their different name. In other words, the dots in
> > the cluster are being labeled as per their number of observation
> > which I want to rename as per their different name in the data. But,
> > sometimes in
> code,
> > both the columns indicating the cluster names are not supporting due
> > to their non-numerical texts.
> >
> > Hence, my query is how to rename or change the label of each dot in
> > a cluster. Here is my code.
> >
> > library(tidyverse)
> > library(cluster)
> > library(factoextra)
> > k2 <- kmeans(ts, centers = 2, nstart = 25) fviz_cluster(k2, data =
> > ts)
> >
> > Here, I have 2 columns i.e. DMs, and EMs with their different label
> > name (i.e. the different name for different observation differently
> > for 2 columns), and want to plot such label name in the cluster
> > graph rather
> than
> > the no. of observation.
> >
> > For your convenience, I am attaching my data.
> >
> > Please find the attached data, and kindly help me in this regard.
> >
> > Thank you.
> >
> >

Re: [R] Changing the label name in the plot

2019-06-11 Thread Bert Gunter
There appear to be two columns with the same name. Surely this will cause
problems.

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, Jun 11, 2019 at 3:19 AM PIKAL Petr  wrote:

> Hi
>
> Ts should be numeric matrix if I read the help page correctly. However I
> get different error message
>
> > k2 <- kmeans(ts, centers = 2, nstart = 25)
> Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
> In addition: Warning message:
> In storage.mode(x) <- "double" : NAs introduced by coercion
>
> So there must be another issue with your data.
>
> Cheers
> Petr
>
> -Original Message-
> From: R-help  On Behalf Of Subhamitra Patra
> Sent: Tuesday, June 11, 2019 10:49 AM
> To: Jim Lemon ; r-help mailing list <
> r-help@r-project.org>
> Subject: Re: [R] Changing the label name in the plot
>
> Hello Sir,
>
> Thank you very much for your help. I tried your suggestion but got some
> error, which I am pasting below.
>
>
> Error: unexpected symbol in:
> "
>   header"
> > library(cluster)
> Warning message:
> package ‘cluster’ was built under R version 3.5.3
> > k2 <- kmeans(ts, centers = 2, nstart = 25)
> Error in as.vector(x, mode) :
>   cannot coerce type 'closure' to vector of type 'any'
> >plot(ts[c(2,4)],col=k2$cluster,type="n")
> Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
> >text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
> Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
>
>
> Please help me.
>
> Thank you.
>
> [image: Mailtrack]
> <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> Sender
> notified by
> Mailtrack
> <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> 06/11/19,
> 3:17:19 PM
>
> On Tue, Jun 11, 2019 at 3:00 PM Jim Lemon  wrote:
>
> > Hi Subhamitra,
> > I don't have the factoextra package, but this may give you what you want:
> >
> > ts<-read.table(text="Name DMs Name EMs A 2.071 a 2.038 B 2.0548 b
> > 2.017 C 2.0544 c 2.007 D 2.047 d 1.963 E 2.033 f 1.947 F 2.0327 g
> > 1.942 G 2.0321 h 1.932 H 2.031 i 1.924 I 2.0293 j 1.913 J 2.0291 k
> > 1.906 K 2.027 l 1.892 L 2.022 m 1.877 M 1.9934 n 1.869 N 1.993 o 1.849
> > O 1.989 p 1.848 P 1.988 q 1.836 Q 1.987 r 1.835 R 1.9849 s 1.819 S
> > 1.9842 t 1.798 T 1.981 u 1.771 U 1.978 v 1.762 V 1.968 w 1.717 W 1.96
> > x 1.707 X 1.958 y 1.688 Y 1.955 z 1.683 Z 1.953 aa 1.671 AA 1.952 ab
> > 1.664 AB 1.95 ac 1.646 AC 1.948 ad 1.633 AD 1.945 ae 1.624 AE 1.937 af
> > 1.621 AF 1.913 ag 1.584 AG 1.901 ah 1.487 AH 1.871 ai 1.482 AI 1.801
> > aj 1.23 AJ 1.761 ak 1.129 AK 1.751 al 1.168 AL 1.699 am 0.941 AM 1.687
> > an 0.591 AN 1.668 ao 0.387 AO 1.633 ap 0.16 AP 1.56 aq 0.0002",
> > header=TRUE,stringsAsFactors=FALSE)
> > library(cluster)
> > k2 <- kmeans(ts, centers = 2, nstart = 25)
> > plot(ts[c(2,4)],col=k2$cluster,type="n")
> > text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
> >
> > Jim
> >
> > On Tue, Jun 11, 2019 at 2:44 PM Subhamitra Patra
> >  wrote:
> > >
> > > Dear R-users,
> > >
> > > I am doing cluster analysis, but when I am plotting the results, the
> no.
> > of
> > > observation is coming as the level. Hence, I have a different level
> > > name for each observation differently for each column. I have 2
> > > columns,
> > namely
> > > DMs, and EMs, which will be clustered, but I am unable to label each
> > > dot
> > in
> > > the cluster as per their different name. In other words, the dots in
> > > the cluster are being labeled as per their number of observation
> > > which I want to rename as per their different name in the data. But,
> > > sometimes in
> > code,
> > > both the columns indicating the cluster names are not supporting due
> > > to their non-numerical texts.
> > >
> > > Hence, my query is how to rename or change the label of each dot in
> > > a cluster. Here is my code.
> > >
> > > library(tidyverse)
> > > library(cluster)
> > > library(factoextra)
> > > k2 <- kmeans(ts, centers = 2, nstart = 25) fviz_cluster(k2, data =
> > > ts)
> > >
> > > Here, I have 2 columns i.e. DMs, and EMs with their different label
> > > name (i.e. the different name for different observation differently
> > > for 2 columns), and want to plot such label name in the cluster
> > > graph rather
> > than
> > > the no. of observation.
> > >
> > > For your convenience, I am attaching my data.
> > >
> > > Please find the attached data, and kindly help me in this regard.
> > >
> > > Thank you.
> > >
> > >
> > >
> > > --
> > > *Best Regards,*
> > > *Subhamitra Patra*
> > > *Phd. Research Scholar*
> > > *Department of Humanities and Social Sciences* *Indian Institute of
> > > Technology, Kharagpur*
> > > *INDIA*
> > >
> > > [image: Mailtrack]
> > > <
> > https://mailtrack.io?utm_source=gmail_medium=signature_campaig
> > n=signaturevirality5&
> > >
> > > 

Re: [R] Parallel processes collapse into one

2019-06-11 Thread Nicola Lunardon
Hi, thanks for the hints. I am quite sure that at some points R stalls as I
am used to monitor the progress of simulations (with a custom function
similar to pbmclapply) and save partial results: whenever all R instances
collapse into one, then no more updates show up.
I was able to set OPENBLAS_NUM_THREADS=1 (1=the value calculated by using
the formula you provided) as suggested here
https://stat.ethz.ch/pipermail/r-sig-debian/2016-August/002588.html, but it
seemed to have no effect on the machine I am using. However, I managed to
force R to use standard BLAS/LAPACK libraries, hope this is going to solve
the problem

sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

Il giorno gio 6 giu 2019 alle ore 13:20 Ivan Krylov 
ha scritto:

> On Mon, 3 Jun 2019 06:37:46 +0200
> Nicola Lunardon  wrote:
>
> > R seems to be running, but simulations do not progress further.
>
> Have you tried message() (or REprintf() in C code) to narrow down the
> specific part of the code where simulations stop in their progress?
> It's less convenient than a good debugger, but with parallel code it is
> sometimes the only way to reproduce the problem and get some
> information about it.
>
> > If I run simulations on 16 cores I end up having an R instance with
> > CPU usage about 1600%, never experienced such a behaviour.
>
> > BLAS:   /usr/lib/openblas-base/libblas.so.3
> > LAPACK: /usr/lib/libopenblasp-r0.2.18.so
>
> OpenBLAS can, indeed, use multiple threads on its own, inside a single
> process. Combined with mclapply, this might create a situation when
> there are far more threads competing for CPU time than CPU cores
> available. Does it help if you set an environment variable such as
> OPENBLAS_NUM_THREADS [*] to a number less than or equal to (number of
> CPU cores / mc.cores mclapply argument)?
>
> --
> Best regards,
> Ivan
>
> [*]
>
> https://github.com/xianyi/OpenBLAS#setting-the-number-of-threads-using-environment-variables
>

[[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-help mailing list archives

2019-06-11 Thread Marc Schwartz via R-help


> On Jun 11, 2019, at 4:03 AM, Martin Maechler  
> wrote:
> 
>> Brent via R-help 
>>on Sun, 9 Jun 2019 03:07:38 + writes:
> 
> [..]
> [..]
> [..]
> 
>> This email list's archives:
> 
>> Apologies in advance if this question has been asked and
>> answered many times already.
> 
>> But know that before posting this, in addition to a normal
>> web search, I tried to find prior discussions on this
>> email list.
> 
>> This is problematic.  The official site
>> https://stat.ethz.ch/mailman/listinfo/r-help says that the
>> only ways which partly work are the GMANE interfaces and
>> the Nabble one.
> 
> You misread what it tries to say. The first time it mentions 'archives'
> it gives you the link showing 'R-help Archives' which goes to
> 
>   https://stat.ethz.ch/pipermail/r-help/
> 
> which are the official R-help archives (on that same server stat.ethz.ch
> provided to the R community by the Math Dept. of ETH Zurich).
> They work "fine" but don't have a nice 1-click search interface.
> So you what has worked for ca 20 years
> {{ but people probably
>   mostly have not learned anymore thanks to the universally "fool
>   proof" search interface
> }}
> still works fine: Use  the site: trick,  i.e.,
> 
> where I found that adding "pipermail" is also somewhat important
> to find more mailing list answers (than R help pages which are
> also served from there).
> E.g., 
>  site:stat.ethz.ch pipermail R windows GUI scaling
> 
> finds a lot (but maybe nothing relevant to your search), notably
> with Google;
> a bit less unfortunately  with my usual search engine "Duck Duck
> Go" (which is *not* keeping track as much as Google of everything I do )
> 
> 
>> I got a Error 522 page from GMANE.
> 
> Yes, unfortunately...  Should probably remove that link from the
> R-help info page; it has gone for several years now AFAIK.
> 
> Martin Maechler
> ETH Zurich and R Core Team
> 
> 
> 
>> Nabble returned 2 hits for variations on the search terms
>> "rgui high dpi 4k"
>> http://r.789695.n4.nabble.com/Font-Size-for-View-under-Linux-td4746104.html
>>
>> http://r.789695.n4.nabble.com/Bug-report-problems-with-saving-plots-on-a-Windows-PC-with-4k-monitor-wrong-picture-size-td4752183.html
>> None are relevant here.
> 


Hi,

Just to amplify Martin's comments, if you go to the main R Project web site, 
you will find, in the left hand navigation links the following:

Search:
https://www.r-project.org/search.html

and 

Getting Help:
https://www.r-project.org/help.html

both of which eventually link to search resources such as rseek.org, which are 
dedicated to R related searches.

Using rseek.org and the "All" tab, with the same search phrase as above, though 
not quoted, led to the following two hits:

R-Devel from 2015:
https://stat.ethz.ch/pipermail/r-devel/2015-September/071732.html

A Microsoft support note:
https://support.microsoft.com/en-my/help/4091364/windows-10-fix-blurry-apps

It is not clear to me if either is helpful here in the end as I do not have a 
4K display, but at least shows alternative results using rseek.org.

Note that rseek.org, includes other sources beyond the official R e-mail list 
archives, which is why the MS note comes up. You can narrow the results by 
using the various tab options at the top of the page.

Regards,

Marc Schwartz

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


Re: [R] Changing the label name in the plot

2019-06-11 Thread PIKAL Petr
Hi

Ts should be numeric matrix if I read the help page correctly. However I get 
different error message

> k2 <- kmeans(ts, centers = 2, nstart = 25)
Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
In storage.mode(x) <- "double" : NAs introduced by coercion

So there must be another issue with your data.

Cheers
Petr

-Original Message-
From: R-help  On Behalf Of Subhamitra Patra
Sent: Tuesday, June 11, 2019 10:49 AM
To: Jim Lemon ; r-help mailing list 
Subject: Re: [R] Changing the label name in the plot

Hello Sir,

Thank you very much for your help. I tried your suggestion but got some error, 
which I am pasting below.


Error: unexpected symbol in:
"
  header"
> library(cluster)
Warning message:
package ‘cluster’ was built under R version 3.5.3
> k2 <- kmeans(ts, centers = 2, nstart = 25)
Error in as.vector(x, mode) :
  cannot coerce type 'closure' to vector of type 'any'
>plot(ts[c(2,4)],col=k2$cluster,type="n")
Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
>text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
Error in ts[c(2, 4)] : object of type 'closure' is not subsettable


Please help me.

Thank you.

[image: Mailtrack]

Sender
notified by
Mailtrack

06/11/19,
3:17:19 PM

On Tue, Jun 11, 2019 at 3:00 PM Jim Lemon  wrote:

> Hi Subhamitra,
> I don't have the factoextra package, but this may give you what you want:
>
> ts<-read.table(text="Name DMs Name EMs A 2.071 a 2.038 B 2.0548 b
> 2.017 C 2.0544 c 2.007 D 2.047 d 1.963 E 2.033 f 1.947 F 2.0327 g
> 1.942 G 2.0321 h 1.932 H 2.031 i 1.924 I 2.0293 j 1.913 J 2.0291 k
> 1.906 K 2.027 l 1.892 L 2.022 m 1.877 M 1.9934 n 1.869 N 1.993 o 1.849
> O 1.989 p 1.848 P 1.988 q 1.836 Q 1.987 r 1.835 R 1.9849 s 1.819 S
> 1.9842 t 1.798 T 1.981 u 1.771 U 1.978 v 1.762 V 1.968 w 1.717 W 1.96
> x 1.707 X 1.958 y 1.688 Y 1.955 z 1.683 Z 1.953 aa 1.671 AA 1.952 ab
> 1.664 AB 1.95 ac 1.646 AC 1.948 ad 1.633 AD 1.945 ae 1.624 AE 1.937 af
> 1.621 AF 1.913 ag 1.584 AG 1.901 ah 1.487 AH 1.871 ai 1.482 AI 1.801
> aj 1.23 AJ 1.761 ak 1.129 AK 1.751 al 1.168 AL 1.699 am 0.941 AM 1.687
> an 0.591 AN 1.668 ao 0.387 AO 1.633 ap 0.16 AP 1.56 aq 0.0002",
> header=TRUE,stringsAsFactors=FALSE)
> library(cluster)
> k2 <- kmeans(ts, centers = 2, nstart = 25)
> plot(ts[c(2,4)],col=k2$cluster,type="n")
> text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
>
> Jim
>
> On Tue, Jun 11, 2019 at 2:44 PM Subhamitra Patra
>  wrote:
> >
> > Dear R-users,
> >
> > I am doing cluster analysis, but when I am plotting the results, the no.
> of
> > observation is coming as the level. Hence, I have a different level
> > name for each observation differently for each column. I have 2
> > columns,
> namely
> > DMs, and EMs, which will be clustered, but I am unable to label each
> > dot
> in
> > the cluster as per their different name. In other words, the dots in
> > the cluster are being labeled as per their number of observation
> > which I want to rename as per their different name in the data. But,
> > sometimes in
> code,
> > both the columns indicating the cluster names are not supporting due
> > to their non-numerical texts.
> >
> > Hence, my query is how to rename or change the label of each dot in
> > a cluster. Here is my code.
> >
> > library(tidyverse)
> > library(cluster)
> > library(factoextra)
> > k2 <- kmeans(ts, centers = 2, nstart = 25) fviz_cluster(k2, data =
> > ts)
> >
> > Here, I have 2 columns i.e. DMs, and EMs with their different label
> > name (i.e. the different name for different observation differently
> > for 2 columns), and want to plot such label name in the cluster
> > graph rather
> than
> > the no. of observation.
> >
> > For your convenience, I am attaching my data.
> >
> > Please find the attached data, and kindly help me in this regard.
> >
> > Thank you.
> >
> >
> >
> > --
> > *Best Regards,*
> > *Subhamitra Patra*
> > *Phd. Research Scholar*
> > *Department of Humanities and Social Sciences* *Indian Institute of
> > Technology, Kharagpur*
> > *INDIA*
> >
> > [image: Mailtrack]
> > <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaig
> n=signaturevirality5&
> >
> > Sender
> > notified by
> > Mailtrack
> > <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaig
> n=signaturevirality5&
> >
> > 06/11/19,
> > 9:54:45 AM
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>


--
*Best Regards,*
*Subhamitra Patra*
*Phd. Research Scholar*
*Department of Humanities and Social Sciences* *Indian Institute of 

Re: [R] [Rd] Open a file which name contains a tilde

2019-06-11 Thread Frank Schwidom
Hi,

yes, I have seen this package and it has the same tilde expanding problem.

Please excuse me I will cc this answer to r-help and r-devel to keep the 
discussion running.

Kind regards,
Frank Schwidom

On 2019-06-11 09:12:36, Gábor Csárdi wrote:
> Just in case, have you seen the fs package?
> https://fs.r-lib.org/
>
> Gabor
>
> On Tue, Jun 11, 2019 at 7:51 AM Frank Schwidom  wrote:
> >
> > Hi,
> >
> > to get rid of any possible filename modification I started a little project 
> > to cover my usecase:
> >
> > https://github.com/schwidom/simplefs
> >
> > This is my first R package, suggestions and a review are welcome.
> >
> > Thanks in advance
> > Frank Schwidom
> >
> > On 2019-06-07 09:04:06, Richard O'Keefe wrote:
> > >How can expanding tildes anywhere but the beginning of a file name NOT 
> > > be
> > >considered a bug?
> > >On Thu, 6 Jun 2019 at 23:04, Ivan Krylov <[1]krylov.r...@gmail.com> 
> > > wrote:
> > >
> > >  On Wed, 5 Jun 2019 18:07:15 +0200
> > >  Frank Schwidom <[2]schwi...@gmx.net> wrote:
> > >
> > >  > +> path.expand("a ~ b")
> > >  > [1] "a /home/user b"
> > >
> > >  > How can I switch off any file crippling activity?
> > >
> > >  It doesn't seem to be possible if readline is enabled and works
> > >  correctly.
> > >
> > >  Calls to path.expand [1] end up [2] in R_ExpandFileName [3], which
> > >  calls R_ExpandFileName_readline [4], which uses libreadline function
> > >  tilde_expand [5]. tilde_expand seems to be designed to expand '~'
> > >  anywhere in the string it is handed, i.e. operate on whole command
> > >  lines, not file paths.
> > >
> > >  I am taking the liberty of Cc-ing R-devel in case this can be
> > >  considered a bug.
> > >
> > >  --
> > >  Best regards,
> > >  Ivan
> > >
> > >  [1]
> > >  
> > > [3]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807
> > >
> > >  [2]
> > >  
> > > [4]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/platform.c#L1915
> > >
> > >  [3]
> > >  
> > > [5]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-unix.c#L147
> > >
> > >  [4]
> > >  
> > > [6]https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-std.c#L494
> > >
> > >  [5]
> > >  
> > > [7]https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187
> > >
> > >  __
> > >  [8]R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > >  [9]https://stat.ethz.ch/mailman/listinfo/r-help
> > >  PLEASE do read the posting guide
> > >  [10]http://www.R-project.org/posting-guide.html
> > >  and provide commented, minimal, self-contained, reproducible code.
> > >
> > > References
> > >
> > >Visible links
> > >1. mailto:krylov.r...@gmail.com
> > >2. mailto:schwi...@gmx.net
> > >3. 
> > > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/names.c#L807
> > >4. 
> > > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/main/platform.c#L1915
> > >5. 
> > > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-unix.c#L147
> > >6. 
> > > https://github.com/wch/r-source/blob/12d1d2d232d84aa355e48b81180a0e2c6f2f/src/unix/sys-std.c#L494
> > >7. 
> > > https://git.savannah.gnu.org/cgit/readline.git/tree/tilde.c?h=devel#n187
> > >8. mailto:R-help@r-project.org
> > >9. https://stat.ethz.ch/mailman/listinfo/r-help
> > >   10. http://www.r-project.org/posting-guide.html
> >
> > __
> > r-de...@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>

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

2019-06-11 Thread Subhamitra Patra
Hello Sir,

Thank you very much for your help. I tried your suggestion but got some
error, which I am pasting below.


Error: unexpected symbol in:
"
  header"
> library(cluster)
Warning message:
package ‘cluster’ was built under R version 3.5.3
> k2 <- kmeans(ts, centers = 2, nstart = 25)
Error in as.vector(x, mode) :
  cannot coerce type 'closure' to vector of type 'any'
>plot(ts[c(2,4)],col=k2$cluster,type="n")
Error in ts[c(2, 4)] : object of type 'closure' is not subsettable
>text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
Error in ts[c(2, 4)] : object of type 'closure' is not subsettable


Please help me.

Thank you.

[image: Mailtrack]

Sender
notified by
Mailtrack

06/11/19,
3:17:19 PM

On Tue, Jun 11, 2019 at 3:00 PM Jim Lemon  wrote:

> Hi Subhamitra,
> I don't have the factoextra package, but this may give you what you want:
>
> ts<-read.table(text="Name DMs Name EMs
> A 2.071 a 2.038
> B 2.0548 b 2.017
> C 2.0544 c 2.007
> D 2.047 d 1.963
> E 2.033 f 1.947
> F 2.0327 g 1.942
> G 2.0321 h 1.932
> H 2.031 i 1.924
> I 2.0293 j 1.913
> J 2.0291 k 1.906
> K 2.027 l 1.892
> L 2.022 m 1.877
> M 1.9934 n 1.869
> N 1.993 o 1.849
> O 1.989 p 1.848
> P 1.988 q 1.836
> Q 1.987 r 1.835
> R 1.9849 s 1.819
> S 1.9842 t 1.798
> T 1.981 u 1.771
> U 1.978 v 1.762
> V 1.968 w 1.717
> W 1.96 x 1.707
> X 1.958 y 1.688
> Y 1.955 z 1.683
> Z 1.953 aa 1.671
> AA 1.952 ab 1.664
> AB 1.95 ac 1.646
> AC 1.948 ad 1.633
> AD 1.945 ae 1.624
> AE 1.937 af 1.621
> AF 1.913 ag 1.584
> AG 1.901 ah 1.487
> AH 1.871 ai 1.482
> AI 1.801 aj 1.23
> AJ 1.761 ak 1.129
> AK 1.751 al 1.168
> AL 1.699 am 0.941
> AM 1.687 an 0.591
> AN 1.668 ao 0.387
> AO 1.633 ap 0.16
> AP 1.56 aq 0.0002",
> header=TRUE,stringsAsFactors=FALSE)
> library(cluster)
> k2 <- kmeans(ts, centers = 2, nstart = 25)
> plot(ts[c(2,4)],col=k2$cluster,type="n")
> text(ts[c(2,4)],ts$Name.1,col=k2$cluster)
>
> Jim
>
> On Tue, Jun 11, 2019 at 2:44 PM Subhamitra Patra
>  wrote:
> >
> > Dear R-users,
> >
> > I am doing cluster analysis, but when I am plotting the results, the no.
> of
> > observation is coming as the level. Hence, I have a different level name
> > for each observation differently for each column. I have 2 columns,
> namely
> > DMs, and EMs, which will be clustered, but I am unable to label each dot
> in
> > the cluster as per their different name. In other words, the dots in the
> > cluster are being labeled as per their number of observation which I want
> > to rename as per their different name in the data. But, sometimes in
> code,
> > both the columns indicating the cluster names are not supporting due to
> > their non-numerical texts.
> >
> > Hence, my query is how to rename or change the label of each dot in a
> > cluster. Here is my code.
> >
> > library(tidyverse)
> > library(cluster)
> > library(factoextra)
> > k2 <- kmeans(ts, centers = 2, nstart = 25)
> > fviz_cluster(k2, data = ts)
> >
> > Here, I have 2 columns i.e. DMs, and EMs with their different label name
> > (i.e. the different name for different observation differently for 2
> > columns), and want to plot such label name in the cluster graph rather
> than
> > the no. of observation.
> >
> > For your convenience, I am attaching my data.
> >
> > Please find the attached data, and kindly help me in this regard.
> >
> > Thank you.
> >
> >
> >
> > --
> > *Best Regards,*
> > *Subhamitra Patra*
> > *Phd. Research Scholar*
> > *Department of Humanities and Social Sciences*
> > *Indian Institute of Technology, Kharagpur*
> > *INDIA*
> >
> > [image: Mailtrack]
> > <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> > Sender
> > notified by
> > Mailtrack
> > <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> > 06/11/19,
> > 9:54:45 AM
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>


-- 
*Best Regards,*
*Subhamitra Patra*
*Phd. Research Scholar*
*Department of Humanities and Social Sciences*
*Indian Institute of Technology, Kharagpur*
*INDIA*

[[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] Changing the label name in the plot

2019-06-11 Thread Jim Lemon
Hi Subhamitra,
I don't have the factoextra package, but this may give you what you want:

ts<-read.table(text="Name DMs Name EMs
A 2.071 a 2.038
B 2.0548 b 2.017
C 2.0544 c 2.007
D 2.047 d 1.963
E 2.033 f 1.947
F 2.0327 g 1.942
G 2.0321 h 1.932
H 2.031 i 1.924
I 2.0293 j 1.913
J 2.0291 k 1.906
K 2.027 l 1.892
L 2.022 m 1.877
M 1.9934 n 1.869
N 1.993 o 1.849
O 1.989 p 1.848
P 1.988 q 1.836
Q 1.987 r 1.835
R 1.9849 s 1.819
S 1.9842 t 1.798
T 1.981 u 1.771
U 1.978 v 1.762
V 1.968 w 1.717
W 1.96 x 1.707
X 1.958 y 1.688
Y 1.955 z 1.683
Z 1.953 aa 1.671
AA 1.952 ab 1.664
AB 1.95 ac 1.646
AC 1.948 ad 1.633
AD 1.945 ae 1.624
AE 1.937 af 1.621
AF 1.913 ag 1.584
AG 1.901 ah 1.487
AH 1.871 ai 1.482
AI 1.801 aj 1.23
AJ 1.761 ak 1.129
AK 1.751 al 1.168
AL 1.699 am 0.941
AM 1.687 an 0.591
AN 1.668 ao 0.387
AO 1.633 ap 0.16
AP 1.56 aq 0.0002",
header=TRUE,stringsAsFactors=FALSE)
library(cluster)
k2 <- kmeans(ts, centers = 2, nstart = 25)
plot(ts[c(2,4)],col=k2$cluster,type="n")
text(ts[c(2,4)],ts$Name.1,col=k2$cluster)

Jim

On Tue, Jun 11, 2019 at 2:44 PM Subhamitra Patra
 wrote:
>
> Dear R-users,
>
> I am doing cluster analysis, but when I am plotting the results, the no. of
> observation is coming as the level. Hence, I have a different level name
> for each observation differently for each column. I have 2 columns, namely
> DMs, and EMs, which will be clustered, but I am unable to label each dot in
> the cluster as per their different name. In other words, the dots in the
> cluster are being labeled as per their number of observation which I want
> to rename as per their different name in the data. But, sometimes in code,
> both the columns indicating the cluster names are not supporting due to
> their non-numerical texts.
>
> Hence, my query is how to rename or change the label of each dot in a
> cluster. Here is my code.
>
> library(tidyverse)
> library(cluster)
> library(factoextra)
> k2 <- kmeans(ts, centers = 2, nstart = 25)
> fviz_cluster(k2, data = ts)
>
> Here, I have 2 columns i.e. DMs, and EMs with their different label name
> (i.e. the different name for different observation differently for 2
> columns), and want to plot such label name in the cluster graph rather than
> the no. of observation.
>
> For your convenience, I am attaching my data.
>
> Please find the attached data, and kindly help me in this regard.
>
> Thank you.
>
>
>
> --
> *Best Regards,*
> *Subhamitra Patra*
> *Phd. Research Scholar*
> *Department of Humanities and Social Sciences*
> *Indian Institute of Technology, Kharagpur*
> *INDIA*
>
> [image: Mailtrack]
> 
> Sender
> notified by
> Mailtrack
> 
> 06/11/19,
> 9:54:45 AM
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] R-help mailing list archives

2019-06-11 Thread Martin Maechler
> Brent via R-help 
> on Sun, 9 Jun 2019 03:07:38 + writes:

 [..]
 [..]
 [..]

> This email list's archives:

> Apologies in advance if this question has been asked and
> answered many times already.

> But know that before posting this, in addition to a normal
> web search, I tried to find prior discussions on this
> email list.

> This is problematic.  The official site    
> https://stat.ethz.ch/mailman/listinfo/r-help says that the
> only ways which partly work are the GMANE interfaces and
> the Nabble one.

You misread what it tries to say. The first time it mentions 'archives'
it gives you the link showing 'R-help Archives' which goes to

   https://stat.ethz.ch/pipermail/r-help/

which are the official R-help archives (on that same server stat.ethz.ch
provided to the R community by the Math Dept. of ETH Zurich).
They work "fine" but don't have a nice 1-click search interface.
So you what has worked for ca 20 years
{{ but people probably
   mostly have not learned anymore thanks to the universally "fool
   proof" search interface
}}
still works fine: Use  the site: trick,  i.e.,

where I found that adding "pipermail" is also somewhat important
to find more mailing list answers (than R help pages which are
also served from there).
E.g., 
  site:stat.ethz.ch pipermail R windows GUI scaling

finds a lot (but maybe nothing relevant to your search), notably
with Google;
a bit less unfortunately  with my usual search engine "Duck Duck
Go" (which is *not* keeping track as much as Google of everything I do )


> I got a Error 522 page from GMANE.

Yes, unfortunately...  Should probably remove that link from the
R-help info page; it has gone for several years now AFAIK.

Martin Maechler
ETH Zurich and R Core Team



> Nabble returned 2 hits for variations on the search terms
> "rgui high dpi 4k"    
> 
http://r.789695.n4.nabble.com/Font-Size-for-View-under-Linux-td4746104.html
>    
> 
http://r.789695.n4.nabble.com/Bug-report-problems-with-saving-plots-on-a-Windows-PC-with-4k-monitor-wrong-picture-size-td4752183.html
> None are relevant here.

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

2019-06-11 Thread Subhamitra Patra
Ok Sir. I am sorry that I was not knowing this thing.

So, now I am pasting my data below.

Name DMs Name EMs
A 2.071 a 2.038
B 2.0548 b 2.017
C 2.0544 c 2.007
D 2.047 d 1.963
E 2.033 f 1.947
F 2.0327 g 1.942
G 2.0321 h 1.932
H 2.031 i 1.924
I 2.0293 j 1.913
J 2.0291 k 1.906
K 2.027 l 1.892
L 2.022 m 1.877
M 1.9934 n 1.869
N 1.993 o 1.849
O 1.989 p 1.848
P 1.988 q 1.836
Q 1.987 r 1.835
R 1.9849 s 1.819
S 1.9842 t 1.798
T 1.981 u 1.771
U 1.978 v 1.762
V 1.968 w 1.717
W 1.96 x 1.707
X 1.958 y 1.688
Y 1.955 z 1.683
Z 1.953 aa 1.671
AA 1.952 ab 1.664
AB 1.95 ac 1.646
AC 1.948 ad 1.633
AD 1.945 ae 1.624
AE 1.937 af 1.621
AF 1.913 ag 1.584
AG 1.901 ah 1.487
AH 1.871 ai 1.482
AI 1.801 aj 1.23
AJ 1.761 ak 1.129
AK 1.751 al 1.168
AL 1.699 am 0.941
AM 1.687 an 0.591
AN 1.668 ao 0.387
AO 1.633 ap 0.16
AP 1.56 aq 0.0002

Here, I have clustered the values of DMs, and EMs, and plotted by using the
code mentioned in my previous email, but in plot, the dots in the cluster
are represented with the number of observation which I want to rename with
the corresponding names of the 2 data columns (DMs, and EMs).

Please help me in this regard.

Thanks.


[image: Mailtrack]

Sender
notified by
Mailtrack

06/11/19,
1:22:47 PM

On Tue, Jun 11, 2019 at 1:05 PM PIKAL Petr  wrote:

> Attachments are not alowed (mostly) on this list.
>
> Use ?dput to show your data or at least part of your data illustrating the
> problém.
>
> Cheers
> Petr
>
> -Original Message-
> From: R-help  On Behalf Of Subhamitra Patra
> Sent: Tuesday, June 11, 2019 8:05 AM
> To: ঋষি ( ऋषि / rIsHi ) 
> Cc: r-help mailing list 
> Subject: Re: [R] Changing the label name in the plot
>
> Please find the attached data.
>
> [image: Mailtrack]
> <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> Sender
> notified by
> Mailtrack
> <
> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
> >
> 06/11/19,
> 12:32:48 PM
>
> On Tue, Jun 11, 2019 at 12:09 PM ঋষি ( ऋषि / rIsHi ) <
> rishi.das...@gmail.com>
> wrote:
>
> > I can not see the attached data
> >
> > On Tue, 11 Jun 2019, 10:14 Subhamitra Patra,
> > 
> > wrote:
> >
> >> Dear R-users,
> >>
> >> I am doing cluster analysis, but when I am plotting the results, the no.
> >> of
> >> observation is coming as the level. Hence, I have a different level
> >> name for each observation differently for each column. I have 2
> >> columns, namely DMs, and EMs, which will be clustered, but I am
> >> unable to label each dot in the cluster as per their different name.
> >> In other words, the dots in the cluster are being labeled as per
> >> their number of observation which I want to rename as per their
> >> different name in the data. But, sometimes in code, both the columns
> >> indicating the cluster names are not supporting due to their
> >> non-numerical texts.
> >>
> >> Hence, my query is how to rename or change the label of each dot in a
> >> cluster. Here is my code.
> >>
> >> library(tidyverse)
> >> library(cluster)
> >> library(factoextra)
> >> k2 <- kmeans(ts, centers = 2, nstart = 25) fviz_cluster(k2, data =
> >> ts)
> >>
> >> Here, I have 2 columns i.e. DMs, and EMs with their different label
> >> name (i.e. the different name for different observation differently
> >> for 2 columns), and want to plot such label name in the cluster graph
> >> rather than the no. of observation.
> >>
> >> For your convenience, I am attaching my data.
> >>
> >> Please find the attached data, and kindly help me in this regard.
> >>
> >> Thank you.
> >>
> >>
> >>
> >> --
> >> *Best Regards,*
> >> *Subhamitra Patra*
> >> *Phd. Research Scholar*
> >> *Department of Humanities and Social Sciences* *Indian Institute of
> >> Technology, Kharagpur*
> >> *INDIA*
> >>
> >> [image: Mailtrack]
> >> <
> >> https://mailtrack.io?utm_source=gmail_medium=signature_campai
> >> gn=signaturevirality5&
> >> >
> >> Sender
> >> notified by
> >> Mailtrack
> >> <
> >> https://mailtrack.io?utm_source=gmail_medium=signature_campai
> >> gn=signaturevirality5&
> >> >
> >> 06/11/19,
> >> 9:54:45 AM
> >> __
> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
>
> --
> *Best Regards,*
> *Subhamitra Patra*
> *Phd. Research Scholar*
> *Department of Humanities and Social Sciences* *Indian Institute of
> Technology, Kharagpur*
> *INDIA*
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> 

Re: [R] Changing the label name in the plot

2019-06-11 Thread PIKAL Petr
Attachments are not alowed (mostly) on this list.

Use ?dput to show your data or at least part of your data illustrating the 
problém.

Cheers
Petr

-Original Message-
From: R-help  On Behalf Of Subhamitra Patra
Sent: Tuesday, June 11, 2019 8:05 AM
To: ঋষি ( ऋषि / rIsHi ) 
Cc: r-help mailing list 
Subject: Re: [R] Changing the label name in the plot

Please find the attached data.

[image: Mailtrack]

Sender
notified by
Mailtrack

06/11/19,
12:32:48 PM

On Tue, Jun 11, 2019 at 12:09 PM ঋষি ( ऋषि / rIsHi ) 
wrote:

> I can not see the attached data
>
> On Tue, 11 Jun 2019, 10:14 Subhamitra Patra,
> 
> wrote:
>
>> Dear R-users,
>>
>> I am doing cluster analysis, but when I am plotting the results, the no.
>> of
>> observation is coming as the level. Hence, I have a different level
>> name for each observation differently for each column. I have 2
>> columns, namely DMs, and EMs, which will be clustered, but I am
>> unable to label each dot in the cluster as per their different name.
>> In other words, the dots in the cluster are being labeled as per
>> their number of observation which I want to rename as per their
>> different name in the data. But, sometimes in code, both the columns
>> indicating the cluster names are not supporting due to their
>> non-numerical texts.
>>
>> Hence, my query is how to rename or change the label of each dot in a
>> cluster. Here is my code.
>>
>> library(tidyverse)
>> library(cluster)
>> library(factoextra)
>> k2 <- kmeans(ts, centers = 2, nstart = 25) fviz_cluster(k2, data =
>> ts)
>>
>> Here, I have 2 columns i.e. DMs, and EMs with their different label
>> name (i.e. the different name for different observation differently
>> for 2 columns), and want to plot such label name in the cluster graph
>> rather than the no. of observation.
>>
>> For your convenience, I am attaching my data.
>>
>> Please find the attached data, and kindly help me in this regard.
>>
>> Thank you.
>>
>>
>>
>> --
>> *Best Regards,*
>> *Subhamitra Patra*
>> *Phd. Research Scholar*
>> *Department of Humanities and Social Sciences* *Indian Institute of
>> Technology, Kharagpur*
>> *INDIA*
>>
>> [image: Mailtrack]
>> <
>> https://mailtrack.io?utm_source=gmail_medium=signature_campai
>> gn=signaturevirality5&
>> >
>> Sender
>> notified by
>> Mailtrack
>> <
>> https://mailtrack.io?utm_source=gmail_medium=signature_campai
>> gn=signaturevirality5&
>> >
>> 06/11/19,
>> 9:54:45 AM
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

--
*Best Regards,*
*Subhamitra Patra*
*Phd. Research Scholar*
*Department of Humanities and Social Sciences* *Indian Institute of Technology, 
Kharagpur*
*INDIA*
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/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.


Re: [R] Changing the label name in the plot

2019-06-11 Thread Subhamitra Patra
Please find the attached data.

[image: Mailtrack]

Sender
notified by
Mailtrack

06/11/19,
12:32:48 PM

On Tue, Jun 11, 2019 at 12:09 PM ঋষি ( ऋषि / rIsHi ) 
wrote:

> I can not see the attached data
>
> On Tue, 11 Jun 2019, 10:14 Subhamitra Patra, 
> wrote:
>
>> Dear R-users,
>>
>> I am doing cluster analysis, but when I am plotting the results, the no.
>> of
>> observation is coming as the level. Hence, I have a different level name
>> for each observation differently for each column. I have 2 columns, namely
>> DMs, and EMs, which will be clustered, but I am unable to label each dot
>> in
>> the cluster as per their different name. In other words, the dots in the
>> cluster are being labeled as per their number of observation which I want
>> to rename as per their different name in the data. But, sometimes in code,
>> both the columns indicating the cluster names are not supporting due to
>> their non-numerical texts.
>>
>> Hence, my query is how to rename or change the label of each dot in a
>> cluster. Here is my code.
>>
>> library(tidyverse)
>> library(cluster)
>> library(factoextra)
>> k2 <- kmeans(ts, centers = 2, nstart = 25)
>> fviz_cluster(k2, data = ts)
>>
>> Here, I have 2 columns i.e. DMs, and EMs with their different label name
>> (i.e. the different name for different observation differently for 2
>> columns), and want to plot such label name in the cluster graph rather
>> than
>> the no. of observation.
>>
>> For your convenience, I am attaching my data.
>>
>> Please find the attached data, and kindly help me in this regard.
>>
>> Thank you.
>>
>>
>>
>> --
>> *Best Regards,*
>> *Subhamitra Patra*
>> *Phd. Research Scholar*
>> *Department of Humanities and Social Sciences*
>> *Indian Institute of Technology, Kharagpur*
>> *INDIA*
>>
>> [image: Mailtrack]
>> <
>> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
>> >
>> Sender
>> notified by
>> Mailtrack
>> <
>> https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;
>> >
>> 06/11/19,
>> 9:54:45 AM
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

-- 
*Best Regards,*
*Subhamitra Patra*
*Phd. Research Scholar*
*Department of Humanities and Social Sciences*
*Indian Institute of Technology, Kharagpur*
*INDIA*
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.