Re: [R] Percent transformation

2017-03-14 Thread Jeff Newmiller
Your x variable is a data frame. The scales::percent() function does not work 
on data frames. It might work on the individual columns in the data frame. You 
probably ought to re-read your preferred introduction to R material on the 
difference between data frames and the columns in data frames. 

Try

scales::percent( sp[[ 1 ]] )

Do beware that that function converts your numbers into character strings, 
unlike Excel. It is often more practical to simply multiply by 100 and forego 
the percent sign. 
-- 
Sent from my phone. Please excuse my brevity.

On March 14, 2017 2:19:59 PM PDT, Christoph Puschmann 
 wrote:
>Hello all,
>
>I am having a problem of transforming decimals into percentage.
>Specifically, I get the following error message:
>
>"Error in UseMethod("round_any") :
>no applicable method for 'round_any' applied to an object of class
>“data.frame"
>
>My code looks the following:
>
>x <- sp[1:5,2:6]
>x = percent(x)
>
>My Data:
>
>SD  D   N   A   SA
>
>
>
>
>
>
>1
>
>0.005769231
>
>-0.14230769
>
>0.071153846
>
>0.09615385
>
>-0.030769231
>
>2
>
>-0.057692308
>
>-0.08461538
>
>0.038461538
>
>0.01923077
>
>0.084615385
>
>3
>
>-0.076923077
>
>-0.10384615
>
>0.221153846
>
>-0.04423077
>
>0.003846154
>
>4
>
>-0.167307692
>
>-0.13653846
>
>-0.003846154
>
>0.16153846
>
>0.146153846
>
>5
>
>0.0
>
>-0.01923077
>
>0.011538462
>
>0.21923077
>
>-0.2115384
>
>All help would be appreciated. Thank you.
>
>Christoph
>
>
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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

Re: [R] Percent transformation

2017-03-14 Thread Bert Gunter
This looks like homework. If so, we don't do homework here. If not,
please read and follow the posting guide. In particular, plain text
email only.  The error message you received seems self explanatory.

-- Bert


Bert Gunter

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


On Tue, Mar 14, 2017 at 2:19 PM, Christoph Puschmann
 wrote:
> Hello all,
>
> I am having a problem of transforming decimals into percentage. Specifically, 
> I get the following error message:
>
> "Error in UseMethod("round_any") :
>   no applicable method for 'round_any' applied to an object of class 
> “data.frame"
>
> My code looks the following:
>
> x <- sp[1:5,2:6]
> x = percent(x)
>
> My Data:
>
> SD  D   N   A   SA
>
>
>
>
>
>
> 1
>
> 0.005769231
>
> -0.14230769
>
> 0.071153846
>
> 0.09615385
>
> -0.030769231
>
> 2
>
> -0.057692308
>
> -0.08461538
>
> 0.038461538
>
> 0.01923077
>
> 0.084615385
>
> 3
>
> -0.076923077
>
> -0.10384615
>
> 0.221153846
>
> -0.04423077
>
> 0.003846154
>
> 4
>
> -0.167307692
>
> -0.13653846
>
> -0.003846154
>
> 0.16153846
>
> 0.146153846
>
> 5
>
> 0.0
>
> -0.01923077
>
> 0.011538462
>
> 0.21923077
>
> -0.2115384
>
> All help would be appreciated. Thank you.
>
> Christoph
>
>
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

Re: [R] Percent transformation

2017-03-14 Thread Berend Hasselman

> On 14 Mar 2017, at 22:19, Christoph Puschmann 
>  wrote:
> 
> Hello all,
> 
> I am having a problem of transforming decimals into percentage. Specifically, 
> I get the following error message:
> 
> "Error in UseMethod("round_any") :
>  no applicable method for 'round_any' applied to an object of class 
> “data.frame"
> 

Did you read the Posting Guide.
DO NOT post in html.

Your data are mangled.

Your code is incomprehensible.
Reproducible example please.

Where does percent come from?

Berend Hasselman

> My code looks the following:
> 
> x <- sp[1:5,2:6]
> x = percent(x)
> 
> My Data:
> 
> SD  D   N   A   SA
> 
> 
> 
> 
> 
> 
> 1
> 
> 0.005769231
> 
> -0.14230769
> 
> 0.071153846
> 
> 0.09615385
> 
> -0.030769231
> 
> 2
> 
> -0.057692308
> 
> -0.08461538
> 
> 0.038461538
> 
> 0.01923077
> 
> 0.084615385
> 
> 3
> 
> -0.076923077
> 
> -0.10384615
> 
> 0.221153846
> 
> -0.04423077
> 
> 0.003846154
> 
> 4
> 
> -0.167307692
> 
> -0.13653846
> 
> -0.003846154
> 
> 0.16153846
> 
> 0.146153846
> 
> 5
> 
> 0.0
> 
> -0.01923077
> 
> 0.011538462
> 
> 0.21923077
> 
> -0.2115384
> 
> All help would be appreciated. Thank you.
> 
> Christoph
> 
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

[R] Document Term Matrix will not maintain decimal places of numbers or capture all terms

2017-03-14 Thread Will Ebert
Before I updated my version of RStudio (1.0.136), everything worked great.
With the update something has changed with Document Term Matrix in the 'tm'
package. I want to create a dtm, but with numbers. For instance if I have a
.csv with one column as shown below:

x1.0111.21123.35212.11

I want the column names in my term matrix to look like this:

1.01 11.21 123.35 212.1110 0  001 0  000
  1  000 0  1

But instead it looks like this:

123 2120   00   01   00   1

Here's the code that used to work:

corpus = Corpus(VectorSource(x))
dtm = DocumentTermMatrix(corpus)
dtm_df = as.data.frame(as.matrix(dtm))

I have tried uninstalling everything and reinstalling, tried older versions
(Studio 0.99.489 & R 3.3.1), but I get the same results. I ask others to
test it out and it works for them. Also, I had someone download R, Rtools,
and RStudio to test this and they got the same results I did. I have no
idea what has happened and would greatly appreciate help on this matter as
it is extremely urgent.

Thanks in advance

Will

[[alternative HTML version deleted]]

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


[R] [R-pkgs] New package: revdbayes

2017-03-14 Thread Northrop, Paul
Dear R users,


