Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread Bert Gunter
It appears that much of the OP's confusion could be cleared up by studying relevant resources, e.g. online tutorials or the R Language Maual that ships with R. This list is not meant to replace such "homework" by users, as this lengthy and confusing interchange demonstrates. Having said that, the

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread William Dunlap via R-help
By the way, R 'vectors' are not the equivalents of mathematical 'vectors'. In R, a vector is something that can have arbitrary length and which has no 'attributes', other than perhaps element names. Vectors can be numeric, character, complex, lists, etc. Functions, names, and NULL are not vector

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread Love Bohman
Hi again! I know you don't find loops evil (well, at least not diabolic :-) ). (After many hours googling I have realized that thinking about loops rather than lists is a newbie thing we Stata-users do, I just jokingly pointed it out). Anyway, I'm really happy that you try to teach me some R-man

Re: [R] Boundary_maps

2017-12-04 Thread Bert Gunter
See the CRAN Spatial task view: https://cran.r-project.org/web/views/Spatial.html for relevant packages (I think). Further queries should probably be directed to the r-sig-geo list, where the relevant expertise is more likely to be found. Cheers, Bert Bert Gunter "The trouble with having an o

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread Jeff Newmiller
Loops are not evil, and no-one in this thread said they are. But I believe your failure to provide a reproducible example is creating confusion, since you may be using words that mean one thing to you and something else to the readers here. # A reproducible exa

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread William Dunlap via R-help
Note that in for (year in 2000:2007){ varname <- paste0("aa_",year) assign(paste0(varname), as.vector(eval(as.name(varname } the paste0(varname) is redundant - varname was just computed as the return value of paste0(). People are trying to steer you towards making a lis

Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread Duncan Mackay
If you can change the line colour try this options(mgp=c(2,0.5,0),cex.lab=1.6) plot(df1$B, predict(regressor,df1), type="l", col="grey", lwd=2, lty=1, xlim=range(c(1.2,1.7)), ylim=rev(range(c(-19,-8 lines(df1$B,as.numeric(df1$A), type="p", col="

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread Love Bohman
:-) I don't insist on anything, I'm just struggling to learn a new language and partly a new way of thinking, and I really appreciate the corrections. I hope I someday will be able to handle lists in R as easy as I handle loops in Stata... Thanks again! Love -Ursprungligt meddelande-

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread peter dalgaard
Um, if you insist on doing it that way, at least use assign(varname, as.vector(get(varname))) -pd > On 4 Dec 2017, at 22:46 , Love Bohman wrote: > > Hi! > Thanks for the replies! > I understand people more accustomed to R doesn't like looping much, and that > thinking about loops is something

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread Love Bohman
Hi! Thanks for the replies! I understand people more accustomed to R doesn't like looping much, and that thinking about loops is something I do since I worked with Stata a lot. The syntax from Peter Dalgaard was really clever, and I learned a lot from it, even though it didn't solve my problem (

[R] Boundary_maps

2017-12-04 Thread Lara Dutra Silva
Hello, I have a question. Is there any code in R, so I can delimiy the study area (bounder)? plot(proj63PA$Pittosporum_EMmeanByROC_mergedAlgo_mergedRun_mergedData, main= "", xlab ="x.coords", ylab="y.coords", cex.axis=caxis) __ R-help@r-project.org ma

Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread Eric Berger
Hi, Sarah's last comment about using min/max x got me thinking. It's not that the points are "very close together", it's that the x-values are not ordered. So the plot is actually drawing a dashed line back-and-forth between different points on the line, which has the effect of making the result ap

Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread jean-philippe
hi Sarah, Thanks a lot for having taken time to answer me and for your reply. I wonder how I missed this solution. Indeed plotting the line with the 2 extreme data points works perfectly. Best, Jean-Philippe Fontaine On 04/12/2017 18:30, Sarah Goslee wrote: It's because you are plottin

Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread Sarah Goslee
Hi, It's because you are plotting a line between each of the points in your data frame, and they are very close together: > cbind(df1$B,predict(regressor,df1)) [,1] [,2] 1 1.410832 -13.96466 2 1.589383 -15.21169 3 1.446662 -14.21491 4 1.488665 -14.50826 5 1.487035 -14.49687 6 1.

[R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread jean-philippe
dear R users, I am performing a linear regression with lm, and I would like to plot the regressor in dashed lines. I know that the lty=2 option is the way out, but it has a very strange behaviour: the line starts dashed but then the spaces between each dash becomes very tiny and so the line b

[R] YNT: ggtern and bquote...

2017-12-04 Thread Levent TERLEMEZ via R-help
Hi, thanks to everybody for pointing the issue and their kind answers. I appreciated, it is solved. x11<-data.frame(A=c(.6,.6,.6),B=c(.20,.20,.20),C=c(0.20,.20,.20)) ggtern(data=x11,aes(A,B,C,xend = c(0.7,.00,0.7),yend= c(.30,.50,.0),zend =c(.0,.50,0.3)))+ geom_point()+ theme_showarrows()+ge

[R] svyglm

2017-12-04 Thread Luciane Maria Pilotto via R-help
Hi, I am trying to run analyzes incorporating sample weight, strata and cluster (three-stage sample) with PNS data (national health survey) and is giving error. I describe below the commands used. I could not make the code reproducible properly. Thanks, ##

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread peter dalgaard
The generic rule is that R is not a macro language, so looping of names of things gets awkward. It is usually easier to use compound objects like lists and iterate over them. E.g. datanames <- paste0("aa_", 2000:2007) datalist <- lapply(datanames, get) names(datalist) <- datanames col1 <- lappl

Re: [R] ggtern and bquote...

2017-12-04 Thread peter dalgaard
D'oh! Thanks for pointing this out. I blame caffeine depletion at the time... -pd > On 4 Dec 2017, at 15:48 , Eik Vettorazzi wrote: > > reading ?plotmath you might notice that "_" isn't the propper syntax for > subscripts. This will work: > > ggtern(data=x11,aes(A,B,C,xend = c(0.7,.00,0.7),yen

Re: [R] YNT: ggtern and bquote...

2017-12-04 Thread Eik Vettorazzi
reading ?plotmath you might notice that "_" isn't the propper syntax for subscripts. This will work: ggtern(data=x11,aes(A,B,C,xend = c(0.7,.00,0.7),yend = c(.30,.50,.0),zend =c(.0,.50,0.3)))+ geom_point()+ theme_showarrows()+geom_segment(size=.5)+ geom_text_viewport(x=c(.45,.27,.37),y=c(.32,.

Re: [R] Dynamic reference, right-hand side of function

2017-12-04 Thread Ek Esawi
Hi Love, I am not sure if I understand your question and it will help if you provided a sample data frame, sample of your code and sample of your output and the output you desire. Having said that, I think you could use cbind to join all datasets into a matrix and use the apply family of functions

[R] YNT: ggtern and bquote...

2017-12-04 Thread Levent TERLEMEZ via R-help
Hi, My example code is this; x11<-data.frame(A=c(.6,.6,.6),B=c(.20,.20,.20),C=c(0.20,.20,.20)) ggtern(data=x11,aes(A,B,C,xend = c(0.7,.00,0.7),yend = c(.30,.50,.0),zend =c(.0,.50,0.3)))+ geom_point()+ theme_showarrows()+geom_segment(size=.5)+ geom_text_viewport(x=c(.45,.27,.37),y=c(

Re: [R] ggtern and bquote...

2017-12-04 Thread Martin Maechler
> peter dalgaard > on Mon, 4 Dec 2017 14:55:19 +0100 writes: >> On 4 Dec 2017, at 11:58 , Levent TERLEMEZ via R-help >> wrote: >> >> Dear Users, >> >> What is the proper way to write symbol, superscript, >> subscript in ggtern/ggplot? I tried every given

[R] Dynamic reference, right-hand side of function

2017-12-04 Thread Love Bohman
Hi R-users! Being new to R, and a fairly advanced Stata-user, I guess part of my problem is that my mindset (and probably my language as well) is wrong. Anyway, I have what I guess is a rather simple problem, that I now without success spent days trying to solve. I have a bunch of datasets impo

Re: [R] ggtern and bquote...

2017-12-04 Thread peter dalgaard
> On 4 Dec 2017, at 11:58 , Levent TERLEMEZ via R-help > wrote: > > Dear Users, > > What is the proper way to write symbol, superscript, subscript in > ggtern/ggplot? I tried every given example, every possible features of ggplot > but couldn’t achived. I just want to write P_a, sigma^2, et

[R] ggtern and bquote...

2017-12-04 Thread Levent TERLEMEZ via R-help
Dear Users, What is the proper way to write symbol, superscript, subscript in ggtern/ggplot? I tried every given example, every possible features of ggplot but couldn’t achived. I just want to write P_a, sigma^2, etc, would you please advise me about this problem. Thanks in advance, Levent TER