I am pleased to announce the release on CRAN of revdbayes 1.1.0 : 
Ratio-of-Uniforms Sampling for Bayesian Extreme Value Analysis 
(https://cran.r-project.org/package=revdbayes).


revdbayes performs random posterior sampling in univariate extreme value 
analyses.  It also produces posterior predictive checks, using the bayesplot 
package (https://cran.r-project.org/package=bayesplot), and posterior 
predictive inference for extreme quantities.


Please see the vignettes at 
https://cran.r-project.org/web/packages/revdbayes/vignettes/revdbayes-vignette.html
 and 
https://cran.r-project.org/web/packages/revdbayes/vignettes/revdbayes-predictive-vignette.html
 for details.


Any comments, suggestions or queries are gratefully received.


Best wishes


Paul


Dr Paul Northrop
Department of Statistical Science
University College London
Gower Street
London
WC1E 6BT
Tel: 020 7679 1869
Internal: 41869
E-mail: p.north...@ucl.ac.uk
http://www.homepages.ucl.ac.uk/~ucakpjn/

[[alternative HTML version deleted]]

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

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


[R] Percent transformation

2017-03-14 Thread Christoph Puschmann
Hello all,

I am having a problem of transforming decimals into percentage. Specifically, I 
get the following error message:

"Error in UseMethod("round_any") :
  no applicable method for 'round_any' applied to an object of class 
“data.frame"

My code looks the following:

x <- sp[1:5,2:6]
x = percent(x)

My Data:

SD  D   N   A   SA






1

0.005769231

-0.14230769

0.071153846

0.09615385

-0.030769231

2

-0.057692308

-0.08461538

0.038461538

0.01923077

0.084615385

3

-0.076923077

-0.10384615

0.221153846

-0.04423077

0.003846154

4

-0.167307692

-0.13653846

-0.003846154

0.16153846

0.146153846

5

0.0

-0.01923077

0.011538462

0.21923077

-0.2115384

All help would be appreciated. Thank you.

Christoph




[[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] Is ImageMagick package not compatible with R 3.3.2?

2017-03-14 Thread Bert Gunter
A google search on "ImageMagick Package R" brought this up, which
seems relevant:

https://cran.r-project.org/web/packages/magick/vignettes/intro.html

-- Bert


Bert Gunter

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


On Tue, Mar 14, 2017 at 10:21 PM, C W  wrote:
> Dear list,
>
> I am trying to use saveGIF() from library animation.
> https://cran.r-project.org/web/packages/animation/animation.pdf
>
> saveGIF() has dependency on package ImageMagick.
>
> I got the following,
>> install.packages("ImageMagick")
> Warning in install.packages :
>   package ‘ImageMagick’ is not available (for R version 3.3.2)
>
> Does that mean I can't use saveGIF() anymore? It seems that this is the
> only package capable in R.
>
> Thank you in advance!
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

Re: [R] Is ImageMagick package not compatible with R 3.3.2?

2017-03-14 Thread Hervé Pagès

Hi,

ImageMagick is an external software that you need to install on your
system. It's not an *R* package so trying to install it with
install.packages() won't work.

Note the difference between things listed in the SystemRequirements
field (the animation package has many of these system requirements)
vs things listed in the Depends or Imports field. The former are
external softwares (typically standalone programs or system libraries).
The latter are R packages that can be found with available.packages()
and installed with install.packages().

H.


On 03/14/2017 10:21 PM, C W wrote:

Dear list,

I am trying to use saveGIF() from library animation.
https://urldefense.proofpoint.com/v2/url?u=https-3A__cran.r-2Dproject.org_web_packages_animation_animation.pdf&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=sLEnaUtX6fn9Y_qSSEHFl-W9OaFf4_3oSFFTpbvjAd4&s=4BYi2BW4av2AKvz57RFr0v7j-zxc2Z7AzHvutypbh_s&e=

saveGIF() has dependency on package ImageMagick.

I got the following,

install.packages("ImageMagick")

Warning in install.packages :
  package ‘ImageMagick’ is not available (for R version 3.3.2)

Does that mean I can't use saveGIF() anymore? It seems that this is the
only package capable in R.

Thank you in advance!

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=sLEnaUtX6fn9Y_qSSEHFl-W9OaFf4_3oSFFTpbvjAd4&s=_h7qcvAynH-5nBWCTLad-rzILkVVQe8Ymt5a0-DOGXY&e=
PLEASE do read the posting guide 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=sLEnaUtX6fn9Y_qSSEHFl-W9OaFf4_3oSFFTpbvjAd4&s=PliR-mnRNhRqRnpIX6OFVtcpBlOR2rBkBKtemPQ-NMw&e=
and provide commented, minimal, self-contained, reproducible code.



--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fredhutch.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

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

2017-03-14 Thread C W
Dear list,

I am trying to use saveGIF() from library animation.
https://cran.r-project.org/web/packages/animation/animation.pdf

saveGIF() has dependency on package ImageMagick.

I got the following,
> install.packages("ImageMagick")
Warning in install.packages :
  package ‘ImageMagick’ is not available (for R version 3.3.2)

Does that mean I can't use saveGIF() anymore? It seems that this is the
only package capable in R.

Thank you in advance!

[[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] Permission to use R Installation Screenshots and Datasets

2017-03-14 Thread Jeff Newmiller
I am not sure there exists any one person who can grant you permission to use 
screen shots, but someone with more clue than I have may be able to clear this 
up with you. Regarding packages, copyright rests with the package authors, so 
use the maintainer() function to find out who you need to ask for that 
permission regarding each package you plan to refer to. Note that you should 
read the license associated with each element of the software that you will 
"quote" (including screen shots), and those licenses are indicated in the help 
files. You may find your answers there with no further emails at all, but you 
might need legal assistance to interpret the language. 

Do note that you really need to learn how to use the mailing list if you want 
recipients here to get your message. Read the Posting Guide, which warns you to 
send your email as plain text (not HTML formatted), and attachments are 
restricted to a very limited set of formats. Given the emails that you sent, if 
someone COULD grant you permission to show images, they did not receive any 
images to review so they currently don't know what you are talking about. 
-- 
Sent from my phone. Please excuse my brevity.

On March 14, 2017 9:03:26 AM PDT, Srinivasa K G  wrote:
>Dear Sir/Madam,
>
>We are in the process of developing a textbook on R and are writing to
>request your permission to include certain screenshots relating to
>installation of the package in our book to be published tentatively in
>May
>2017. The description of our book is as follows*:*
>
>
>
>*Title*: Statistical Programming in R
>
>*Approx. no. of pages*: 400
>
>*Approx. price*: ₹395.00
>
>*Publisher*: Oxford University Press
>
>*Territory rights*: Worldwide
>
>
>
>We would be grateful if we might have your gratis permission to use the
>screenshots (see attachment) in the above-mentioned title, supporting
>supplements and any derivatives, which are to be published worldwide by
>Oxford University Press. This permission would be required to cover all
>media (print and electronic), any future revisions or editions of the
>book
>and supplements and any translations of it published by Oxford
>University
>Press or its licensees (world rights). Subject to your permissions, we
>would ensure to provide due acknowledgements as appropriate.
>
>
>We would also like to use the data sets (that are part and parcel of a
>typical R package) to demonstrate problems and solutions in the book.
>
>
>We are looking forward to your response at the earliest.
>
>
>-- 
>Dr. Srinivasa K G
>Associate Professor
>Department of Information Technology
>Ch Brahm Prakash Government Engineering College
>Jaffarpur, New Delhi - 110073
>Mobile: 9731696526 / 9620262690
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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

Re: [R] extend lines of prediction interval ggplot2

2017-03-14 Thread Jeff Newmiller
Define your new_df before you calculate temp_var, and give it to predict so 
predict doesn't start from your original x values. Add temp_var to new_df.

Read ?predict.lm.

Don't create matrices with cbind before creating data frames... data frames can 
have a variety of data storage modes (types) for the columns, matrices cannot. 

fit <-lm(y~x) 
new_df <- data.frame(x,y) 
new_df$temp_var <- predict(fit, newdata=new_df, interval="prediction") 

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

On March 14, 2017 4:39:51 AM PDT, Andras Farkas via R-help 
 wrote:
>Dear All, 
>
>would you have some thoughts on how to extend the prediction interval
>lines to beyond the "range of data"? 
>
>
>example: 
>
>y <-c(0.4316092,0.4156757,0.3517915,0.3669508,0.3899471,0.3964143, 
>0.4001074,0.3851003,0.4222451,0.375324,0.3652045,0.3376978,0.383012, 
>0.3763665,0.3550609,0.2958678,0.3726571,0.3442298 
>#,0.3403275,0.2973978 
>)*100 
>x <-seq(1,length(y),1) 
>
>z<-c("07/01/2015","08/01/2015","09/01/2015","10/01/2015","11/01/2015", 
>"12/01/2015","01/01/2016","02/01/2016","03/01/2016","04/01/2016","05/01/2016",
>
>"06/01/2016","07/01/2016","08/01/2016","09/01/2016","10/01/2016","11/01/2016",
>
>"12/01/2016","01/01/2017","02/01/2017") 
>
>fit <-lm(y~x) 
>
>temp_var <- predict(fit, interval="prediction") 
>
>new_df <- data.frame(cbind(x,y, temp_var)) 
>#new_df$x<-factor(new_df$x, ordered = T) 
>
>library(ggplot2) 
>ggplot(new_df, aes(x,y))+ 
>geom_point() + 
>theme(panel.background = element_rect(fill = 'white', colour =
>'black'))+ 
>geom_line(aes(y=lwr), color = "black", linetype = "dashed",size=0.75)+ 
>geom_line(aes(y=upr), color = "black", linetype = "dashed",size=0.75)+ 
>scale_x_discrete(limits=z)+ 
>theme(axis.text.x = element_text(angle = 45, hjust = 1))+ 
>theme(panel.grid.major=element_line(colour = "grey"))+ 
>lims(y=c(0,50))+ 
>geom_smooth(method=lm,
>se=TRUE,fullrange=TRUE,fill="darkgrey",col="black")+labs(title =
>paste("Adj R2 = ",signif(summary(fit)$adj.r.squared, 4), 
>"Intercept =",signif(fit$coef[[1]],4 ), 
>" Slope =",signif(fit$coef[[2]], 4) 
># " P =",signif(summary(fit)$coef[2,4], 3) 
>))+ 
>ggtitle("Consumption Over Time") + 
>theme(plot.title = element_text(hjust = 0.5))+ 
>labs(y="y",x="x")+ 
>geom_point(shape=15,aes(x=c(7),y=new_df[,2][7]), color="black",cex=4)+ 
>geom_point(shape=15,aes(x=c(8),y=new_df[,2][8]), color="black",cex=4)+ 
>geom_point(shape=17,aes(x=c(19),y=0.3403275*100), color="black",cex=4)+
>
>geom_point(shape=17,aes(x=c(20),y=0.2973978*100), color="black",cex=4) 
>
>
>as you  will see the regresssion line and confidence interval is
>extended, but would also want to extend the prediction interval lines
>to the "same length"... Wonder if you have any insights to this
>question... 
>
>
>appreciate the help, 
>
>
>Andras Farkas
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] GADM -- Download World Map for R

2017-03-14 Thread Jim Lemon
Hi Lorenzo,
See:

http://www.gadm.org/version2

Jim


On Wed, Mar 15, 2017 at 1:57 AM, Lorenzo Isella
 wrote:
> Dear All,
> Please have a look at the snippet here
>
> http://bit.ly/2mVS8me
>
> This short code addresses precisely one of my needs: to superimpose a
> network (created with the igraph library) to a geographical map.
> Unlike the case of the example, where a single country is enough, I
> need to have a world map in R to which superimpose the network.
> Seen that I am far from an expert about plotting maps in R (you may
> want to resort to a purely ggplot oriented solution for the map, but
> then you need to translate your network into something ggplot
> understands -- see http://bit.ly/2mVSOIk ).
> For me it would be way simpler to follow the footsteps of the work
> done in the previous link, but I cannot download from GADM a world
> map.
> Does anybody know how to achieve that?
> Regards
>
> Lorenzo
>
>
> ###à
> library(raster)
> library(igraph)
> greece <- getData('GADM', country='GRC', level=1)
> df<-data.frame("from" = c("Athens", "Iraklio", "Thessaloniki",
> "Patra"), "to"= c("Thessaloniki", "Thessaloniki", "Athens",
> "Iraklio"))
> meta <- data.frame("name"=c("Athens", "Iraklio", "Thessaloniki",
> "Patra"),
>   "lon"=c(23.72800,25.13356,22.94090,21.73507),
>   "lat"=c(37.98415,35.33349,40.63229,38.24628))
>   g <- graph.data.frame(df, directed=T,
>   vertices=meta)
>   lo <- as.matrix(meta[,2:3])
>   plot(greece)
>   plot(g, layout=lo, add = TRUE, rescale =
> FALSE)
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

Re: [R] Quantiles with ordered categories

2017-03-14 Thread William Dunlap via R-help
You could round the quantiles of the codes of the ordered factor to
come up with a reasonable result.  E.g.,

quantile.ordered <- function(x, ...)
ordered(levels(x)[as.integer(quantile(as.integer(x), ...))],
levels=levels(x))

> unCut <- log2(2:30)
> Cut <- cut(unCut, breaks=0:6, ordered_result=TRUE)
> quantile(unCut)
  0%  25%  50%  75% 100%
1.00 3.169925 4.00 4.523562 4.906891
> quantile(Cut)
[1] (0,1] (3,4] (3,4] (4,5] (4,5]
Levels: (0,1] < (1,2] < (2,3] < (3,4] < (4,5] < (5,6]


Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Tue, Mar 14, 2017 at 1:34 PM, Bert Gunter  wrote:
> Inline.
> 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, Mar 14, 2017 at 12:36 PM,   wrote:
>> Dear R users,
>>
>> This works:
>>
>> quantile(1:10, probs=0.5)
>>
>> This fails (obviously):
>>
>> quantile(factor(1:10), probs=0.5)
>>
>> But why do quantiles for ordered factors not work either?
>>
>> quantile(ordered(1:10), probs=0.5)
>>
>> Is it because interpolation (see the optional type argument) is not defined?
> Yes.
>
>
> Is there an elegant workaround?
> No. How can there be? By definition, all that is assumed by an ordered
> factor is an ordering of the categories. How can you "interpolate" in
> ordered(letters[1:3]) . ASAIK there is no "a.5"  .
>
> -- Bert
>
>
>
>>
>> Thank you.
>>
>> Best wishes,
>>
>> Matthias
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Quantiles with ordered categories

2017-03-14 Thread matthias-gondan
I found it:

quantile(ordered(1:10), probs=0.5, type=1) 

works, because type=1 seems to round up or down, whatever. The default option 
for is 7, which wants to interpolate, and then produces the error. 

Two options come to my mind:

- The error message could be improved.
- The default type could be 1 if the data is from ordered categories.
- Or both.

It is probably a little thing to fix, but I lack the skills to do this myself.

Best wishes,

Matthias

Von: Bert Gunter
Gesendet: Dienstag, 14. März 2017 21:34
An: matthias-gon...@gmx.de
Cc: r-help@r-project.org
Betreff: Re: [R] Quantiles with ordered categories

Inline.
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, Mar 14, 2017 at 12:36 PM,   wrote:
> Dear R users,
>
> This works:
>
> quantile(1:10, probs=0.5)
>
> This fails (obviously):
>
> quantile(factor(1:10), probs=0.5)
>
> But why do quantiles for ordered factors not work either?
>
> quantile(ordered(1:10), probs=0.5)
>
> Is it because interpolation (see the optional type argument) is not defined?
Yes.


Is there an elegant workaround?
No. How can there be? By definition, all that is assumed by an ordered
factor is an ordering of the categories. How can you "interpolate" in
ordered(letters[1:3]) . ASAIK there is no "a.5"  .

-- Bert



>
> Thank you.
>
> Best wishes,
>
> Matthias
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

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

Re: [R] Quantiles with ordered categories

2017-03-14 Thread Bert Gunter
Inline.
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, Mar 14, 2017 at 12:36 PM,   wrote:
> Dear R users,
>
> This works:
>
> quantile(1:10, probs=0.5)
>
> This fails (obviously):
>
> quantile(factor(1:10), probs=0.5)
>
> But why do quantiles for ordered factors not work either?
>
> quantile(ordered(1:10), probs=0.5)
>
> Is it because interpolation (see the optional type argument) is not defined?
Yes.


Is there an elegant workaround?
No. How can there be? By definition, all that is assumed by an ordered
factor is an ordering of the categories. How can you "interpolate" in
ordered(letters[1:3]) . ASAIK there is no "a.5"  .

-- Bert



>
> Thank you.
>
> Best wishes,
>
> Matthias
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] Quantiles with ordered categories

2017-03-14 Thread matthias-gondan
Dear R users,

This works: 

quantile(1:10, probs=0.5)

This fails (obviously):

quantile(factor(1:10), probs=0.5)

But why do quantiles for ordered factors not work either?

quantile(ordered(1:10), probs=0.5)

Is it because interpolation (see the optional type argument) is not defined? Is 
there an elegant workaround?

Thank you.

Best wishes,

Matthias

[[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] Fwd: Error: memory exhausted (limit reached?)

2017-03-14 Thread Spencer Graves



On 2017-03-14 12:01 PM, Bert Gunter wrote:

I suspect this is beyond the expertise of most participants of this
list. You might wish to post this on r-devel instead,where such
expertise is more likely to be found. However, that also may not be
the right place either; it's just the best I could think of.

Cheers,
Bert


Bert Gunter

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


On Tue, Mar 14, 2017 at 2:42 AM, Guillaume MULLER  wrote:

Hi again,

Sorry, I messed up, the link to the actual file is:
https://mega.nz/#!ZMs0TSRJ!47DCZCnE6_FnICUp8MVS2R9eY_GdVIyGZ5O9TiejHfc

FYI, it loads perfectly on 2 machines with Ubuntu 16.04 and R version 3.2.3 (2015-12-10) 
-- "Wooden Christmas-Tree"

But exceededs stack mem under Ubuntu 16.10's R version 3.3.1 (2016-06-21) -- "Bug in 
Your Hair"



  Did you try R 3.3.3?  Spencer Graves


 Forwarded Message 
Subject: Error: memory exhausted (limit reached?)
Date: Mon, 13 Mar 2017 16:51:15 +0100
From: Guillaume MULLER 
To: r-help@r-project.org

Hello everyone,

I was working on a DeepNet project at home, with an old PC with 4Gb RAM, 
running Ubuntu 16.04.

For efficiency reason, I stored my dataset as a csv file with write.csv and 
reloaded it at will with read.csv. I did it several time, everything was 
working fine.

This morning, at work, I wanted to use a more powerful machine with 8Gb of RAM 
running under Ubuntu 16.10, but I ran into a strange error:

$ R
16:05:12 R > trainSet <- read.csv("trainSetWhole.csv")
Error: memory exhausted (limit reached?)
Error: C stack usage  7970548 is too close to the limit


I read a few fora on the Internet and found a potential workaround, consisting 
in increasing the stack size using ulimit. Unfortunately, it doesn't work for 
me:
$ ulimit -s
8192
$ ulimit -s $((100*$(ulimit -s)))
$ R --vanilla
16:05:12 R > trainSet <- read.csv("trainSetWhole.csv")
Error: memory exhausted (limit reached?)

How is it possible that a machine with twice the RAM as the previous one cannot 
load my file? Also how is it possible that a 513MB file cannot be read on a 
machine with 8GB RAM?

Since the only other difference is the Ubuntu version (thus R version), I 
assume there's a bug, but I don't know where to look for...

-
FYI, my R version is:


16:05:12 R > version
_
platform   x86_64-pc-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  3
minor  3.1
year   2016
month  06
day21
svn rev70800
language   R
version.string R version 3.3.1 (2016-06-21)
nickname   Bug in Your Hair

-
For the sake of completeness, my Trainset is available at the following link, 
looks perfectly correct and loads perfectly @home but not @work...

https://mega.nz/#!1E9VHYKZ!isyoJEe6zoLdtC3efoZQreyxKP8sVJyvaiiLSEg4sBY

$ ls trainSetWhole.csv
-rw--- 1 guize guize 513M Mar  1 18:14 trainSetWhole.csv
$ head -n2 trainSetWhole.csv
"","i1","i2","i3","i4","i5","i6","i7","i8","i9","i10","i11","i12","i13","i14","i15","i16","i17","i18","i19","i20","i21","i22","i23","i24","i25","i26","i27","i28","i29","i30","i31","i32","i33","i34","i35","i36","i37","i38","i39","i40","i41","i42","i43","i44","i45","i46","i47","i48","i49","i50","i51","i52","i53","i54","i55","i56","i57","i58","i59","i60","i61","i62","i63","i64","i65","i66","i67","i68","i69","i70","i71","i72","i73","i74","i75","i76","i77","i78","i79","i80","i81","i82","i83","i84","i85","i86","i87","i88","i89","i90","i91","i92","i93","i94","i95","i96","i97","i98","i99","i100","i101","i102","i103","i104","i105","i106","i107","i108","i109","i110","i111","i112","i113","i114","i115","i116","i117","i118","i119","i120","i121","i122","i123","i124","i125","i126","i127","i128","i129","i130","i131","i132","i133","i134","i135","i136","i137","i138","i139","i140","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","cE","cH"
"1",-1.37446682201354e-17,2.26278846107692e-17,-1.27974510570192e-17,0.350805746453904,0.0689877720064749,3.96782166297516e-17,8.3747934622645e-17,-3.10693828550825e-17,-6.20727662108592e-17,3.50781139850846e-17,-7.43520083579608e-18,-2.01937105782818e-17,7.90527666844222e-17,0.00144287421147209,-1.88026404914112e-17,7.50553543898089e-17,-3.1156305544842e-17,3.33522787760855e-17,-8.2365725541805e-17,5.58356055978426e-17,-1.0212113811016e-17,2.03979863594455e-17,4.09717807934463e-17,0.0216467781249343,-3.44153670483002e-17,1.63751844321319e-17,0.0370002406507207,6.07678690807364e-18,-8.21680252405594e-17,4.44832722506604e-17,6.4069604073711e-17,-2.25481427040111e-17,4.03090616886684e-17,0.0326641123208996,-7.66887661628525e-17,2.74073501177539e-19,2.16820561358683e-17,4.48746042635995e-17,-1.09133528709867e-16,7.27192988615857e-17,3.12504939940947e-17,1.00863400203073e-17,-1.16417253776312e-17,0.000827131700928926,2.15591878205102e-

Re: [R] Fwd: Error: memory exhausted (limit reached?)

2017-03-14 Thread Bert Gunter
I suspect this is beyond the expertise of most participants of this
list. You might wish to post this on r-devel instead,where such
expertise is more likely to be found. However, that also may not be
the right place either; it's just the best I could think of.

Cheers,
Bert


Bert Gunter

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


On Tue, Mar 14, 2017 at 2:42 AM, Guillaume MULLER  wrote:
> Hi again,
>
> Sorry, I messed up, the link to the actual file is:
> https://mega.nz/#!ZMs0TSRJ!47DCZCnE6_FnICUp8MVS2R9eY_GdVIyGZ5O9TiejHfc
>
> FYI, it loads perfectly on 2 machines with Ubuntu 16.04 and R version 3.2.3 
> (2015-12-10) -- "Wooden Christmas-Tree"
>
> But exceededs stack mem under Ubuntu 16.10's R version 3.3.1 (2016-06-21) -- 
> "Bug in Your Hair"
>
>
>  Forwarded Message 
> Subject: Error: memory exhausted (limit reached?)
> Date: Mon, 13 Mar 2017 16:51:15 +0100
> From: Guillaume MULLER 
> To: r-help@r-project.org
>
> Hello everyone,
>
> I was working on a DeepNet project at home, with an old PC with 4Gb RAM, 
> running Ubuntu 16.04.
>
> For efficiency reason, I stored my dataset as a csv file with write.csv and 
> reloaded it at will with read.csv. I did it several time, everything was 
> working fine.
>
> This morning, at work, I wanted to use a more powerful machine with 8Gb of 
> RAM running under Ubuntu 16.10, but I ran into a strange error:
>
> $ R
> 16:05:12 R > trainSet <- read.csv("trainSetWhole.csv")
> Error: memory exhausted (limit reached?)
> Error: C stack usage  7970548 is too close to the limit
>
>
> I read a few fora on the Internet and found a potential workaround, 
> consisting in increasing the stack size using ulimit. Unfortunately, it 
> doesn't work for me:
> $ ulimit -s
> 8192
> $ ulimit -s $((100*$(ulimit -s)))
> $ R --vanilla
> 16:05:12 R > trainSet <- read.csv("trainSetWhole.csv")
> Error: memory exhausted (limit reached?)
>
> How is it possible that a machine with twice the RAM as the previous one 
> cannot load my file? Also how is it possible that a 513MB file cannot be read 
> on a machine with 8GB RAM?
>
> Since the only other difference is the Ubuntu version (thus R version), I 
> assume there's a bug, but I don't know where to look for...
>
> -
> FYI, my R version is:
>
>
> 16:05:12 R > version
>_
> platform   x86_64-pc-linux-gnu
> arch   x86_64
> os linux-gnu
> system x86_64, linux-gnu
> status
> major  3
> minor  3.1
> year   2016
> month  06
> day21
> svn rev70800
> language   R
> version.string R version 3.3.1 (2016-06-21)
> nickname   Bug in Your Hair
>
> -
> For the sake of completeness, my Trainset is available at the following link, 
> looks perfectly correct and loads perfectly @home but not @work...
>
> https://mega.nz/#!1E9VHYKZ!isyoJEe6zoLdtC3efoZQreyxKP8sVJyvaiiLSEg4sBY
>
> $ ls trainSetWhole.csv
> -rw--- 1 guize guize 513M Mar  1 18:14 trainSetWhole.csv
> $ head -n2 trainSetWhole.csv
> "","i1","i2","i3","i4","i5","i6","i7","i8","i9","i10","i11","i12","i13","i14","i15","i16","i17","i18","i19","i20","i21","i22","i23","i24","i25","i26","i27","i28","i29","i30","i31","i32","i33","i34","i35","i36","i37","i38","i39","i40","i41","i42","i43","i44","i45","i46","i47","i48","i49","i50","i51","i52","i53","i54","i55","i56","i57","i58","i59","i60","i61","i62","i63","i64","i65","i66","i67","i68","i69","i70","i71","i72","i73","i74","i75","i76","i77","i78","i79","i80","i81","i82","i83","i84","i85","i86","i87","i88","i89","i90","i91","i92","i93","i94","i95","i96","i97","i98","i99","i100","i101","i102","i103","i104","i105","i106","i107","i108","i109","i110","i111","i112","i113","i114","i115","i116","i117","i118","i119","i120","i121","i122","i123","i124","i125","i126","i127","i128","i129","i130","i131","i132","i133","i134","i135","i136","i137","i138","i139","i140","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","cE","cH"
> "1",-1.37446682201354e-17,2.26278846107692e-17,-1.27974510570192e-17,0.350805746453904,0.0689877720064749,3.96782166297516e-17,8.3747934622645e-17,-3.10693828550825e-17,-6.20727662108592e-17,3.50781139850846e-17,-7.43520083579608e-18,-2.01937105782818e-17,7.90527666844222e-17,0.00144287421147209,-1.88026404914112e-17,7.50553543898089e-17,-3.1156305544842e-17,3.33522787760855e-17,-8.2365725541805e-17,5.58356055978426e-17,-1.0212113811016e-17,2.03979863594455e-17,4.09717807934463e-17,0.0216467781249343,-3.44153670483002e-17,1.63751844321319e-17,0.0370002406507207,6.07678690807364e-18,-8.21680252405594e-17,4.44832722506604e-17,6.4069604073711e-17,-2.25481427040111e-17,4.03090616886684e-17,0.0326641123208996,-7.66887661628525e-17,2.74073501177539e-19,2.16820561358683e-17,4.48746042635995e-17,-1.09133528709867e-16,7.27192988615857e-17,3.12504939940947e-17,1.00863400203073e-17,-1.164

[R] Request for Permission to Use Screenshots of R Installation in our text book

2017-03-14 Thread Srinivasa K G
Dear Sir/Madam,


We are in the process of developing a textbook on R and are writing to
request your permission to include certain screenshots relating to
installation of the package in our book to be published tentatively in May
2017. The description of our book is as follows*:*



*Title*: Statistical Programming in R

*Approx. no. of pages*: 400

*Approx. price*: ₹395.00

*Publisher*: Oxford University Press

*Territory rights*: Worldwide



We would be grateful if we might have your gratis permission to use the
screenshots (see attachment) in the above-mentioned title, supporting
supplements and any derivatives, which are to be published worldwide by
Oxford University Press. This permission would be required to cover all
media (print and electronic), any future revisions or editions of the book
and supplements and any translations of it published by Oxford University
Press or its licensees (world rights). Subject to your permissions, we
would ensure to provide due acknowledgements as appropriate.



We are looking forward to your response at the earliest.

-- 
Dr. Srinivasa K G
Associate Professor
Department of Information Technology
Ch Brahm Prakash Government Engineering College
Jaffarpur, New Delhi - 110073
Mobile: 9731696526 / 9620262690
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] extend lines of prediction interval ggplot2

2017-03-14 Thread Andras Farkas via R-help
Dear All, 

 would you have some thoughts on how to extend the prediction interval lines to 
beyond the "range of data"? 


example: 

y <-c(0.4316092,0.4156757,0.3517915,0.3669508,0.3899471,0.3964143, 
0.4001074,0.3851003,0.4222451,0.375324,0.3652045,0.3376978,0.383012, 
0.3763665,0.3550609,0.2958678,0.3726571,0.3442298 
#,0.3403275,0.2973978 
)*100 
x <-seq(1,length(y),1) 

z<-c("07/01/2015","08/01/2015","09/01/2015","10/01/2015","11/01/2015", 
"12/01/2015","01/01/2016","02/01/2016","03/01/2016","04/01/2016","05/01/2016", 
"06/01/2016","07/01/2016","08/01/2016","09/01/2016","10/01/2016","11/01/2016", 
"12/01/2016","01/01/2017","02/01/2017") 

fit <-lm(y~x) 

temp_var <- predict(fit, interval="prediction") 

new_df <- data.frame(cbind(x,y, temp_var)) 
#new_df$x<-factor(new_df$x, ordered = T) 

library(ggplot2) 
ggplot(new_df, aes(x,y))+ 
geom_point() + 
theme(panel.background = element_rect(fill = 'white', colour = 'black'))+ 
geom_line(aes(y=lwr), color = "black", linetype = "dashed",size=0.75)+ 
geom_line(aes(y=upr), color = "black", linetype = "dashed",size=0.75)+ 
scale_x_discrete(limits=z)+ 
theme(axis.text.x = element_text(angle = 45, hjust = 1))+ 
theme(panel.grid.major=element_line(colour = "grey"))+ 
lims(y=c(0,50))+ 
geom_smooth(method=lm, 
se=TRUE,fullrange=TRUE,fill="darkgrey",col="black")+labs(title = paste("Adj R2 
= ",signif(summary(fit)$adj.r.squared, 4), 
"Intercept =",signif(fit$coef[[1]],4 ), 
" Slope =",signif(fit$coef[[2]], 4) 
# " P =",signif(summary(fit)$coef[2,4], 3) 
))+ 
ggtitle("Consumption Over Time") + 
theme(plot.title = element_text(hjust = 0.5))+ 
labs(y="y",x="x")+ 
geom_point(shape=15,aes(x=c(7),y=new_df[,2][7]), color="black",cex=4)+ 
geom_point(shape=15,aes(x=c(8),y=new_df[,2][8]), color="black",cex=4)+ 
geom_point(shape=17,aes(x=c(19),y=0.3403275*100), color="black",cex=4)+ 
geom_point(shape=17,aes(x=c(20),y=0.2973978*100), color="black",cex=4) 


as you  will see the regresssion line and confidence interval is extended, but 
would also want to extend the prediction interval lines to the "same length"... 
Wonder if you have any insights to this question... 


appreciate the help, 


Andras Farkas

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Fwd: Error: memory exhausted (limit reached?)

2017-03-14 Thread Guillaume MULLER
Hi again,

Sorry, I messed up, the link to the actual file is:
https://mega.nz/#!ZMs0TSRJ!47DCZCnE6_FnICUp8MVS2R9eY_GdVIyGZ5O9TiejHfc

FYI, it loads perfectly on 2 machines with Ubuntu 16.04 and R version 3.2.3 
(2015-12-10) -- "Wooden Christmas-Tree"

But exceededs stack mem under Ubuntu 16.10's R version 3.3.1 (2016-06-21) -- 
"Bug in Your Hair"


 Forwarded Message 
Subject: Error: memory exhausted (limit reached?)
Date: Mon, 13 Mar 2017 16:51:15 +0100
From: Guillaume MULLER 
To: r-help@r-project.org

Hello everyone,

I was working on a DeepNet project at home, with an old PC with 4Gb RAM, 
running Ubuntu 16.04.

For efficiency reason, I stored my dataset as a csv file with write.csv and 
reloaded it at will with read.csv. I did it several time, everything was 
working fine.

This morning, at work, I wanted to use a more powerful machine with 8Gb of RAM 
running under Ubuntu 16.10, but I ran into a strange error:

$ R
16:05:12 R > trainSet <- read.csv("trainSetWhole.csv")
Error: memory exhausted (limit reached?)
Error: C stack usage  7970548 is too close to the limit


I read a few fora on the Internet and found a potential workaround, consisting 
in increasing the stack size using ulimit. Unfortunately, it doesn't work for 
me:
$ ulimit -s
8192
$ ulimit -s $((100*$(ulimit -s)))
$ R --vanilla
16:05:12 R > trainSet <- read.csv("trainSetWhole.csv")
Error: memory exhausted (limit reached?)

How is it possible that a machine with twice the RAM as the previous one cannot 
load my file? Also how is it possible that a 513MB file cannot be read on a 
machine with 8GB RAM?

Since the only other difference is the Ubuntu version (thus R version), I 
assume there's a bug, but I don't know where to look for...

-
FYI, my R version is:


16:05:12 R > version
   _
platform   x86_64-pc-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  3
minor  3.1
year   2016
month  06
day21
svn rev70800
language   R
version.string R version 3.3.1 (2016-06-21)
nickname   Bug in Your Hair

-
For the sake of completeness, my Trainset is available at the following link, 
looks perfectly correct and loads perfectly @home but not @work...

https://mega.nz/#!1E9VHYKZ!isyoJEe6zoLdtC3efoZQreyxKP8sVJyvaiiLSEg4sBY

$ ls trainSetWhole.csv
-rw--- 1 guize guize 513M Mar  1 18:14 trainSetWhole.csv
$ head -n2 trainSetWhole.csv
"","i1","i2","i3","i4","i5","i6","i7","i8","i9","i10","i11","i12","i13","i14","i15","i16","i17","i18","i19","i20","i21","i22","i23","i24","i25","i26","i27","i28","i29","i30","i31","i32","i33","i34","i35","i36","i37","i38","i39","i40","i41","i42","i43","i44","i45","i46","i47","i48","i49","i50","i51","i52","i53","i54","i55","i56","i57","i58","i59","i60","i61","i62","i63","i64","i65","i66","i67","i68","i69","i70","i71","i72","i73","i74","i75","i76","i77","i78","i79","i80","i81","i82","i83","i84","i85","i86","i87","i88","i89","i90","i91","i92","i93","i94","i95","i96","i97","i98","i99","i100","i101","i102","i103","i104","i105","i106","i107","i108","i109","i110","i111","i112","i113","i114","i115","i116","i117","i118","i119","i120","i121","i122","i123","i124","i125","i126","i127","i128","i129","i130","i131","i132","i133","i134","i135","i136","i137","i138","i139","i140","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","cE","cH"
"1",-1.37446682201354e-17,2.26278846107692e-17,-1.27974510570192e-17,0.350805746453904,0.0689877720064749,3.96782166297516e-17,8.3747934622645e-17,-3.10693828550825e-17,-6.20727662108592e-17,3.50781139850846e-17,-7.43520083579608e-18,-2.01937105782818e-17,7.90527666844222e-17,0.00144287421147209,-1.88026404914112e-17,7.50553543898089e-17,-3.1156305544842e-17,3.33522787760855e-17,-8.2365725541805e-17,5.58356055978426e-17,-1.0212113811016e-17,2.03979863594455e-17,4.09717807934463e-17,0.0216467781249343,-3.44153670483002e-17,1.63751844321319e-17,0.0370002406507207,6.07678690807364e-18,-8.21680252405594e-17,4.44832722506604e-17,6.4069604073711e-17,-2.25481427040111e-17,4.03090616886684e-17,0.0326641123208996,-7.66887661628525e-17,2.74073501177539e-19,2.16820561358683e-17,4.48746042635995e-17,-1.09133528709867e-16,7.27192988615857e-17,3.12504939940947e-17,1.00863400203073e-17,-1.16417253776312e-17,0.000827131700928926,2.15591878205102e-17,-3.55400897372337e-17,-5.31549197577629e-!
 
17,6.36151166067713e-17,-3.98986076789542e-17,8.923132020282e-17,2.25307349483604e-17,1.12105833438192e-17,6.11627660475528e-17,0.00457304914240373,-4.40071366400508e-17,-2.44832622161246e-17,0.0421621636081912,2.46626049639688e-17,-9.62286119146992e-18,-1.88510143728912e-17,-1.04308238059585e-17,-2.93643045718137e-17,2.20818728169428e-17,-4.44567220452202e-17,-8.94603852191165e-17,-9.94874448913085e-18,0.0114804462249642,-9.35428456683928e-18,-1.80861616310379e-17,3.92469708878433e-17,-4.74071809520974e-17,-9.12321682896516e-18,-3.69120306784775e-17,0.134116

[R] Determine IP address of gateway

2017-03-14 Thread Dr Eberhard Lisse
Hi,

I want code to run on my laptop depending on what WiFi I am connected to
(ie internally I access MySQL without password, externally with
password). Currently I look for the gateway and then branch accordingly.

Is there any way of doing

gateway = system("netstat -r -f inet -n|grep default|awk '{print $2}'",
intern = T)

within R other than running it as a system() call?

greetings, el

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

2017-03-14 Thread Srinivasa K G
Dear Sir/Madam,

We are in the process of developing a textbook on R and are writing to
request your permission to include certain screenshots relating to
installation of the package in our book to be published tentatively in May
2017. The description of our book is as follows*:*



*Title*: Statistical Programming in R

*Approx. no. of pages*: 400

*Approx. price*: ₹395.00

*Publisher*: Oxford University Press

*Territory rights*: Worldwide



We would be grateful if we might have your gratis permission to use the
screenshots (see attachment) in the above-mentioned title, supporting
supplements and any derivatives, which are to be published worldwide by
Oxford University Press. This permission would be required to cover all
media (print and electronic), any future revisions or editions of the book
and supplements and any translations of it published by Oxford University
Press or its licensees (world rights). Subject to your permissions, we
would ensure to provide due acknowledgements as appropriate.


We would also like to use the data sets (that are part and parcel of a
typical R package) to demonstrate problems and solutions in the book.


We are looking forward to your response at the earliest.


-- 
Dr. Srinivasa K G
Associate Professor
Department of Information Technology
Ch Brahm Prakash Government Engineering College
Jaffarpur, New Delhi - 110073
Mobile: 9731696526 / 9620262690
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] extending lines for prediction intervals

2017-03-14 Thread Andras Farkas


 
Dear All,

would you have some thoughts on how to extend the prediction interval lines to 
beyond the "range of data" modeled?



example:


y <-c(0.4316092,0.4156757,0.3517915,0.3669508,0.3899471,0.3964143,

0.4001074,0.3851003,0.4222451,0.375324,0.3652045,0.3376978,0.383012,

0.3763665,0.3550609,0.2958678,0.3726571,0.3442298 

#,0.3403275,0.2973978 

)*100 

x <-seq(1,length(y),1) 


z<-c("07/01/2015","08/01/2015","09/01/2015","10/01/2015","11/01/2015",

"12/01/2015","01/01/2016","02/01/2016","03/01/2016","04/01/2016","05/01/2016",

"06/01/2016","07/01/2016","08/01/2016","09/01/2016","10/01/2016","11/01/2016",

"12/01/2016","01/01/2017","02/01/2017") 


fit <-lm(y~x) 


temp_var <- predict(fit, interval="prediction") 


new_df <- data.frame(cbind(x,y, temp_var)) 

#new_df$x<-factor(new_df$x, ordered = T) 


library(ggplot2) 

ggplot(new_df, aes(x,y))+ 

geom_point() + 

theme(panel.background = element_rect(fill = 'white', colour = 'black'))+ 

geom_line(aes(y=lwr), color = "black", linetype = "dashed",size=0.75)+ 

geom_line(aes(y=upr), color = "black", linetype = "dashed",size=0.75)+ 

scale_x_discrete(limits=z)+ 

theme(axis.text.x = element_text(angle = 45, hjust = 1))+ 

theme(panel.grid.major=element_line(colour = "grey"))+ 

lims(y=c(0,50))+ 

geom_smooth(method=lm, 
se=TRUE,fullrange=TRUE,fill="darkgrey",col="black")+labs(title = paste("Adj R2 
= ",signif(summary(fit)$adj.r.squared, 4), 

"Intercept =",signif(fit$coef[[1]],4 ), 

" Slope =",signif(fit$coef[[2]], 4) 

# " P =",signif(summary(fit)$coef[2,4], 3) 

))+ 

ggtitle("Consumption Over Time") + 

theme(plot.title = element_text(hjust = 0.5))+ 

labs(y="y",x="x")+ 

geom_point(shape=15,aes(x=c(7),y=new_df[,2][7]), color="black",cex=4)+ 

geom_point(shape=15,aes(x=c(8),y=new_df[,2][8]), color="black",cex=4)+ 

geom_point(shape=17,aes(x=c(19),y=0.3403275*100), color="black",cex=4)+ 

geom_point(shape=17,aes(x=c(20),y=0.2973978*100), color="black",cex=4) 



as you  will see the regresssion line and confidence interval is extended, but 
would also want to extend the prediction interval lines to the "same length"... 
Wonder if you have any insights to this question...



appreciate the help,



Andras Farkas

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

2017-03-14 Thread Lorenzo Isella

Dear All,
Please have a look at the snippet here

http://bit.ly/2mVS8me

This short code addresses precisely one of my needs: to superimpose a
network (created with the igraph library) to a geographical map.
Unlike the case of the example, where a single country is enough, I
need to have a world map in R to which superimpose the network.
Seen that I am far from an expert about plotting maps in R (you may
want to resort to a purely ggplot oriented solution for the map, but
then you need to translate your network into something ggplot
understands -- see http://bit.ly/2mVSOIk ).
For me it would be way simpler to follow the footsteps of the work
done in the previous link, but I cannot download from GADM a world
map.
Does anybody know how to achieve that?
Regards

Lorenzo


###à
library(raster)
library(igraph)
greece <- getData('GADM', country='GRC', level=1)
df<-data.frame("from" = c("Athens", "Iraklio", "Thessaloniki",
"Patra"), "to"= c("Thessaloniki", "Thessaloniki", "Athens",
"Iraklio"))
meta <- data.frame("name"=c("Athens", "Iraklio", "Thessaloniki",
"Patra"),
  "lon"=c(23.72800,25.13356,22.94090,21.73507),
  "lat"=c(37.98415,35.33349,40.63229,38.24628))
  g <- graph.data.frame(df, directed=T,
  vertices=meta)
  lo <- as.matrix(meta[,2:3])
  plot(greece)
  plot(g, layout=lo, add = TRUE, rescale = FALSE)

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


Re: [R] [FORGED] same column name in a data frame

2017-03-14 Thread David L Carlson
How about just using data.frame(): instead of cbind():

> x <- data.frame(a=c(1,2,3))
> y <- data.frame(a=c(2,3,4))
> xy <- data.frame(x, y)
> str(xy)
'data.frame':   3 obs. of  2 variables:
 $ a  : num  1 2 3
 $ a.1: num  2 3 4
> xy$a
[1] 1 2 3
> xy$a.1
[1] 2 3 4

-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of peter dalgaard
Sent: Tuesday, March 14, 2017 8:43 AM
To: Rolf Turner 
Cc: r-help@r-project.org
Subject: Re: [R] [FORGED] same column name in a data frame


> On 14 Mar 2017, at 03:43 , Rolf Turner  wrote:
> 
> On 14/03/17 14:56, Jinsong Zhao wrote:
>> Hi there,
>> 
>> I happened to find the following code can generate a data frame with
>> same column name.
>> 
>>> x <- data.frame(a=c(1,2,3))
>>> y <- data.frame(a=c(2,3,4))
>>> z <- cbind(x,y)
>> 
>> However, in this case, one can not use the $ to extract the second
>> column, right?
>> 
>> Is it possible to prevent the cbind() produce a data frame with same
>> column name?
> 
> No.
> 
> Why not either:
> 
> (a) Just make sure the names in "x" and "y" differ?
> 
> Or:
> 
> (b) Change the names of "z", e.g. names(z) <- c("clyde","irving")?
> 
> Or maybe names(z) <- make.unique(names(z)).
> 
> You could probably write a wrapper function for cbind() to automate (b) if 
> you really want to.
> 

Yes, this is what it is, and I doubt anyone is likely to set out to change it. 

However, it is a bit of an oddity compared to the (often undesirable) pains the 
data.frame code goes through to ensure distinct _row_ names; e.g.,

> cbind(data.frame(a=1), data.frame(a=2))
  a a
1 1 2

but 

> rbind(data.frame(a=c(foo=1)), data.frame(a=c(foo=2)))
 a
foo  1
foo1 2

-pr


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

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

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


Re: [R] [FORGED] same column name in a data frame

2017-03-14 Thread peter dalgaard

> On 14 Mar 2017, at 03:43 , Rolf Turner  wrote:
> 
> On 14/03/17 14:56, Jinsong Zhao wrote:
>> Hi there,
>> 
>> I happened to find the following code can generate a data frame with
>> same column name.
>> 
>>> x <- data.frame(a=c(1,2,3))
>>> y <- data.frame(a=c(2,3,4))
>>> z <- cbind(x,y)
>> 
>> However, in this case, one can not use the $ to extract the second
>> column, right?
>> 
>> Is it possible to prevent the cbind() produce a data frame with same
>> column name?
> 
> No.
> 
> Why not either:
> 
> (a) Just make sure the names in "x" and "y" differ?
> 
> Or:
> 
> (b) Change the names of "z", e.g. names(z) <- c("clyde","irving")?
> 
> Or maybe names(z) <- make.unique(names(z)).
> 
> You could probably write a wrapper function for cbind() to automate (b) if 
> you really want to.
> 

Yes, this is what it is, and I doubt anyone is likely to set out to change it. 

However, it is a bit of an oddity compared to the (often undesirable) pains the 
data.frame code goes through to ensure distinct _row_ names; e.g.,

> cbind(data.frame(a=1), data.frame(a=2))
  a a
1 1 2

but 

> rbind(data.frame(a=c(foo=1)), data.frame(a=c(foo=2)))
 a
foo  1
foo1 2

-pr


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

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


Re: [R] Reshaping from long to wide with duplicate idvar and timevar

2017-03-14 Thread PIKAL Petr
Hi

You should specify what do you want with duplicated rows. If you wanted them to 
be averaged you can use dcast from reshape2 package.

> dcast(Indometh2,Subject~time, fun.aggregate=mean)
Using conc as value column: use value.var to override.
  Subject 0.25  0.5 0.751 1.25234568
1   1 1.50 0.94 0.78 0.48 0.37 0.19 0.12 0.11 0.08 0.07 0.05
2   4 1.85 1.39 1.02 0.89 0.59 0.40 0.16 0.11 0.10 0.07 0.07
3   2 2.03 1.63 0.71 0.70 0.64 0.36 0.32 0.20 0.25 0.12 0.08
4   5 2.05 1.04 0.81 0.39 0.30 0.23 0.13 0.11 0.08 0.10 0.06
5   6 2.31 1.44 1.03 0.84 0.64 0.42 0.24 0.17 0.13 0.10 0.09
6   3 2.72 1.49 1.16 0.80 0.80 0.39 0.22 0.12 0.11 0.08 0.08

You can see that dcast accepts those duplicated values

dcast(Indometh2,Subject~time)
Using conc as value column: use value.var to override.
Aggregation function missing: defaulting to length
  Subject 0.25 0.5 0.75 1 1.25 2 3 4 5 6 8
1   12   11 11 1 1 1 1 1 1
2   41   11 11 1 1 1 1 1 1
3   21   11 11 1 1 1 1 1 1
4   51   11 11 1 1 1 1 1 1
5   61   11 11 1 1 1 1 1 1
6   31   11 11 1 1 1 1 1 1

However you probably need to do what you suggested if you want to make those 
duplicated idvar and timevar to be unique.

Cheers
Petr



> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Sebastien
> Bihorel
> Sent: Tuesday, March 14, 2017 3:45 AM
> To: r-help@r-project.org
> Subject: [R] Reshaping from long to wide with duplicate idvar and timevar
>
> Hi,
>
> I would like to reshape a data.frame from long to wide format. However, the
> reshape function does not seem to accept data containing rows with
> duplicate idvar and timevar. Building upon the ?reshape example:
>
> summary(Indometh)
> wide <- reshape(Indometh, v.names = "conc", idvar = "Subject",
>   timevar = "time", direction = "wide")
>
> Indometh2 <- rbind(Indometh, Indometh2[1,])
> wide <- reshape(Indometh2, v.names = "conc", idvar = "Subject",
>   timevar = "time", direction = "wide")
>
> In the 2nd call, reshape drops the duplicate. In a real world, the process I 
> am
> working on will handle data with unknown number of duplicates like the one
> I have manually create above.
>
> One "brute force" way to circumvent this would be to pre-process the data,
> identify the rows with duplicate idvar/timevar combos, and add some
> suffixes to the idvar variable to make the rows unique. Then I would call
> reshape, and finally, I would post-process the data to remove the suffixes...
> This does not seem very elegant.
>
> Is there a more efficient way to go about this?
>
> Thank you
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this

Re: [R] replace

2017-03-14 Thread PIKAL Petr
Hi

slightly different version without as.character

DF1$Comb <- ifelse(DF1$first=="Alex", paste(DF1$first, DF1$YR, sep="-"), 
paste(DF1$first, "", sep=""))
[1] "Alex-2001" "Bob"   "Cory"  "Cory"  "Bob"   "Bob"
[7] "Alex-2002" "Alex-2003" "Alex-2004"

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Marc
> Schwartz
> Sent: Tuesday, March 14, 2017 12:33 AM
> To: Val 
> Cc: R-help 
> Subject: Re: [R] replace
>
>
> > On Mar 13, 2017, at 5:53 PM, Val  wrote:
> >
> > HI all,
> >
> > if first name  is  Alex then I want concatenate the second column to
> > Alex to produce Alex and  the second column value
> >
> > DF1 <- read.table(header=TRUE, text='first YR
> > Alex2001
> > Bob 2001
> > Cory2001
> > Cory2002
> > Bob 2002
> > Bob 2003
> > Alex2002
> > Alex2003
> > Alex2004')
> >
> >
> > Output
> > data frame
> > DF2
> > Alex-2001   2001
> > Bob 2001
> > Cory2001
> > Cory2002
> > Bob 2002
> > Bob 2003
> > Alex-2002   2002
> > Alex-2003   2003
> > Alex-2004   2004
> >
> > I tried this one but did not work.
> > DF1$first[DF1$first=="Alex"] <-  paste(DF1$first, DF1$YR, sep='-')
> >
> > Thank you in advance
>
>
> Hi,
>
> See ?ifelse and try this:
>
> DF1$Comb <- ifelse(DF1$first == "Alex",
>paste(DF1$first, DF1$YR, sep = "-"),
>as.character(DF1$first))
>
> > DF1
>   first   YR  Comb
> 1  Alex 2001 Alex-2001
> 2   Bob 2001   Bob
> 3  Cory 2001  Cory
> 4  Cory 2002  Cory
> 5   Bob 2002   Bob
> 6   Bob 2003   Bob
> 7  Alex 2002 Alex-2002
> 8  Alex 2003 Alex-2003
> 9  Alex 2004 Alex-2004
>
>
> Note the coercion of the second returned value to character, otherwise you
> get the numeric code associated with the factor levels of DF1$first.
>
> I generally try to avoid overwriting the source data, or in this case, 
> column, to
> preserve it for future use as may be needed.
>
> 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on be

Re: [R] Principal Coordinate Analysis of unweighted UniFrac distances on R

2017-03-14 Thread Martin Maechler
> Bert Gunter 
> on Mon, 13 Mar 2017 10:39:49 -0700 writes:

> Please read and follow the posting guide.  Plain text only
> + code that you tried + reproducible exam (google it).

> In general, we do not do tutorials here, but someone may
> indeed be able to refer you to one on the web. Googling
> "principal coordinates analysis tutorial R" appeared to
> bring up relevant hits, including a tutorial using the
> vegan package functionality.

> Cheers, Bert Bert Gunter

[]

and *PLEASE* do spell it correctly : "principal",  *NOT* 'principle'
(I've corrected it in the 'Subject' as I don't want to create another
 google hit for the wrong spelling ...)

Martin Maechler

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