Re: [R] as.data.frame doesn't set col.names
> On 24 Oct 2017, at 22:45 , David L Carlson wrote: > > You left out all the most important bits of information. What is yo? Are you > trying to assign a data frame to a single column in another data frame? > Printing head(samples) tells us nothing about what data types you have, > especially if the things that look like text are really factors that were > created when you used one of the read.*() functions. Use str(samples) to see > what you are dealing with. Actually, I think there is enough information to diagnose this. The main issue is as you point out, assignment of an entire data frame to a column of another data frame: > l <- letters[1:5] > s <- as.data.frame(sapply(l,toupper)) > dput(s) structure(list(`sapply(l, toupper)` = structure(1:5, .Label = c("A", "B", "C", "D", "E"), class = "factor")), .Names = "sapply(l, toupper)", row.names = c("a", "b", "c", "d", "e"), class = "data.frame") (incidentally, setting col.names has no effect on this; notice that it is only documented as an argument to "list" and "matrix" methods, and sapply() returns a vector) Now, if we do this: > dd <- data.frame(A=l) > dd$B <- s we end up with a data frame whose B "column" is another data frame > dput(dd) structure(list(A = structure(1:5, .Label = c("a", "b", "c", "d", "e"), class = "factor"), B = structure(list(`sapply(l, toupper)` = structure(1:5, .Label = c("A", "B", "C", "D", "E"), class = "factor")), .Names = "sapply(l, toupper)", row.names = c("a", "b", "c", "d", "e"), class = "data.frame")), .Names = c("A", "B"), row.names = c(NA, -5L), class = "data.frame") in printing such data frames, the inner frame "wins" the column names, which is sensible if you consider what would happen if it had more than one column: > dd A sapply(l, toupper) 1 a A 2 b B 3 c C 4 d D 5 e E To get the effect that Ed probably expected, do > dd <- data.frame(A=l) > dd["B"] <- s > dd A B 1 a A 2 b B 3 c C 4 d D 5 e E (and notice that single-bracket indexing is crucial here) -pd __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem Subsetting Rows that Have NA's
It's not a bug, and the rationale has been hashed over since the beginning of time... It is a bit of an annoyance in some contexts and part of the rationale for the existence of subset(). If you need an explanation, start with elementary vector indexing: colors <- c("red", "green", "blue") colors[c(1,3,2,NA,3)] You pretty clearly want the result to be a vector of length 5 with 4th element NA, right? Same story if you index into a data frame: > airquality[c(1,3,2,NA,2),] Ozone Solar.R Wind Temp Month Day 1 41 190 7.4 67 5 1 3 12 149 12.6 74 5 3 2 36 118 8.0 72 5 2 NA NA NA NA NANA NA 2.136 118 8.0 72 5 2 Now, that's not an argument that you also get NA rows from logical indexing, but then comes the issue of automatic coercion: In colors[NA], the NA is actually mode "logical". If we removed NA indexes in logical indexing, we would have to explain why colors[c(1,NA)] has length 2 but colors[NA] has length zero (which it currently does not). -pd > On 25 Oct 2017, at 15:57 , BooBoo wrote: > > On 10/25/2017 4:38 AM, Ista Zahn wrote: >> On Tue, Oct 24, 2017 at 3:05 PM, BooBoo wrote: >>> This has every appearance of being a bug. If it is not a bug, can someone >>> tell me what I am asking for when I ask for "x[x[,2]==0,]". Thanks. >> You are asking for elements of x where the second column is equal to zero. >> >> help("==") >> >> and >> >> help("[") >> >> explain what happens when missing values are involved. I agree that >> the behavior is surprising, but your first instinct when you discover >> something surprising should be to read the documentation, not to post >> to this list. After having read the documentation you may post back >> here if anything remains unclear. >> >> Best, >> Ista >> >>>> #here is the toy dataset >>>> x <- rbind(c(1,1),c(2,2),c(3,3),c(4,0),c(5,0),c(6,NA), >>> + c(7,NA),c(8,NA),c(9,NA),c(10,NA) >>> + ) >>>> x >>> [,1] [,2] >>> [1,]11 >>> [2,]22 >>> [3,]33 >>> [4,]40 >>> [5,]50 >>> [6,]6 NA >>> [7,]7 NA >>> [8,]8 NA >>> [9,]9 NA >>> [10,] 10 NA >>>> #it contains rows that have NA's >>>> x[is.na(x[,2]),] >>> [,1] [,2] >>> [1,]6 NA >>> [2,]7 NA >>> [3,]8 NA >>> [4,]9 NA >>> [5,] 10 NA >>>> #seems like an unreasonable answer to a reasonable question >>>> x[x[,2]==0,] >>> [,1] [,2] >>> [1,]40 >>> [2,]50 >>> [3,] NA NA >>> [4,] NA NA >>> [5,] NA NA >>> [6,] NA NA >>> [7,] NA NA >>>> #this is more what I was expecting >>>> x[which(x[,2]==0),] >>> [,1] [,2] >>> [1,]40 >>> [2,]50 >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. > > I wanted to know if this was a bug so that I could report it if so. You say > it is not, so you answered my question. As far as me not reading the > documentation, I challenge anyone to read the cited help pages and predict > the observed behavior based on the information given in those pages. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R encountered a fatal error. The session was terminated. + *** caught illegal operation ***
Also, check whether R runs standalone, either as Rgui or in Terminal.app (just start Terminal and type "R" if you haven't tried it before.) -pd > On 26 Oct 2017, at 14:57 , David Barron wrote: > > I've seen similar issues reported on the RStudio community site: > https://community.rstudio.com/. You might want to check in there, as I > think this may well be an RStudio issue rather than a problem with R itself. > > Dave > > On 26 October 2017 at 12:11, Eric Berger wrote: > >> How about going back to earlier versions if you don't need the latest ones? >> >> >> On Thu, Oct 26, 2017 at 12:59 PM, Klaus Michael Keller < >> klaus.kel...@graduateinstitute.ch> wrote: >> >>> Dear all, >>> >>> I just installed the "Short Summer" R update last week. Now, my R Studio >>> doesn't open anymore! >>> >>> --> R encountered a fatal error. The session was terminated. >>> >>> and my R terminal doesn't close properly >>> >>> --> *** caught illegal operation *** >>> >>> I restarted my Mac OS Sierra 10.12.6 and reinstalled both R 3.4.2 and the >>> latest R studio but the problem persists. >>> >>> How can that issue be solved? >>> >>> Thanks in advance for your a precious help! >>> >>> All the best from Switzerland, >>> >>> Klaus >>>[[alternative HTML version deleted]] >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/ >>> posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >>[[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/ >> posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] R encountered a fatal error. The session was terminated. + *** caught illegal operation ***
Just tried upgrading on this machine (better late than never...) R gave no apparetn problems, either standalone or in RStudio 1.0.143. Newest RStudio gives me a strange warning on startup: Error in loadNamespace(name) : there is no package called ‘.GlobalEnv’ but appears to run sanely otherwise. (Looks like I had a script window looking at a function in .GlobalEnv which was no longer there. Closing the script seems to have cured the problem.) -pd > On 26 Oct 2017, at 15:04 , peter dalgaard wrote: > > Also, check whether R runs standalone, either as Rgui or in Terminal.app > (just start Terminal and type "R" if you haven't tried it before.) > > -pd > >> On 26 Oct 2017, at 14:57 , David Barron wrote: >> >> I've seen similar issues reported on the RStudio community site: >> https://community.rstudio.com/. You might want to check in there, as I >> think this may well be an RStudio issue rather than a problem with R itself. >> >> Dave >> >> On 26 October 2017 at 12:11, Eric Berger wrote: >> >>> How about going back to earlier versions if you don't need the latest ones? >>> >>> >>> On Thu, Oct 26, 2017 at 12:59 PM, Klaus Michael Keller < >>> klaus.kel...@graduateinstitute.ch> wrote: >>> >>>> Dear all, >>>> >>>> I just installed the "Short Summer" R update last week. Now, my R Studio >>>> doesn't open anymore! >>>> >>>> --> R encountered a fatal error. The session was terminated. >>>> >>>> and my R terminal doesn't close properly >>>> >>>> --> *** caught illegal operation *** >>>> >>>> I restarted my Mac OS Sierra 10.12.6 and reinstalled both R 3.4.2 and the >>>> latest R studio but the problem persists. >>>> >>>> How can that issue be solved? >>>> >>>> Thanks in advance for your a precious help! >>>> >>>> All the best from Switzerland, >>>> >>>> Klaus >>>> [[alternative HTML version deleted]] >>>> >>>> __ >>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide http://www.R-project.org/ >>>> posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>> >>> [[alternative HTML version deleted]] >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/ >>> posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > -- > 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 > > > > > > > > > -- 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] Correct subsetting in R
> On 1 Nov 2017, at 18:03 , Elahe chalabi via R-help > wrote: > > But they row.names() cannot give me the IDs > Is "training" extracted from "data" using standard data frame indexing? If so, data[row.names(training), "ID"] should give you the relevant values. If not, then you are in trouble because you cannot tell the difference between two IDs that have identical responses in columns 2:608. You might proceed with something like signature1 <- do.call("paste", data) any(duplicated(signature1)) # if TRUE you're not quite happy because two or more IDs are indistinguishable. signature2 <- do.call("paste", data) m <- match(signature2, signature1) any(duplicated(m)) # ouch if TRUE... will require more thought any(is.na(m)) # even more ouch, if TRUE... data$ID[m] -pd > > > > > > On Wednesday, November 1, 2017 9:45 AM, David Wolfskill > wrote: > > > > On Wed, Nov 01, 2017 at 04:13:42PM +, Elahe chalabi via R-help wrote: > >> Hi all, >> I have two data frames that one of them does not have the column ID: >> >>> str(data) >>'data.frame':499 obs. of 608 variables: >>$ ID : int 1 2 3 4 5 6 7 8 9 10 ... >>$ alright : int 1 0 0 0 0 0 0 1 2 1 ... >>$ bad : int 1 0 0 0 0 0 0 0 0 0 ... >>$ boy : int 1 2 1 1 0 2 2 4 2 1 ... >>$ cooki: int 1 2 2 1 0 1 1 4 2 3 ... >>$ curtain : int 1 0 0 0 0 2 0 2 0 0 ... >>$ dish : int 2 1 0 1 0 0 1 2 2 2 ... >>$ doesnt : int 1 0 0 0 0 0 0 0 1 0 ... >>$ dont : int 2 1 4 2 0 0 2 1 2 0 ... >>$ fall : int 3 1 0 0 1 0 1 2 3 2 ... >>$ fell : int 1 0 0 0 0 0 0 0 0 0 ... >> >> and the other one is: >> >>> str(training) >>'data.frame':375 obs. of 607 variables: >>$ alright : num 1 0 0 0 1 2 1 0 0 0 ... >>$ bad : num 1 0 0 0 0 0 0 0 0 0 ... >>$ boy : num 1 1 2 2 4 2 1 0 1 0 ... >>$ cooki: num 1 1 1 1 4 2 3 1 2 2 ... >>$ curtain : num 1 0 2 0 2 0 0 0 0 0 ... >>$ dish : num 2 1 0 1 2 2 2 1 4 1 ... >>$ doesnt : num 1 0 0 0 0 1 0 0 0 0 ... >>$ dont : num 2 2 0 2 1 2 0 0 1 0 ... >>$ fall : num 3 0 0 1 2 3 2 0 2 0 ... >>$ fell : num 1 0 0 0 0 0 0 0 0 0 ... >> Does anyone know how should I get the IDs of training from data? >> thanks for any help! >> Elahe >> > > row.names() appears to be what is wanted. > > Peace, > david > -- > David H. Wolfskillr...@catwhisker.org > Unsubstantiated claims of "Fake News" are evidence that the claimant lies > again. > > See http://www.catwhisker.org/~david/publickey.gpg for my public key. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with r project in ubuntu xenial
> On 3 Nov 2017, at 23:39 , George Balas wrote: > > I have a problem with R in Ubuntu 16.04. I do not know if it is mine pc or > general problem but I was not able to find solution on Internet. > First of all I can not change locale to greek by getting this message: > "In Sys.setlocale("LC_CTYPE", "Greek") : > OS reports request to set locale to "Greek" cannot be honored" The Greek locale is likely not called "Greek" outside of Windows. More likely "el_GR.UTF-8" or thereabouts (check your locale database, I'm on a Mac). These things are not standardized across platforms. > Second and more serious is that I can not use some functions like > graph_from_adjacency_matrix or print_all I get these messeges: > "could not find function "graph_from_adjacency_matrix"" > "could not find function "print_all"". Missing library(igraph)? -pd > I am using R version 3.4.2 (2017-09-28) -- "Short Summer" either on rstudio > or ubuntu terminal. > On my pc I also run win 10 with the same installs and I do not have the > above problems, but I work on ubuntu and can not change Os all the time. > Please help me. > > Thank you for your time, > George > gbala...@gmail.com > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] Using MLE on a somewhat unusual likelihood function
(inline) > On 7 Nov 2017, at 06:02 , Hugo André wrote: > > So I am trying to use the mle command (from stats4 package) to estimate a > number of parameters using data but it keeps throwing up this error message: > > Error in solve.default(oout$hessian) : > Lapack routine dgesv: system is exactly singular: U[1,1] = 0 > > This error sometimes indicates that the list of starting values is too far > from optimum but this is unlikely since I picked values close to where the > parameters usually end up. I have also tried switching these around a bit. > > Here is the code: > > xhat = c(statemw-(1-alpha)*rval) > survivalf <- function(x) {(1-plnorm(statemw,mean=mu,sd=logalpha))} > > wagefn <- function(lam, eta, alpha, xhat, mu, logalpha) { > n=nrow(cpsdata2) > wagevec = matrix(nrow=n,ncol=1) >for (i in 1:n) { > >if (cpsdata2[i,2] > 0){ > wagevec[i,] <- > c(eta*lam*survivalf(statemw)*exp(-lam*survivalf(statemw)*cpsdata2[i,2,])) >} else if (cpsdata2[i,1,]==statemw) { > wagevec[i,] <- > c(lam*(survivalf(statemw)-survivalf((statemw-(1-alpha)*xhat)/alpha))/(eta+lam*survivalf(statemw))) >} else if (cpsdata2[i,1,]>statemw) { > wagevec[i,] <- > c(lam*plnorm((cpsdata2[i,1,]-(1-alpha)*xhat)/alpha,mean=mu,sd=logalpha)/(alpha*(eta+lam*survivalf(statemw >} > else { > wagevec[i,] <- NA > } >} > lnwagevec <- log(wagevec) > -sum(lnwagevec>-200 & ln2wagevec<200, na.rm=TRUE) > } > > fit <- mle(wagefn, start=listmat, method= "L-BFGS-B",lower= > c(-Inf,0),upper=c(Inf,Inf) > > > I know the likelihood function is a handful but it does return a reasonable > looking vector of values. The "lnwagevec>-200" etc is an inelegant way of > preventing values of Inf and -Inf from entering the sum, the actual values > rarely go as high as 8 or low as -5. > If you're getting infinite likelihoods, something may be needing a rethink, but first this: I don't think -sum(lnwagevec>-200 & ln2wagevec<200, na.rm=TRUE) does what I think you think it does Presumably you wanted -sum(lnagevec[lnwagevec>-200 & ln2wagevec<200], na.rm=TRUE) -pd > Thank you in advance to anyone responding! > /Hugo > > [[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. -- 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] Using MLE on a somewhat unusual likelihood function
> On 7 Nov 2017, at 11:38 , peter dalgaard wrote: > > Presumably you wanted -sum(lnagevec[lnwagevec>-200 & ln2wagevec<200], > na.rm=TRUE) Well, after correcting the obvious spelling error. Sorry about that... -pd -- 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] R 3.4.3 scheduled for November 30
Full schedule available on developer.r-project.org (pending auto-update from SVN) -- 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-annou...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] ks.test() with 2 samples vs. 1 sample an distr. function
I suspect that that reply just replicates the question. There are two issues: The distribution of the test statistic is different, which may be unsurprising. However, the test statistic itself is also different which may be a bit more subtle. It may help to plot(ecdf(xi)) and similarly x. The 2-sample KS statistic will is the maximum vertical distance between two step functions, so with 2x8 points, it will be a multiple of .125. The 1-sample version is the max distance between a step function and a smooth curve. -pd > On 15 Nov 2017, at 16:56 , David L Carlson wrote: > > In the first example you are performing a one-sample test against a > continuous cumulative distribution (in this case a normal distribution). In > the second case you are performing a two-sample test. You drew your values > for x non-randomly by specifying fixed intervals along a normal distribution, > but ks.test() just sees that you have provided two samples, not one sample > and values along a cumulative distribution. > > > David L Carlson > Department of Anthropology > Texas A&M University > College Station, TX 77843-4352 > > > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > tonja.krue...@web.de > Sent: Wednesday, November 15, 2017 3:47 AM > To: r-help@r-project.org > Subject: [R] ks.test() with 2 samples vs. 1 sample an distr. function > > Dear all, > I have a question concerning the ks.test() function. I tryed to calculate the > example given on the German wikipedia page. > xi <- c(9.41,9.92,11.55,11.6,11.73,12,12.06,13.3) > I get the right results when I calculate: ks.test(xi,pnorm,11,1) Now the > question: shouldn't I obtain the same or a very similar result if I commpare > the sample and a calculated sample from the distribution? > p<- c(0.125, 0.250, 0.375, 0.500, 0.625, 0.750, 0.875, 0.) x <- > qnorm(p,11,1) > ks.test(xi,x) > Why don't I? > Thanks for helping me! > Tonja > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Yield-to-Maturity problem
This isn't all that likely to be homework, Bert However, Alexander, you may find that not many readers are familiar with YTM concepts. There's a chapter with R examples in Ruppert+Matteson's book (if you have SpringerLink, you may be able to download for free). Otherwise you could try searching CRAN, but be warned that you may get considerably more than you wished for. Some packages do look like they could be relevant. -pd > On 16 Nov 2017, at 16:55 , Bert Gunter wrote: > > This list has a no homework policy. > > Also, please read the posting guidebelow to learn what sorts of posts are > legitimate and how to post. > Note: plain text , not html, which often gets mangked by the server. > > 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 Thu, Nov 16, 2017 at 6:25 AM, Alexander Bergmüller < > alexanderb...@hotmail.de> wrote: > >> Hello everybody, >> >> I am not very advanced in my R skills so I really hope anybody of you can >> help me with this problem on which I have been working for hours. >> >> I would like to write a function, which can guess the yield-to-maturity >> for any values: C, NV, r, s1, s2, and for a freely chosen tolerance (tol). >> >> Additionaly, for freely chosen T; -> s1, s2, s3, ..., sT >> >> I appreciate your help so much. >> Greetings, >> >> Alexandra Becker >> >> >>[[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. -- 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] tcltk problems
That should probably work, but I wonder whether the root cause might be non-installation of Ubuntu "-devel" (or is it "-dev"?) Tcl and Tk packages. It doesn't look quite right to have to tell R's configure about a path that depends on the current Tcl/Tk version. I would have expected that tclConfig.sh would be found in /usr/lib or /usr/local/lib. -pd > On 18 Nov 2017, at 06:18 , Peter Langfelder > wrote: > > Rolf, > > looking at the configure script I believe you need to specify > > --with-tcl-config=/usr/lib/tcl8.6/tclConfig.sh > > and similarly > > --with-tk-config= > > HTH, > > Peter > > > On Fri, Nov 17, 2017 at 8:43 PM, Rolf Turner wrote: >> On 18/11/17 17:00, Erin Hodgess wrote: >>> >>> When I have compiled from sourced on Ubuntu, I did NOT include the >>> "with-tcltk" and it worked fine. Did you try that, please? >> >> >> In the past I have configured without using the "--with-tcltk" flag, >> and R of course built just fine. But it *did not* have tcltk capability. >> When I wanted that capability I had to start using the >> aforesaid flag. >> >> It makes absolutely no sense that one would get tcltk capability when >> configuring without the flag but *not* get it when configuring *with* the >> flag. If that is indeed the case then this definitely constitutes a bug in >> the "configure" system. >> >> I cannot believe that it would work to leave out the flag, but I'll try it >> just for the sake of "completeness". >> >> cheers, >> >> Rolf >> >> -- >> Technical Editor ANZJS >> Department of Statistics >> University of Auckland >> Phone: +64-9-373-7599 ext. 88276 >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] [FORGED] Re: tcltk problems
Hum, missed that bit. Looking at the configure script, the only way I can see it failing to look in /usr/lib/tcl8.6 is if ${LIBnn} is not "lib". Any chance it might be set to lib64? -pd > On 18 Nov 2017, at 22:32 , Rolf Turner wrote: > > > On 19/11/17 05:36, Albrecht Kauffmann wrote: > >> Did you istall the tcl- and tk-devel packages? > > (a) That should be "dev" not "devel". > > (b) The answer to your question is, yes, as I made clear in my original post. > > cheers, > > Rolf Turner > > -- > Technical Editor ANZJS > Department of Statistics > University of Auckland > Phone: +64-9-373-7599 ext. 88276 > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] tcltk problems
This is normal, but you're not reading it right. Typically, a program conftest.c is generated on the fly and contains something like a #include of something you may or may not have. The first part of the program is labeled /* conftest.h */ which indicates that it is taken from that file of standard definitions. The contents of confdefs.h is actually mostly irrelevant (though I suppose there are cases when it isn't), the interesting bit is usually the line(s) that comes from elsewhere, e.g. | #define HAVE_UNISTD_H 1 | #define HAVE_UTIME_H 1 | #define HAVE_ARPA_INET_H 1 | /* end confdefs.h. */ | #include configure:23459: result: no configure:23459: checking for dl.h configure:23459: result: no This whole thint is about whether or not your system contains dl.h. When the compile fails, configure concludes that it doesn't. You only get to see the programs when they fail, but the same mechanism is behind all the other tests, like configure:23459: checking langinfo.h presence configure:23459: gcc -arch x86_64 -E -I/usr/local/include conftest.c configure:23459: $? = 0 configure:23459: result: yes configure:23459: checking for langinfo.h configure:23459: result: yes In some other cases, there is a rudimentary main() function, usually to check existence of specific library routines, and in a few cases there is a check whether the compiled program actually runs. -pd > On 19 Nov 2017, at 02:02 , Rolf Turner wrote: > > P.S. On a whim, I scanned through config.log some more and found many, many > errors logged and many, many "compilation terminated" notes. In particular > there seem to be problems with a file "confdef.h", which repeatedly seems to > give rise to "fatal errors". (Where is confdef.h? > It seems to be nowhere.) -- 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] tcltk problems
Dirk may want to dig in here: Seems like you have a system with a /usr/lib64 dir for 64 bit libraries, but Tcl files in /usr/lib. If that is not an anomaly, it looks like we have a configure bug (conceiveably, a system might be using /usr/lib for architecture-independent files, and lib64/lib32 for binaries). It doesn't look too hard to modify configure to also check /usr/lib, but we probably shouldn't do it if one user has shot himself in the foot somehow. -pd > On 19 Nov 2017, at 02:02 , Rolf Turner wrote: > > Then I scanned through BldDir/config.log and found: > > LIBnn='lib64' > > (on line 19901 !!!) > > So it would appear that Peter D.'s conjecture is correct. > > OTOH this is waaayyy after the "checking for tclConfig.sh" business, which > happens at about line 15101 of config.log. So how does it have an impact on > that? > > And how did LIBnn get to be set to 'lib64'? I certainly didn't do it, and > there's nothing about 'lib64' in the environment variables that I have set. -- 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] libPaths displays truncated path?
> On 23 Nov 2017, at 17:36 , David Winsemius wrote: > >> >> On Nov 23, 2017, at 4:34 AM, Loris Bennett >> wrote: >> >> Hi, >> >> TL;DR >> - >> >> I define the path >> >> /cm/shared/apps/R/site-library/3.4.2 >> >> and add it to libPath. Why does libPath then display it as >> >> /cm/shared/apps/R/site-library/3.4 > > Generally one only has a different library for each major version of R. Major > versions are consider just the first two numbers in the dot-separated > versions system. Apparently libPaths is "smart" enough to make an effort to > adhere to that convention. It appears your definition of "major" differs > from the usual convention. Nope. Chuck B. is almost certainly right: The symlink did it, with the normalizePath, in .libPaths(). (And the OP has cause and effect reversed.) Not even R functions are smart enough to make a decision like you suggest without actually containing code to do it: > .libPaths function (new) { if (!missing(new)) { new <- Sys.glob(path.expand(new)) paths <- c(new, .Library.site, .Library) paths <- paths[dir.exists(paths)] .lib.loc <<- unique(normalizePath(paths, "/")) } else .lib.loc } -pd > > -- > David >> >> ? >> >> Long version >> >> >> I run a cluster of diskless nodes for which the OS is loaded >> directly into RAM and other software is provided by an NFS server. >> However, in the case of R, we use the R version provided by the OS and >> just install additional packages on the NFS server. >> >> So that R can find these additional packages, I have the following in >> the site-wide Rprofile >> >> v <- R.Version() >> base_path = "/cm/shared/apps/R/site-library/" >> major_minor_version = paste(v["major"],v["minor"],sep=".") >> cm_shared_lib_path = paste0(base_path,major_minor_version) >> full_cm_shared_lib_path <- c(file.path(chartr("\\", "/", R.home()), >> "site-library"), cm_shared_lib_path) >> .libPaths( c( .libPaths(), full_cm_shared_lib_path ) ) >> >> Thus, when I start R I get this: >> >>> full_cm_shared_lib_path >> [1] "/usr/lib64/R/site-library" >> [2] "/cm/shared/apps/R/site-library/3.4.2" >> >> but also this >> >>> .libPaths() >> [1] "/home/loris/R/x86_64-redhat-linux-gnu-library/3.4" >> [2] "/usr/lib64/R/library" >> [3] "/usr/share/R/library" >> [4] "/usr/lib64/R/site-library" >> [5] "/cm/shared/apps/R/site-library/3.4" >> >> However, in order to get R to find the packages, I have to add a >> symbolic link, thus: >> >> [/cm/shared/apps/R/site-library] $ ls -l 3.4.2 >> lrwxrwxrwx 1 root root 3 Nov 23 09:21 3.4.2 -> 3.4 >> >> So, my mistake was to think that "minor" would return "4", whereas it in >> fact returns "4.2". So I actually set the path to ".../3.4.2" and >> that's where R looks for packages. >> >> But why does libPaths display the the path I *thought* I had set, but in >> fact looks at the path I *really did* set? >> >> Cheers, >> >> Loris >> >> -- >> Dr. Loris Bennett (Mr.) >> ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > > 'Any technology distinguishable from magic is insufficiently advanced.' > -Gehm's Corollary to Clarke's Third Law > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R 3.4.3 is released
The build system rolled up R-3.4.3.tar.gz (codename "Kite-Eating Tree") this morning. The list below details the changes in this release. You can get the source code from http://cran.r-project.org/src/base/R-3/R-3.4.3.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Binaries for various platforms will appear in due course. For the R Core Team, Peter Dalgaard These are the checksums (md5 and SHA-256) for the freshly created files, in case you wish to check that they are uncorrupted: MD5 (AUTHORS) = f12a9c3881197b20b08dd3d1f9d005e6 MD5 (COPYING) = eb723b61539feef013de476e68b5c50a MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343 MD5 (FAQ) = 32a94aba902b293cf8b8dbbf4113f2ab MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b MD5 (NEWS) = cd01b91d7a7acd614ad72bd571bf26b3 MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8 MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801 MD5 (NEWS.2) = 71562183d75dd2080d86c42bbf733bb7 MD5 (R-latest.tar.gz) = bc55db54f992fda9049201ca62d2a584 MD5 (README) = f468f281c919665e276a1b691decbbe6 MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435 MD5 (THANKS) = f60d286bb7294cef00cb0eed4052a66f MD5 (VERSION-INFO.dcf) = 2f9cc25704594a615a8c8248d0dcd804 MD5 (R-3/R-3.4.3.tar.gz) = bc55db54f992fda9049201ca62d2a584 6474d9791fff6a74936296bde3fcb569477f5958e4326189bd6e5ab878e0cd4f AUTHORS e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4 COPYING 6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3 COPYING.LIB 7936facb07e752869342808b9c8879d0e270b1a9ec92b67ef4dd87496abfef0a FAQ f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31 INSTALL 97a082deb0a67a341f2c88a881c56a409a81c1af697732c3b15d8226d3970231 NEWS 4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62 NEWS.0 12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01 NEWS.1 a10f84be31f897456a31d31690df2fdc3f21a197f28b4d04332cc85005dcd0d2 NEWS.2 7a3cb831de5b4151e1f890113ed207527b7d4b16df9ec6b35e0964170007f426 R-latest.tar.gz 2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc README 408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9 RESOURCES 52f934a4e8581945cbc1ba234932749066b5744cbd3b1cb467ba6ef164975163 THANKS 598f9c6b562c7106f741b9cdc2cc7d0bae364645f103e6ecb49e57625e28308b VERSION-INFO.dcf 7a3cb831de5b4151e1f890113ed207527b7d4b16df9ec6b35e0964170007f426 R-3/R-3.4.3.tar.gz This is the relevant part of the NEWS file CHANGES IN R 3.4.3: INSTALLATION on a UNIX-ALIKE: * A workaround has been added for the changes in location of time-zone files in macOS 10.13 'High Sierra' and again in 10.13.1, so the default time zone is deduced correctly from the system setting when R is configured with --with-internal-tzcode (the default on macOS). * R CMD javareconf has been updated to recognize the use of a Java 9 SDK on macOS. BUG FIXES: * raw(0) & raw(0) and raw(0) | raw(0) again return raw(0) (rather than logical(0)). * intToUtf8() converts integers corresponding to surrogate code points to NA rather than invalid UTF-8, as well as values larger than the current Unicode maximum of 0x10. (This aligns with the current RFC3629.) * Fix calling of methods on S4 generics that dispatch on ... when the call contains * Following Unicode 'Corrigendum 9', the UTF-8 representations of U+FFFE and U+ are now regarded as valid by utf8ToInt(). * range(c(TRUE, NA), finite = TRUE) and similar no longer return NA. (Reported by Lukas Stadler.) * The self starting function attr(SSlogis, "initial") now also works when the y values have exact minimum zero and is slightly changed in general, behaving symmetrically in the y range. * The printing of named raw vectors is now formatted nicely as for other such atomic vectors, thanks to Lukas Stadler. -- 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-annou...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] ggtern and bquote...
> 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, etc, would you > please advise me about this problem. Did you try expression(P_a)? I don't do much gg-stuff, but I seem to recall that quote() doesn't quite cut it the way it does in base graphics. -pd > > Thanks in advance, > Levent TERLEMEZ > > > > > > > Bu elektronik posta ve onunla iletilen bütün dosyalar sadece yukarıda > isimleri belirtilen kişiler arasında özel haberleşme amacını taşımakta olup > gönderici tarafından alınması amaçlanan yetkili gerçek ya da tüzel kişinin > kullanımına aittir. Eğer bu elektronik posta size yanlışlıkla ulaşmışsa, > elektronik postanın içeriğini açıklamanız, kopyalamanız, yönlendirmeniz ve > kullanmanız kesinlikle yasaktır. Bu durumda, lütfen mesajı geri gönderiniz ve > sisteminizden siliniz. Anadolu Üniversitesi bu mesajın içerdiği bilgilerin > doğruluğu veya eksiksiz olduğu konusunda herhangi bir garanti vermemektedir. > Bu nedenle bu bilgilerin ne şekilde olursa olsun içeriğinden, iletilmesinden, > alınmasından ve saklanmasından sorumlu değildir. Bu mesajdaki görüşler > yalnızca gönderen kişiye aittir ve Anadolu Üniversitesinin görüşlerini > yansıtmayabilir. > > This electronic mail and any files transmitted with it are intended for the > private use of the people named above. If you are not the intended recipient > and received this message in error, forwarding, copying or use of any of the > information is strictly prohibited. Any dissemination or use of this > information by a person other than the intended recipient is unauthorized and > may be illegal. In this case, please immediately notify the sender and delete > it from your system. Anadolu University does not guarantee the accuracy or > completeness of any information included in this message. Therefore, by any > means Anadolu University is not responsible for the content of the message, > and the transmission, reception, storage, and use of the information. The > opinions expressed in this message only belong to the sender of it and may > not reflect the opinions of Anadolu University. > > [[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. -- 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] ggtern and bquote...
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),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,.29,.22),label=c("P[a]","P[b]","P[c]"), > parse=TRUE) > > cheers. > > Am 04.12.2017 um 15:37 schrieb 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(.32,.29,.22),label=as.expression("P_a","P_b","P_c")) >> >> 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,.29,.22),label=as.expression(quote(c("P_a","P_b","P_c" >> >> In geom_text_viewport (I also tried geom_label and geom_text versions) tried >> all possible solutions, but i couldn't achieved. R command outputs are like >> this: >> >> Error in stats::complete.cases(df[, vars, drop = FALSE]) : >> invalid 'type' (expression) of argument >> >> >> Maybe i am writing the code wrong, i couldn't figure out. >> >> Thanks for your kind answers. >> >> >> >> >> Kimden: Martin Maechler [maech...@stat.math.ethz.ch] >> Gönderildi: 04 Aralık 2017 Pazartesi 16:16 >> Kime: peter dalgaard >> Bilgi: Levent TERLEMEZ; R-help@r-project.org >> Konu: Re: [R] ggtern and bquote... >> >>>>>>> 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 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. >> >>> Did you try expression(P_a)? I don't do much gg-stuff, but >>> I seem to recall that quote() doesn't quite cut it the way >>> it does in base graphics. >> >>> -pd >> >> Yes, I vaguely remember that indeed also for the lattice package >> (which is based on 'grid' the same as 'ggplot2' is ..) sometimes >> expressions instead of calls are needed, i.e., expression(*) >> instead of just quote(*). >> >> However, I think Levent really meant what you'd get by >> expression(P[a]) ? >> >> @Levent: The clue is the need for valid R syntax, and indeed, as >> in LaTeX x_i often is the i-th element of x, the R syntax for >> indexing/subsetting is used here, i.e. >>x[i] for LaTeX x_i >> >> >> Last but not least, if Levent really needs bquote() [i.e. substitute()] >> then, a final >> as.expression(.) >> may be needed : >> >> identical(as.expression(quote(a == 1)), >> expression( a == 1)) # --> TRUE >> >> -- >> Martin Maechler, ETH Zurich >> >> >> >> >> Bu elektronik posta ve onunla iletilen bütün dosyalar sadece yukarıda >> isimleri belirtilen kişiler arasında özel haberleşme amacını taşımakta olup >> gönderici tarafından alınması amaçlanan yetkili gerçek ya da tüzel kişinin >> kullanımına aittir. Eğer bu elektronik posta size yanlışlıkla ulaşmışsa, >> elektronik postanın içeriğini açıklamanız, kopyalamanız, yönlendirmeniz ve >> kullanmanız kesinlikle yasaktır. Bu durumda, lütfen mesajı geri gönderiniz >> ve sisteminizden siliniz. Anadolu Üniversitesi bu mesajın içerdiği >> bilgilerin doğruluğu veya eksiksiz olduğu konusunda herhangi bir garanti >> vermemektedir. Bu nedenle bu bilgilerin ne şekilde olursa olsun içeriğinden
Re: [R] Dynamic reference, right-hand side of function
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 <- lapply(datalist, "[[", 1) colnum <- lapply(col1, as.numeric) (The 2nd line assumes that the damage has already been done so that you have aa_2000 ... aa_2007 in your workspace. You might alternatively create the list directly while importing the data.) -pd > On 4 Dec 2017, at 12:33 , Love Bohman wrote: > > 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 imported from Stata that is labelled aa_2000 > aa_2001 aa_2002, etc. Each dataset is imported as a matrix, and consists of > one column only. The columns consists of integer numbers. I need to convert > the data to vectors, which I found several ways to do. I use, for example: > aa_2000 <- as.numeric(aa_2000[,1]) > However, when trying to automate the task, so I don't have to write a line of > code for each dataset, I get stuck. Since I'm a Stata user, my first attempt > is trying to make a loop in order to loop over all datasets. However, I > manage to write a loop that works for the left-hand side of the syntax, but > not for the right-hand side. > I have included some examples from my struggles to solve the issue below, > what they all have in common is that I don't manage to call for any "macro" > (is that only a Stata-word?) in the right hand side of the functions. When I > try to replace the static reference with a dynamic one (like in the left-hand > side), the syntax just doesn't work. > > I would very much appreciate some help with this issue! > All the best, > Love > > year <- 2002 > dataname <- paste0("aa_",year) > assign(paste0(dataname), as.numeric(aa_2002[,1])) > > year <- 2003 > assign(paste0("aa_",year), as.numeric(aa_2003)) > > year <- 2005 > assign(paste0("aa_",year), aa_2005[,1]) > > list1 <- c(2000:2007) > list1[c(7)] > assign(paste0("aa_",list1[c(7)]), as.numeric(paste0(aa_2006))) > > > [[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. -- 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] Dynamic reference, right-hand side of function
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 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 (I guess it wasn't very well > explained). My problem was basically that I have a data matrix consisting of > just 1 row, and I want to convert that row into a vector. However, when > trying to do that dynamically, I couldn't get R to read the right hand side > of the syntax as a variable name instead of a string. However, together with > a colleague I finally solved it with the (eval(as.name()) function (I include > the loop I used below). I understand that looping isn't kosher among you more > devoted R-users, and eventually I hope I will learn to use lists in the > future instead. > > Thanks! > Love > > > for (year in 2000:2007){ > varname <- paste0("aa_",year) > assign(paste0(varname), as.vector(eval(as.name(varname > } > > -Ursprungligt meddelande- > Från: peter dalgaard [mailto:pda...@gmail.com] > Skickat: den 4 december 2017 16:39 > Till: Love Bohman > Kopia: r-help@r-project.org > Ämne: Re: [R] Dynamic reference, right-hand side of function > > 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 <- lapply(datalist, "[[", 1) > colnum <- lapply(col1, as.numeric) > > (The 2nd line assumes that the damage has already been done so that you have > aa_2000 ... aa_2007 in your workspace. You might alternatively create the > list directly while importing the data.) > > -pd > >> On 4 Dec 2017, at 12:33 , Love Bohman wrote: >> >> 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 imported from Stata that is labelled aa_2000 >> aa_2001 aa_2002, etc. Each dataset is imported as a matrix, and consists of >> one column only. The columns consists of integer numbers. I need to convert >> the data to vectors, which I found several ways to do. I use, for example: >> aa_2000 <- as.numeric(aa_2000[,1]) >> However, when trying to automate the task, so I don't have to write a line >> of code for each dataset, I get stuck. Since I'm a Stata user, my first >> attempt is trying to make a loop in order to loop over all datasets. >> However, I manage to write a loop that works for the left-hand side of the >> syntax, but not for the right-hand side. >> I have included some examples from my struggles to solve the issue below, >> what they all have in common is that I don't manage to call for any "macro" >> (is that only a Stata-word?) in the right hand side of the functions. When I >> try to replace the static reference with a dynamic one (like in the >> left-hand side), the syntax just doesn't work. >> >> I would very much appreciate some help with this issue! >> All the best, >> Love >> >> year <- 2002 >> dataname <- paste0("aa_",year) >> assign(paste0(dataname), as.numeric(aa_2002[,1])) >> >> year <- 2003 >> assign(paste0("aa_",year), as.numeric(aa_2003)) >> >> year <- 2005 >> assign(paste0("aa_",year), aa_2005[,1]) >> >> list1 <- c(2000:2007) >> list1[c(7)] >> assign(paste0("aa_",list1[c(7)]), as.numeric(paste0(aa_2006))) >> >> >> [[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. > > -- > Peter Dalgaard, Professor, > Center for Statistics, Copenhagen Business School Solbjerg Plads 3,
Re: [R] Auto Data in the ISLR Package
That probably works in this case, but it would cause grief if another car make had "ford" somewhere inside its name e.g. "bedford". Safer general practice is Auto[Auto$name %in% c("ford", "toyota"),] or similar using subset(). -pd > On 17 Dec 2017, at 09:10 , Eric Berger wrote: > > myAuto <- Auto[ grep("ford|toyota",Auto$name),] > > > > On Sat, Dec 16, 2017 at 10:28 PM, Bert Gunter > wrote: > >> I did not care to load the packages -- small reproducible examples are >> preferable, as the posting guide suggests. >> >> But, if I have understood correctly: >> >> See, e.g. ?subset >> >> Alternatively, you can read up on indexing data frames in any good basic R >> tutorial. >> >> 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 Sat, Dec 16, 2017 at 11:44 AM, AbouEl-Makarim Aboueissa < >> abouelmakarim1...@gmail.com> wrote: >> >>> Dear All: >>> >>> I would like to create a subset data set *with only* all Ford and all >>> Toyota cars from the Auto data set in ISLR R Package. Thank you very >> much >>> in advance. >>> >>> Please use the following code to see how is the data look like. >>> >>> >>> install.packages("ISLR") >>> library(ISLR) >>> data(Auto) >>> head(Auto) >>> >>> >>> with many thanks >>> abou >>> __ >>> >>> >>> *AbouEl-Makarim Aboueissa, PhD* >>> >>> *Professor of Statistics* >>> >>> *Department of Mathematics and Statistics* >>> *University of Southern Maine* >>> >>>[[alternative HTML version deleted]] >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/ >>> posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >>[[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/ >> posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] Fitting Beta Distribution
Stop right there and rethink! The normalization factor depends on the parameter that you are maximizing over. -pd > On 21 Dec 2017, at 11:29 , Lorenzo Isella wrote: > > In the code, dbeta1 is the density of the beta distribution for > shape1=shape2=shape. > In the code, dbeta2 is the same quantity written explicitly, without the > normalization factor (which should not matter at all if we talk about > maximizing a quantity). > -- 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] Why aov() with Error() gives three strata?
split(data,interaction(data$id,data$activ)) >>> sizes = sapply(balanced,nrow) >>> selected = lapply(sizes,sample.int,6) >>> balanced = mapply(function(x,y) {x[y,]}, balanced,selected,SIMPLIFY=F) >>> balanced = do.call(rbind,balanced) >>> aov(temp~activ+Error(id/activ),data=balanced) >>> >>> Thanks, >>> Jorge >>> >>>[[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. -- 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] Help with dates
Mostly agree, except that I would suggest hardcoding the notion of "in the future", so that you don't get surprises when someone reruns your code 20 years from now. -pd > On 28 Dec 2017, at 21:54 , Simmering, Jacob E > wrote: > > Your dates have an incomplete year information with 34. R assumes that 00-68 > are 2000 to 2068 and 69 to 99 are 1969 to 1999. See ?strptime and the details > for %y. > > You can either append “19” to the start of your year variable to make it > completely express the year or check if the date is in the future (assuming > all dates should be in the past) and subtract 100 years from the date. > > >> On Dec 28, 2017, at 11:13 AM, Ramesh YAPALPARVI >> wrote: >> >> Hi all, >> >> I’m struggling to get the dates in proper format. >> I have dates as factors and is in the form 02/27/34( 34 means 1934). If I use >> >> as.Date with format %d%m%y it gets converted to 2034-02-27. I tried changing >> the origin in the as.Date command but nothing worked. Any help is >> appreciated. >> >> Thanks, >> Ramesh >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] termplot intervals - SE or CI?
From ?termplot: col.se, lty.se, lwd.se: color, line type and line width for the ‘twice-standard-error curve’ when ‘se = TRUE’. ...which is findable, but might usefully also be made explicit in the definition of the se= argument. -pd > On 10 Jan 2018, at 23:27 , Eric Goodwin wrote: > > Thanks for your prompt reply Duncan. > > I had indeed assumed they were what the help file says until observation > raised doubts, which is why I queried it. > > From reading the code for termplot(), it seems that either the predict() > function doesn't return the 1x standard error, or the curves plotted by the > termplot() function are not 1x standard errors. If they're not 1x standard > errors, it seems misleading to call them (e.g. in the help file) "standard > errors". > > The "se.fit" returned by a call in termplot() to predict() is multiplied by 2 > (in termplot's function se.lines()) before it is plotted as a curve described > as "standard errors" by the help file. > > Thus, again, it seems that either termplot() is not plotting standard errors, > or predict() is not returning standard errors in se.fit. > > Cheers, > > Eric > > -Original Message- > From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] > Sent: Wednesday, 29 June 2016 12:02 > To: Eric Goodwin ; r-help@R-project.org > Subject: Re: [R] termplot intervals - SE or CI? > > On 28/06/2016 4:53 PM, Eric Goodwin wrote: >> Hello, >> >> A reviewer queried what the intervals were on the termplot I provided in a >> report. The help file for termplot() suggests they're standard errors >> (se=T), but in the code the se.fit values from predict() are multiplied by >> 2, suggesting it's a rough 95% confidence interval, is that right? > > I would assume they are what the help file says, but if I wasn't sure, I'd > work them out for a simple case from first principles, and compare to what > the code gives. > > Duncan Murdoch > > >> Many thanks, >> >> Eric Goodwin >> Scientific data analyst | Coastal and Freshwater Group Cawthron >> Institute Phone +64 (0)3 548 2319 | Mobile 027 439 1141 >> eric.good...@cawthron.org.nz<mailto:eric.good...@cawthron.org.nz> | >> www.cawthron.org.nz<http://www.cawthron.org.nz/> >> >> >> ## >> ### >> >> Note: >> This message is for the named person's use only. It=2...{{dropped:30}} > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] application of R
In the (approximate) words of Ross Ihaka: R could have been made commercial and then it might have had like 500 users instead of millions. Programming language aside, there isn't really much of a market for new, closed source, statistical programs, at least not unless you get to a level of sophistication which is way beyond the capacity of any single person (e.g. in the field of maths software, Mathematica is not likely to be replaceable by a free alternative anytime soon, but that is huge!). More likely, there is a market in consulting and in-house application development, both of which can quite conveniently be done with R. If you are good at it, that is. -pd > On 12 Jan 2018, at 06:17 , muhammad ramzi wrote: > > Oh I see thank you very much now I understand. So for me as I am considered > an intermediate in R and also C++ what kind of programming language I could > take up and learn to make a commercial statistical software ? Any advices as > well ? -- 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] reading lisp file in R
>>> Best wishes, >>> Ranjan >>> >>> On Wed, 17 Jan 2018 20:59:48 -0800 David Winsemius < >> dwinsem...@comcast.net> >>> wrote: >>> >>>> >>>>> On Jan 17, 2018, at 8:22 PM, Ranjan Maitra wrote: >>>>> >>>>> Dear friends, >>>>> >>>>> Is there a way to read data files written in lisp into R? >>>>> >>>>> Here is the file: https://archive.ics.uci.edu/ >>> ml/machine-learning-databases/university/university.data >>>>> >>>>> I would like to read it into R. Any suggestions? >>>> >>>> It's just a text file. What difficulties are you having? >>>>> >>>>> >>>>> Thanks very much in advance for pointers on this and best wishes, >>>>> Ranjan >>>>> >>>>> -- >>>>> Important Notice: This mailbox is ignored: e-mails are set to be >>> deleted on receipt. Please respond to the mailing list if appropriate. >> For >>> those needing to send personal or professional e-mail, please use >>> appropriate addresses. >>>>> >>>>> __ >>>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide http://www.R-project.org/ >>> posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>>> David Winsemius >>>> Alameda, CA, USA >>>> >>>> 'Any technology distinguishable from magic is insufficiently advanced.' >>> -Gehm's Corollary to Clarke's Third Law >>>> >>>> __ >>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide http://www.R-project.org/ >>> posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>> >>> >>> -- >>> Important Notice: This mailbox is ignored: e-mails are set to be deleted >>> on receipt. Please respond to the mailing list if appropriate. For those >>> needing to send personal or professional e-mail, please use appropriate >>> addresses. >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/ >>> posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >>[[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/ >> posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] max and pmax of NA and NaN
> On 20 Jan 2018, at 07:53 , Suharto Anggono Suharto Anggono via R-help > wrote: > > Extremes.Rd, that documents 'max' and 'pmax', has this in "Details" section, > in the paragraph before the last. > By definition the min/max of a numeric vector containing an NaN is NaN, > except that the min/max of any vector containing an NA is NA even if it also > contains an NaN. ...but how do you infer that this applies to pmin/pmax? You may want it to, but it specifically talks about the non-parallel min/max. -pd > > -- >>>>>> Michal Burda >>>>>>on Mon, 15 Jan 2018 12:04:13 +0100 writes: > >> Dear R users, is the following OK? > >>> max(NA, NaN) >> [1] NA >>> max(NaN, NA) >> [1] NA >>> pmax(NaN, NA) >> [1] NA >>> pmax(NA, NaN) >> [1] NaN > >> ...or is it a bug? > >> Documentation says that NA has a higher priority over NaN. > > which documentation ?? > [That would be quite a bit misleading I think. So, it should be amended ...] > >> Best regards, Michal Burda > > > R's help pages are *THE* reference documentation and they have > (for a long time, I think) had : > > ?NaN has in its 3rd 'Note:' > > Computations involving ‘NaN’ will return ‘NaN’ or perhaps ‘NA’: > which of those two is not guaranteed and may depend on the R > platform (since compilers may re-order computations). > > Similarly, ?NA contains, in its 'Details': > > Numerical computations using ‘NA’ will normally result in ‘NA’: a > possible exception is where ‘NaN’ is also involved, in which case > either might result (which may depend on the R platform). > > - > > Yes, it is a bit unfortunate that this is platform dependent; if > we wanted to make this entirely consistent (as desired in a > perfect world), I'm almost sure R would become slower because > we'd have to do add some explicit "book keeping" / checking > instead of relying on the underlying C library code. > > Note that for these reasons, often NaN and NA should not be > differentiated, and that's reason why using is.na(*) is > typically sufficient and "best" -- it gives TRUE for both NA and NaN. > > > Martin Maechler > ETH Zurich > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Updating Rcpp package when it is claimed by dplyr
Or, to avoid accusing you of lying. what you think is "vanilla" probably isn't. What exactly did you do? On Unix-likes, I would do something like this echo 'options(repos=list(CRAN="cran.r-project.org"));install.packages("Rcpp")' | R --vanilla (or maybe https://cloud.r-project.org is better...) -pd > On 2 Feb 2018, at 08:15 , Jeff Newmiller wrote: > > Your last statement is extremely unlikely to be true. The dplyr package > should not be present in a vanilla environment, so there should be no such > conflict. > -- > Sent from my phone. Please excuse my brevity. > > On February 1, 2018 11:00:01 PM PST, Patrick Connolly > wrote: >> When i tried to install the hunspell package, I got this error >> message: >> >> Error: package ‘Rcpp’ 0.12.3 was found, but >= 0.12.12 is required by >> ‘hunspell’ >> >> So I set about installing a new version of Rcpp but I get this message: >> >> Error in unloadNamespace(pkg_name) : >> namespace ‘Rcpp’ is imported by ‘dplyr’ so cannot be unloaded >> >> How does one get around that? I tried installing Rcpp in a vanilla >> session but the result was the same. >> >> TIA >> Patrick >> >> >>> sessionInfo() >> R version 3.4.3 (2017-11-30) >> Platform: x86_64-pc-linux-gnu (64-bit) >> Running under: Ubuntu 14.04.5 LTS >> >> Matrix products: default >> BLAS: /home/pat/local/R-3.4.3/lib/libRblas.so >> LAPACK: /home/pat/local/R-3.4.3/lib/libRlapack.so >> >> locale: >> [1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C >> [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 >> [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 >> [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C >> [9] LC_ADDRESS=C LC_TELEPHONE=C >> [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C >> >> attached base packages: >> [1] utils stats grDevices graphics methods base >> >> other attached packages: >> [1] lattice_0.20-35 >> >> loaded via a namespace (and not attached): >> [1] compiler_3.4.3 magrittr_1.5 R6_2.1.2 assertthat_0.1 >> parallel_3.4.3 >> [6] tools_3.4.3DBI_0.3.1 dplyr_0.4.3Rcpp_0.12.3 >> grid_3.4.3 >> >> >> -- >> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. >> >> ___Patrick Connolly >> {~._.~} Great minds discuss ideas >> _( Y )_ Average minds discuss events >> (:_~*~_:) Small minds discuss people >> (_)-(_). Eleanor Roosevelt >> >> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unexpected behaviour from read.table
This looks like a bug. Specifically, inside read.table lines <- .External(C_readtablehead, file, nlines, comment.char, blank.lines.skip, quote, sep, skipNul) returns "lines" as [1] "ID\tValue" "=\"Total\"\t1000" [3] "=\"CJ01 \"\t550\n=\"CF02\"\t450" Notice the embedded \n in the 3rd line. I.e., there are really 4 lines there. This gets pushed back twice and the first 3 (not 4) lines get read again as part of the header logic. Then when it comes to reading the data proper, the 4th line has ended up duplicated as the top row... As you suggest, it seems that something is up with the quote matching logic. -pd > On 4 Feb 2018, at 23:45 , Michael wrote: > > I’ve been struggling with seemingly ‘corrupt’ data.frames for a few days, and > believe I’ve narrowed the problem down to some odd behaviour from read.table > > I receive a tab delimited file from an external provider where strings are > encoded as =“content”. Not sure why, perhaps as most users open it in Excel. > My specific issue is that trailing spaces in any of the strings are causing > strange results from read.table > > # No trailing spaces > read.table(text="ID\tValue\n=\"Total\"\t1000\n=\"CJ01\"\t550\n=\"CF02\"\t450",header=FALSE,sep='\t’) > V1V2 > 1 ID Value > 2 =Total 1000 > 3 =CJ01 550 > 4 =CF02 450 > > # Now with trailing spaces in line 3 > read.table(text="ID\tValue\n=\"Total\"\t1000\n=\"CJ01 > \"\t550\n=\"CF02\"\t450",header=FALSE,sep='\t') >V1V2 > 1=CF02 450 > 2 ID Value > 3 =Total 1000 > 4 =CJ01 550 > 5=CF02 450 > > I solved my specific problem by setting quote=‘’, and extracting the string > content after calling read.table. As my original code had header=TRUE, I was > finding random rows were being used as column names! > > Flagging a potential issue with read.table, although I can easily accept I'm > missing something obvious here. > > Best, > Michael > > R version 3.4.3 (2017-11-30) > Platform: x86_64-apple-darwin15.6.0 (64-bit) / x86_64-pc-linux-gnu (64-bit) > Running under: macOS High Sierra 10.13.2 / Ubuntu 16.04.3 LTS > > > > > > > > [[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. -- 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] [FORGED] Re: SE for all levels (including reference) of a factor atfer a GLM
To give a short answer to the original question: > On 16 Feb 2018, at 05:02 , Rolf Turner wrote: > > In order to ascribe unique values to the parameters, one must apply a > "constraint". With the "treatment contrasts" the constraint is that > beta_1 = 0. ...and consequently, being a constant, has an s.e. of 0. -- 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] How to Save the residuals of an LM object greater or less than a certin value to an R object?
Also, which( abs( stdresiduals ) > 2.5 ) will tell you which of the standardized residuals are bigger than 2.5 in absolute value. It returns a vector of indices, as in > set.seed(1234) > x <- rnorm(100) > which (abs(x) > 2.5) [1] 62 > x[62] [1] 2.548991 -pd > On 23 Feb 2018, at 05:56 , Jeff Newmiller wrote: > > Residuals are stored as a numeric vector. The R software comes with a > document "Introduction to R" that discusses basic math functions and logical > operators that can create logical vectors: > > abs( stdresiduals ) > 2.5 > > It also discusses indexing using logical vectors: > > stdresiduals[ abs( stdresiduals ) > 2.5 ] > > Note that in most cases it is worth going the extra step of making your > example reproducible [1][2][3] because many problems arise from issues in the > data or in code that you don't think is broken. > > [1] > http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example > > [2] http://adv-r.had.co.nz/Reproducibility.html > > [3] https://cran.r-project.org/web/packages/reprex/index.html (read the > vignette) > -- > Sent from my phone. Please excuse my brevity. > > On February 22, 2018 8:09:49 PM PST, faiz rasool wrote: >> Dear list members, >> >> I want to save residuals above or less than a certain value to an R >> object. I have performed a multiple linear regression, and now I want >> to find out which cases have a residual of above + 2.5 and – 2.5. >> >> Below I provide the R commands I have used. >> >> Reg<-lm(a~b+c+d+e+f) # perform multiple regression with a as the >> dependent variable. >> >> Residuals<-residuals(reg) # store residuals to an R object. >> stdresiduals<-rstandard(reg) #save the standardized residuals. >> #now I want to type a command that will save the residuals of >> certain range to an object. >> >> I realize that by plotting the data I can quickly see the residuals >> outside a certain boundtry, however, I am totally blind, so visually >> inspecting the plot is not possible for me. >> >> Thank you for any help. >> >> Regards, >> Faiz. >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reshaping column items into rows per unique ID
It depends quite strongly on what you want to do with the result, but I wonder if what is really needed might be a list of diettypes per person, i.e. continuing from Eric's code > On 25 Feb 2018, at 18:56 , Eric Berger wrote: > > Hi Allaisone, > I took a slightly different approach but you might find this either as or > more useful than your approach, or at least a start on the path to a > solution you need. > > df1 <- > data.frame(CustId=c(1,1,1,2,3,3,4,4,4),DietType=c("a","c","b","f","a","j","c","c","f"), >stringsAsFactors=FALSE) > with(df1, tapply(DietType, CustId, list)) $`1` [1] "a" "c" "b" $`2` [1] "f" $`3` [1] "a" "j" $`4` [1] "c" "c" "f" or maybe get rid of duplicates with > with(df1, tapply(DietType, CustId, unique)) $`1` [1] "a" "c" "b" $`2` [1] "f" $`3` [1] "a" "j" $`4` [1] "c" "f" -- 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] Sum of columns of a data frame equal to NA when all the elements are NA
No. The empty sum is zero. Adding it to another sum should not change it. Nothing audacious about that. This is consistent; other definitions just cause trouble. -pd > On 21 Mar 2018, at 18:05 , Boris Steipe wrote: > > Surely the result of summation of non-existent values is not defined, is it > not? And since the NA values have been _removed_, there's nothing left to sum > over. In fact, pretending the the result in that case is zero would appear > audacious, no? > > Cheers, > Boris > > > > > >> On Mar 21, 2018, at 12:58 PM, Jeff Newmiller >> wrote: >> >> What do you mean by "should not"? >> >> NULL means "missing object" in R. The result of the sum function is always >> expected to be numeric... so NA_real or NA_integer could make sense as >> possible return values. But you cannot compute on NULL so no, that doesn't >> work. >> >> See the note under the "Value" section of ?sum as to why zero is returned >> when all inputs are removed. >> -- >> Sent from my phone. Please excuse my brevity. >> >> On March 21, 2018 9:03:29 AM PDT, Boris Steipe >> wrote: >>> Should not the result be NULL if you have removed the NA with >>> na.rm=TRUE ? >>> >>> B. >>> >>> >>> >>>> On Mar 21, 2018, at 11:44 AM, Stefano Sofia >>> wrote: >>>> >>>> Dear list users, >>>> let me ask you this trivial question. I worked on that for a long >>> time, by now. >>>> Suppose to have a data frame with NAs and to sum some columns with >>> rowSums: >>>> >>>> df <- data.frame(A = runif(10), B = runif(10), C = rnorm(10)) >>>> df[1, ] <- NA >>>> rowSums(df[ , which(names(df) %in% c("A","B"))], na.rm=T) >>>> >>>> If all the elements of the selected columns are NA, rowSums returns 0 >>> while I need NA. >>>> Is there an easy and efficient way to use rowSums within a function >>> like >>>> >>>> function(x) ifelse(all(is.na(x)), as.numeric(NA), rowSums...)? >>>> >>>> or an equivalent function? >>>> >>>> Thank you for your help >>>> Stefano >>>> >>>> >>>> >>>> (oo) >>>> --oOO--( )--OOo >>>> Stefano Sofia PhD >>>> Area Meteorologica e Area nivologica - Centro Funzionale >>>> Servizio Protezione Civile - Regione Marche >>>> Via del Colle Ameno 5 >>>> 60126 Torrette di Ancona, Ancona >>>> Uff: 071 806 7743 >>>> E-mail: stefano.so...@regione.marche.it >>>> ---Oo-oO >>>> >>>> >>>> >>>> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può >>> contenere informazioni confidenziali, pertanto è destinato solo a >>> persone autorizzate alla ricezione. I messaggi di posta elettronica per >>> i client di Regione Marche possono contenere informazioni confidenziali >>> e con privilegi legali. Se non si è il destinatario specificato, non >>> leggere, copiare, inoltrare o archiviare questo messaggio. Se si è >>> ricevuto questo messaggio per errore, inoltrarlo al mittente ed >>> eliminarlo completamente dal sistema del proprio computer. Ai sensi >>> dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità >>> ed urgenza, la risposta al presente messaggio di posta elettronica può >>> essere visionata da persone estranee al destinatario. >>>> IMPORTANT NOTICE: This e-mail message is intended to be received only >>> by persons entitled to receive the confidential information it may >>> contain. E-mail messages to clients of Regione Marche may contain >>> information that is confidential and legally privileged. Please do not >>> read, copy, forward, or store this message unless you are an intended >>> recipient of it. If you have received this message in error, please >>> forward it to the sender and delete it completely from your computer >>> system. >>>> >>>> -- >>>> Questo messaggio stato analizzato da Libra ESVA ed risultato non >>> infetto. >>>> This message was scanned by Libra ESVA and is believed to be clean. >>>> >>>> >>>>[[alternative HTML version deleted]] >>>> >>>> _
Re: [R] unable to move temporary installation of package
s some differences >> >>>>> that you REALLY NEED TO READ about at their website. Pay particular >> >>>>> attention to the checkpoint feature in this case. Note that >> troubles >>>>> installing it or with the MKL are probably off-topic here, though R >> >>>>> language questions should still be fair game. >>>>> >>>>> C) Having Administrator rights carries at least as much >>>>> responsibility to know what you are doing BEFORE you do it as it >>>>> bestows flexibility to get things done. If you used "Run As >>>>> Administrator" to install R or any packages then you have probably >>>>> set the permissions on your personal library inappropriately. If >> so, >>>>> you need to use your superpowers judiciously to eliminate your >>>>> personal library completely and then run R as a normal user to >> install/update R packages. >>>>> -- >>>>> Sent from my phone. Please excuse my brevity. >>>>> >>>>> On March 26, 2018 12:16:02 PM PDT, Paul Lantos >>>>> >>>>> wrote: >>>>>> I'm running Windows 10 / R Studio / R Open 3.4.3 >>>>>> >>>>>> >>>>>> >>>>>> Since getting a new computer recently I cannot install packages >>>>>> into >>>>> my >>>>>> personal libpath directory, and I can't seem to update packages >> (it >>>>>> says all packages are up to date even if I manually install an old >> >>>>>> version). I've got 100% admin rights on the computer and in the >>>>> library >>>>>> folder, I've set my R environment variable to specify the correct >>>>>> directory, I can freely move things manually in and out of the >>>>>> library >>>>> >>>>>> if needed, and R can read and use any package that's already in >> there. >>>>>> But I can't install or I get the "unable to move" error. >>>>>> >>>>>> >>>>>> >>>>>> I've uninstalled and reinstalled everything, tried this in >>>>>> non-Studio sessions using both R Open and regular R 3.4.4, and I >>>>>> get the same error. >>>>>> >>>>>> >>>>>> >>>>>> Thanks for any help, >>>>>> >>>>>> Paul Lantos >>>>>> >>>>>> >>>>>> _ >>>>>> Paul M. Lantos, MD, MS GIS, FIDSA, FAAP, FACP Associate Professor >>>>>> of Internal Medicine and Pediatrics Pediatric Infectious Diseases >> >>>>>> General Internal Medicine Duke University School of Medicine Duke >>>>>> Global Health Institute >>>>>> _ >>>>>> >>>>>> >>>>>> [[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_m >>>>>> ail >>>>>> m >>>>>> >> an_listinfo_r-2Dhelp&d=DwIFaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0S >>>>>> j_g >>>>>> Z >>>>>> >> 4adc&r=pCiIbVPBNWU0azo0D48ChUH_fawb-FalNVOf1sUn1r4&m=twuFRS-tVJfQuR >>>>>> zjI >>>>>> S >>>>>> >> 0GBC710QPtmpe1rDy5PNvS-GI&s=OtjN9-16IbB6IqUW1THCx-YX8wccZgBEQmfZY6c >>>>>> uBI >>>>>> I >>>>>> &e= >>>>>> PLEASE do read the posting guide >>>>>> >> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject >>>>>> .or >>>>>> g >>>>>> >> _posting-2Dguide.html&d=DwIFaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0 >>>>>> Sj_ >>>>>> g >>>>>> >> Z4adc&r=pCiIbVPBNWU0azo0D48ChUH_fawb-FalNVOf1sUn1r4&m=twuFRS-tVJfQu >>>>>> Rzj >>>>>> I >>>>>> >> S0GBC710QPtmpe1rDy5PNvS-GI&s=sY7Wm-L9iESeuqa2CevDBwLsBx06RewTYq2-DF >>>>>> g9K M U&e= and provide commented, minimal, self-contained, >>>>>> reproducible >>>>> code. >>>> >>> >>> >> --- >>> Jeff NewmillerThe . . Go >> Live... >>> DCN:Basics: ##.#. ##.#. Live >> Go... >>> Live: OO#.. Dead: OO#.. >> Playing >>> Research Engineer (Solar/BatteriesO.O#. #.O#. with >>> /Software/Embedded Controllers) .OO#. .OO#. >> rocks...1k >>> >> -- >>> - >>> >> >> --- >> Jeff NewmillerThe . . Go >> Live... >> DCN:Basics: ##.#. ##.#. Live >> Go... >>Live: OO#.. Dead: OO#.. Playing >> Research Engineer (Solar/BatteriesO.O#. #.O#. with >> /Software/Embedded Controllers) .OO#. .OO#. >> rocks...1k >> --- > > [[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. -- 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] R and Java 10 ➜ rJava not able to build
Don't waste too much time on this. It is due to a change introduced in Java 10 at short notice. I believe the rJava maintainers are working on a fix/workaround. -pd > On 31 Mar 2018, at 10:22 , John wrote: > > On Tue, 27 Mar 2018 22:25:33 +0300 > Luis Puerto wrote: > > I don't run a Mac so this may not help. Did you install java 10 as > user or as root? Using linux, applications installed as user will be > inserted into your user space under /home/. As root the > application will located where any user of the system with permission > to run the application can access it. I ran into a problem similar to > this with packages, some installed as root and some installed locally > in my user directory. > > JWDougherty > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading xpt files into R
That's what he tried, but the bottom line is that just because something is called foo.xpt there is no guarantee that it actually is a SAS XPORT file. Firefox plugins use the same extension but it could really be anything - naming conventions are just that: conventions. So dig deeper and find out what the file really is (or was supposed to be). -pd > On 14 Apr 2018, at 00:18 , David Winsemius wrote: > > There is a read.xport function in the foreign package and I think most people > would have chosen that one as a first attemp. It's part of the standard R > distribution. It refers you to > https://support.sas.com/techsup/technote/ts140.pdf for details on the format. -- 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] How to dynamically add variables to a dataframe
Like this? > V <- c("fee","fie","foe") > aq <- head(airquality) # Just to get a shorter example > aq[V] <- 0 > aq Ozone Solar.R Wind Temp Month Day fee fie foe 141 190 7.4 67 5 1 0 0 0 236 118 8.0 72 5 2 0 0 0 312 149 12.6 74 5 3 0 0 0 418 313 11.5 62 5 4 0 0 0 5NA NA 14.3 56 5 5 0 0 0 628 NA 14.9 66 5 6 0 0 0 > On 22 Apr 2018, at 10:13 , Luca Meyer wrote: > > Hi, > > I am a bit rusty with R programming and do not seem to find a solution to > add a number of variables to my existing dataframe. Basically I need to add > n=dim(d1)[1] variables to my d0 dataframe and I would like them to be named > V1, V2, V3, ... , V[dim(d1)[1]) > > When running the following code: > > for (t in 1:dim(d1)[1]){ > d0$V[t] <- 0 > } > > all I get is a V variable populated with zeros... > > I am sure there is a fairly straightforward code to accomplish what I need, > any suggestion? > > Thank you, > > Luca > > [[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. -- 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] Package 'data.table' in version R-3.5.0 not successfully being installed
web page: >>>>> >>>>> https://cloud.r-project.org/web/checks/check_results_data.table.html >>>>> >>>>> Currently it is failing self-tests on all platforms except r-oldrel, >>>>> which is the previous release of R. I'd recommend backing out of R >>>>> 3.5.0 and going to R 3.4.4 if that's a possibility for you. >>>>> >>>>> Yet another possibility is to use a version of data.table from >>>> Github, >>>>> which is newer than the version on CRAN and may have fixed the >>>> errors, >>>>> but that would require an installation from source, which not every >>>>> Windows user is comfortable with. >>>>> >>>>> Duncan Murdoch >>>>> >>>>> >>>>> On 26-Apr-2018 9:44 PM, "Duncan Murdoch" >>>> <mailto:murdoch.dun...@gmail.com>> wrote: >>>>> >>>>> On 26/04/2018 10:33 AM, Fox, John wrote: >>>>> > Dear A.K. Singh, >>>>> > >>>>> > As you discovered, the data.table package has an error under R >>>>> 3.5.0 that prevents CRAN from distributing a Windows binary for the >>>>> package. The reason that you weren't able to install the package >>>>> from source is apparently that you haven't installed the R >>>>> package-building tools for Windows. See >>>>> <https://cran.r-project.org/bin/windows/Rtools/>. >>>>> > >>>>> > Because a number of users of my Rcmdr and car packages have >>>>> contacted me with a similar issue, as a temporary work-around I've >>>>> placed a Windows binary for the data.table package on my website at >>>>> < >>>> https://socialsciences.mcmaster.ca/jfox/.Pickup/data.table_1.10.4-3.zip>. >>>>> You should be able to install the package from there via the command >>>>> > >>>>> > >>>>> install.packages(" >>>> https://socialsciences.mcmaster.ca/jfox/.Pickup/data.table_1.10.4-3.zip";, >>>> repos=NULL, type="win.binary") >>>>> > >>>>> > I expect that this problem will go away when the maintainer of >>>>> the data.table package fixes the error. >>>>> >>>>> You can see the errors in the package on this web page: >>>>> >>>>> https://cloud.r-project.org/web/checks/check_results_data.table.html >>>>> >>>>> Currently it is failing self-tests on all platforms except r-oldrel, >>>>> which is the previous release of R. I'd recommend backing out of R >>>>> 3.5.0 and going to R 3.4.4 if that's a possibility for you. >>>>> >>>>> Yet another possibility is to use a version of data.table from >>>> Github, >>>>> which is newer than the version on CRAN and may have fixed the >>>> errors, >>>>> but that would require an installation from source, which not every >>>>> Windows user is comfortable with. >>>>> >>>>> >>>>> Duncan Murdoch >>>>> >>>>> >>>> >>>> >>> >>> [[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. -- 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] Merging dataframes
I'd expect more like setdiff(A$key, B$key) and vice versa. Or, if you want the actual rows A[!(A$key %in% B$key),] or for the row numbers which(!(A$key %in% B$key)) -pd > On 1 May 2018, at 12:48 , Rui Barradas wrote: > > Hello, > > Is it something like this that you want? > > x <- data.frame(a = c(1:3, 5, 5:10), b = c(1:7, 7, 9:10)) > y <- data.frame(a = 1:10, b = 1:10) > > which(x != y, arr.ind = TRUE) > > > Hope this helps, > > Rui Barradas > > On 5/1/2018 11:35 AM, Chintanu wrote: >> Hi, >> May I please ask how I do the following in R. Sorry - this may be trivial, >> but I am struggling here for this. >> For two dataframes (A and B), I wish to identify (based on a primary >> key-column present in both A & B) - >> 1. Which records (rows) of A did not match with B, and >> 2. Which records of B did not match with A ? >> I came across a setdt function while browsing, but when I tried it, it says >> - Could not find function "setdt". >> Overall, if there is any way of doing it (preferably in some simplified >> way), please advise. >> Many thanks in advance. >> regards, >> Tito >> [[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. -- 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] add one variable to a data frame
Um, maybe just dat1$C <- match(dat1$B, unique(dat1$B)) Indexing 1:k with numbers between 1 and k is a bit of a no-op... AFAICT, this even works without stringsAsFactors=FALSE -pd > On 11 May 2018, at 21:30 , MacQueen, Don wrote: > > dat1$C <- seq(length(unique(dat1$B)))[ match( dat1$B, unique(dat1$B) )] -- 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] questions on subscores.
> On 15 May 2018, at 07:54 , Ulrik Stervbo wrote: > > I have no idea, but Google pointed me to this > https://cran.r-project.org/web/packages/subscore/index.html She seems to be aware of that package, but I don't see how she infers that it does not do what she want. For that, you need to know the theory better than I do, but there is both a subscore.Wainer() function with a direct reference to the 2001 paper and a CTTsub(, method="Wainer"). The package description has "This package enables three sets of subscoring methods within the framework of CTT and IRT: Wainer's augmentation method, Haberman's three subscoring methods, and Yen's objective performance index (OPI).", which sort of doesn't exclude the possibility that soem methods are CTT and others IRT, but why would you then have two routes to Wainer subscores? IRT theory is a rather specialized subject, so there are not many experts around. It might be one of those cases where you need to spend some effort studying both the theory and the code to see how they two match up. -pd > > Hth > Ulrik > > "Hyunju Kim" schrieb am Di., 15. Mai 2018, 07:21: > >> >> >> >> Hello, >> >> >> >> I want to compute Wainer et al's augmented subscore(2001) using IRT but I >> can't find any packages or relevant code. >> >> There is a 'subscore' package in R, but I think it only gives functions to >> calculate augmented subscores using CTT(classical test theory). >> >> Is there other package or code to compute subscores using IRT? If it is >> not, is there any plan to develop it in short period? >> >> >> >> >> >> >> >> Best regards, >> >> Hyunju Kim >> >>[[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. -- 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] Nelson-Aalen Estimator in R: Error Message
Hard to tell from the info you are giving us. I assume this regards the "mice" package? One way to proceed is to set options(error=recover) which will dump you into the browser() environment when the error occurs and you can oka around and see what the value of variables was at the point of the error. This could give you a clue about what is going on. -pd > On 22 May 2018, at 15:29 , A.C. van der Burgh > wrote: > > Dear all, > > Currently, I am doing a research project about serum sodium levels and > falling. I am doing my analysis in R. I am performing the multiple imputation > right now. I want to perform a survival analysis later, but therefore I need > to specify the Nelson-Aalen estimator. My dataset is called DF1, the event > indicator is Falls and the time variable is Time. The code that I use is as > follows: > > NAE <- nelsonaalen(data = DF1, statusvar = Falls, timevar = Time) > > However, I get this error: Error in Surv(time, status) : Time variable is not > numeric > > If I do the following: > > class(DF1$Time) [1] "numeric" > > It shows that my variable is numeric. Can you help me with how I can solve > this issue? > > Thank you in advance. > > Lisa > > > [[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. -- 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] Time and date conversion
> On 4 Jun 2018, at 10:45 , Christofer Bogaso > wrote: > > Hi, > > I have an automatic data feed and I obtained a Date vector in the following > format: > >> Date > [1] "03 Jun 2018 10:01 am CT""01 Jun 2018 22:04:25 pm CT" > > I now like to convert it to UTC time-zone > > Is there any easy way to convert them so, particularly since 1st element > doesnt have any Second element whereas the 2nd element has. ..and it also mixes up am/pm notation and 24hr clock. There are two basic approaches to the format inconsistency thing: (A) preprocess using gsub() constructions > gsub(" (..:..) ", " \\1:00 ", d.txt) [1] "03 Jun 2018 10:01:00 am CT" "01 Jun 2018 22:04:25 pm CT" (B) Try multiple formats > d <- strptime(d.txt, format="%d %B %Y %H:%M:%S %p") > d[is.na(d)] <- strptime(d.txt[is.na(d)], format="%d %B %Y %H:%M %p") > d [1] "2018-06-03 10:01:00 CEST" "2018-06-01 22:04:25 CEST" I would likely go for (A) since you probably need to do something gsub-ish to get the TZ thing in place. -pd > > Thanks for any pointer. > > [[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. -- 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] malware reported by antivirus on R Windows .exe file
These are almost always false positives. The checks are based on checksumming and sometimes a perfectly innocent .exe will match the checksum of some virus/malware. The .exe is rebuilt nightly and changes slightly between builds, so you may want just retry after a day or so. (The AV vendors are behaving pretty irresponsibly in these matters, but as long as it only hits a patch build, I don't think anyone cares enough to take action.) -pd > On 5 Jun 2018, at 00:03 , Paulo Barata wrote: > > Dear R-list members, > > This is just to make a report: Today, 04 June 2018, I attempted to download > R-3.5.0 Patched build for Windows (a .exe file) from the Austria CRAN https > site. My antivirus software, AVG Internet Security with all the latest > updates, aborted the connection, saying that some malware was found - please > see the attached Figure 1. > > I went then to the CRAN mirror at Oswaldo Cruz Foundation, Rio de Janeiro, > Brazil, and was able to download the .exe file. I immediately asked the AVG > software to scan the file; it found something suspicious and sent the file > for analysis in their labs. Some hours later, AVG said that the file was > malicious, and sent it to quarantine; I am not able to figure out which kind > of malware was supposed to exist in the file - please see the attached Figure > 2. > > Yesterday I was also not able to download the .exe file from the Austria CRAN > site, for the same reason. > > I am not able to evaluate the technical corretness of AVG's decisions. I am > only reporting what happened. > > Paulo Barata > > (Rio de Janeiro - Brazil) > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mzR fails to install/compile (linuxes)
wiz/data/proteome/Peptide.o ./pwiz/data/proteome/AminoAcid.o > ./pwiz/utility/minimxml/XMLWriter.o ./pwiz/utility/minimxml/SAXParser.o > ./pwiz/utility/chemistry/Chemistry.o ./pwiz/utility/chemistry/ChemistryData.o > ./pwiz/utility/chemistry/MZTolerance.o ./pwiz/utility/misc/IntegerSet.o > ./pwiz/utility/misc/Base64.o ./pwiz/utility/misc/IterationListener.o > ./pwiz/utility/misc/MSIHandler.o ./pwiz/utility/misc/Filesystem.o > ./pwiz/utility/misc/TabReader.o > ./pwiz/utility/misc/random_access_compressed_ifstream.o > ./pwiz/utility/misc/SHA1.o ./pwiz/utility/misc/SHA1Calculator.o > ./pwiz/utility/misc/sha1calc.o ./random_access_gzFile.o ./RcppExports.o > ./boost/libs/thread/src/pthread/once.o > ./boost/libs/thread/src/pthread/thread.o rampR.o R_init_mzR.o -lpthread > /usr/lib64/R/library/Rhdf5lib/lib/libhdf5_cpp.a > /usr/lib64/R/library/Rhdf5lib/lib/libhdf5.a > /usr/lib64/R/library/Rhdf5lib/lib/libsz.a -lz -L/opt/lib/hdf5-18/lib/ > -lnetcdf -L/usr/lib64/R/lib -lR > g++: error: cramp.o: No such file or directory > make: *** [mzR.so] Error 1 > ERROR: compilation failed for package ‘mzR’ > * removing ‘/usr/lib64/R/library/mzR’ > > If j is 1, then compilation succeeds. > I have hundreds of packages and so far only "mzR" and "MSnbase" fail if I > compile with -j>1. > > Would anybody be able to confirm this problem exists? > Many thanks, L. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] specifying random effects covariance structure in nlme
I haven't played with this for a decade or so, but I believe you can do something with pdBlocked(). Possibly ask over on R-sig-ME as this quickly gets beyond the R-help level. (Also, you are aware that it is not about what you want to estimate, but whether you believe the correlations are nonzero?) -pd > On 16 Jun 2018, at 13:00 , Chris Stride wrote: > > Hi > > I'm trying to fit a mixed effects exponential decay model, in which I have > random effects for the initial value (init), the asymptote (asymp), and the > rate (rate). > > The catch is that I'd also like to estimate the correlation between init and > asymp, but not between init and rate, or asymp and rate. > > Now using random = pdDiag(init + asymp + rate ~ 1) has none of the random > effects correlated > > And using random = pdSymm(init + asymp + rate ~ 1) has all three of the > random effects correlated > > How do I specify just the correlation I want? > > cheers > > Chris > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help, zero-truncated Binomial distribution
I think you can pretty much copy what is in that reference while substituting "binom" for "pois" (not quite, but you get the point?) -pd > On 18 Jun 2018, at 17:31 , Gagandeep S. Datta > wrote: > > Hi, > > Is there a code available for zero-truncated Binomial distribution on the > lines of zero-truncated Poisson distribution available at: > https://stat.ethz.ch/pipermail/r-help/2005-May/070680.html > > Regards, > Gagandeep > > [[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. -- 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] interpret a p-value result as a significance of a linear regression in terms of sigmas
Sorry to say so, but you seem confused. The "sigma" in physics parlance is presumably the s.e. of the estimate so the "number of sigmas" equal the t statistic, in this case 5.738. However, use of that measure ignores the t distribution, effectively assuming that there are infinite df (and 24 in not quite infinite). - pd > On 20 Jun 2018, at 12:53 , jean-philippe > wrote: > > dear R community, > > I am running a linear regression for my dataset between 2 variables (disk > mass and velocities). > This is the result returned by the summary function onto the lm object for > one of my dataset. > > Call: > lm(formula = df$md1 ~ df$logV, data = df) > > Residuals: > Min 1Q Median 3Q Max > -0.64856 -0.16492 0.04127 0.18027 0.45727 > > Coefficients: >Estimate Std. Error t value Pr(>|t|) > (Intercept) 6.2582 0.2682 23.333 < 2e-16 *** > df$logV 1.2926 0.2253 5.738 6.5e-06 *** > --- > Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > Residual standard error: 0.3067 on 24 degrees of freedom > Multiple R-squared: 0.5784,Adjusted R-squared: 0.5609 > F-statistic: 32.93 on 1 and 24 DF, p-value: 6.504e-06 > > > I am interested to give the significance in terms of sigmas (as generally > done in particle physics, see for instance the 7 \sigma discovery of the > Higgs particle) > of my regression. > For this, if I understood well, I should look at the p-value for the > F-statistic which is in this univariate linear regression the same as the one > for logV. > > My question is, am I right if I state that the significance in terms of > sigmas (sign) is given by: p = 2*(1-pnorm(sign)) since I guess the p-value > returned by R is for a two sided test (and assuming Gaussianity for my > dataset)? > > Otherwise is there any way to get the significance of this linear regression > in terms of sigmas? > > I would have a similar question also, as extension, for a multivariate linear > regression for which the p-value associated to F statistics is not the same > as the p-value for each variable of the regression. > > > > Thanks in advance, > > > Best Regards > > > Jean-Philippe Fontaine > > -- > Jean-Philippe Fontaine > PhD Student in Astroparticle Physics, > Gran Sasso Science Institute (GSSI), > Viale Francesco Crispi 7, > 67100 L'Aquila, Italy > Mobile: +393487128593, +33615653774 > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R maintains old values
t;>> 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. >>> >> >>[[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. -- 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] R maintains old values
> On 3 Jul 2018, at 15:25 , J C Nash wrote: > > For the sake of those who didn't see the link, Jenny objects strongly to > startup > lines that either set a personal path or clear the workspace. > > While I agree both of these are anti-social to the point of pathology for > scripts > that are distributed, I have found it VERY important when testing things to > actually > clear the workspace etc. Too many times I've got a result that nobody else > would get > because I'm often loading some of my own packages or there are "useful" > variables > lurking. I think Jenny's point is more that rm(ls... is the wrong _method_ to clear the workspace, because it only does part of the job and you may end up missing require() statements, etc. > > As usual, context is critical. Distributed scripts vs. developmental ones. > > Now, to add to the controversy, how do you set a computer on fire? Short the lithium battery? -pd > > JN > > On 2018-07-03 03:52 AM, peter dalgaard wrote: >> Also beware the traveling arsonist, Jenny Bryan: >> >> https://www.tidyverse.org/articles/2017/12/workflow-vs-script/ >> >> >> -pd >> >>> On 2 Jul 2018, at 17:11 , Bert Gunter wrote: >>> >>> ... or perhaps >>> >>> rm( list = ls(all = TRUE)) >>> ## see ?ls for details. >>> >>> However, see ?Startup for how to start a R in a "clean" environment, e.g. >>> with the --no-restore option. >>> >>> 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 Mon, Jul 2, 2018 at 7:47 AM, Eric Berger wrote: >>> >>>> If you want a "fresh" R session when you start to run the script you could >>>> consider putting as the first line >>>> >>>> rm(list=ls()) >>>> >>>> This will remove objects from your environment (variables, functions, ..) >>>> >>>> HTH, >>>> Eric >>>> >>>> >>>> On Mon, Jul 2, 2018 at 5:34 PM, PIKAL Petr wrote: >>>> >>>>> Hi >>>>> >>>>> Without code it is just fishing in murky waters. Could the problem you >>>>> face be that in each run you assingn the result to some object and if the >>>>> CSV is wrong your code fails but the object from previous run persists? >>>>> >>>>> If this is the case just initialize your objects in the beginning (e.g. >>>>> make them NULL at the beginning) and only if code delivers result the >>>> value >>>>> of the result is returned otherwise NULL is returned. >>>>> >>>>> Cheers >>>>> Petr >>>>> >>>>> 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/ >>>>> >>>>>> -Original Message- >>>>>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Morkus >>>>> via R- >>>>>> help >>>>>> Sent: Monday, July 2, 2018 2:02 PM >>>>>> To: r-help@r-project.org >>>>>> Subject: [R] R maintains old values >>>>>> >>>>>> Hello, >>>>>> >>>>>> I have a strange side-effect from executing R-scripts using R and >>>> RServe. >>>>>> >>>>>> I am executing an R-Script from a Java file using RServe in R. I also >>>>> have RStudio >>>>>>
Re: [R] gamlss() vs glm() standard errors via summary() vs vcov()
> # Extract SEs via vcov() > SEvcov1<-exp(coef(fit1)) *sqrt(diag(vcov(fit1))) > SEvcov2<-exp(coef(fit2))*sqrt(diag(vcov(fit2))) What makes you think that you need to multiply with exp(coef()) here??? -pd > On 4 Jul 2018, at 11:08 , 1/k^c wrote: > > Hi R-helpers, > > I was working with some count data using gamlss() and glm(), and > noticed that the standard errors from the two functions correspond > when extracting from either the model summary for both functions, or > using vcov for both functions, but the standard errors between those > methods do not correspond. I have been lead to believe that in SAS and > Stata, the SEs do correspond between the different methods. Can anyone > assist me in understanding what's different between the two types of > SEs I seem to be encountering when using R with either glm or gamlss? > I feel like I'm missing something obvious. I have included a small > reproducible example below. > > library(COUNT) # for myTable() > library(gamlss) > len<-50 > seeder<-250 > set.seed(seeder) # reproducible example > dat<-rpois(c(1:len), lambda=2) > myTable(dat) > fac<-gl(n=2, k=1, length=len, labels = c("control","treat")) > > # Fit gamlss() and glm() models > fit1<-gamlss(dat~fac, family="PO") > fit2<-glm(dat~fac, family="poisson") > > # Extract SEs from model summaries > SESum1<-summary(fit1)[,"Std. Error"] > SESum2<-coef(summary(fit2))[,"Std. Error"] > cbind(SESum1, SESum2) # Corresponds > > # Extract SEs via vcov() > SEvcov1<-exp(coef(fit1)) *sqrt(diag(vcov(fit1))) > SEvcov2<-exp(coef(fit2))*sqrt(diag(vcov(fit2))) > cbind(SEvcov1, SEvcov2) # Corresponds > > # Compare between summary() and vcov() extraction. Missmatch. > cbind(SESum1, SEvcov1) > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R is creating a new level which is emty after importing a SAS file
It is not obvious that this is an error. If your nominal variable in SAS has a level which is not present in data, then R might just be making a faithful translation. There is a distinction between (a) having a gender variable with two levels of which 0 females and (b) pretending that male is the only possible gender. Anyways, droplevels() is your friend. (Notice that it easier to remove levels that you do not want than to insert levels that have been unwantedly deleted on input.) -pd > On 4 Jul 2018, at 19:16 , Adam Z. Jabir wrote: > > Hi, > > I have imported some sasdata into R using the sas7bdat package. I have some > nominal variables with some missing values. > > R is creating a new level which is emty �.When I ask for tabulate this new > level is presented with 0 as a frequency. > > I want to get rid of this level and have my file imported correctly. > > Do you have some hint to help solve this problem? > > > Please use this email adress to answer this query. > > > Best, > > Adam > > > Envoy� � partir de Outlook<http://aka.ms/weboutlook> > > [[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. -- 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] Where does ' Setting LC_CTYPE failed, using "C" ' come from? 2
> On 17 Jul 2018, at 18:18 , David Winsemius wrote: > >>>> Executing >>>> >>>>Open Terminal >>>>Write or paste in: defaults write org.R-project.R force.LANG >>>> en_US.UTF-8 >>>>Close Terminal >>>>Start R >>>> >>>> as suggested on >> >> https://stackoverflow.com/questions/9689104/installing-r-on-mac-warning-messages-setting-lc-ctype-failed-using-c, >> >> did not help :-( > > Sigh, claiming that something "did not help" usually ...does not help. You > need a clear unambigous description of everything that was in place and > exactly what was being done when the unexpected behavior occurred. Hm, well, seen worse... However, some detective works seems required. C: (a) Can you at this point do the equivalent of the following (in a Terminal window): Peter-Dalgaards-MacBook-Air:~ pd$ defaults read org.R-project.R force.LANG en_US.UTF-8 If not, then the "defaults write" stuff has been entered incorrectly or didn't work for some reason. -åd -- 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] Difference between R for the Mac and for Windows
[This is drifting somewhat awy from the original intention of the topic, I think]. This looks like a build dependency. I get 3.3.2 (yeah, I know, should upgrade): > (1+2i)/0 [1] NaN+NaNi R-devel, march 24: > (1+2i)/0 [1] Inf+Infi on the *same* machine. The difference is that one is stock CRAN, the other was built locally. So with the toolchain being updated for 3.4.0, this difference would likely go away. Or at least change... -pd > On 31 Mar 2017, at 19:15 , Berend Hasselman wrote: > > > I have noted a difference between R on macOS en on Kubuntu Trusty (64bits) > with complex division. > I don't know what would happen R on Windows. > > R.3.3.3: > > macOS (10.11.6) > - >> (1+2i)/0 > [1] NaN+NaNi >> (-1+2i)/0 > [1] NaN+NaNi >> >> 1i/0 > [1] NaN+NaNi >> 1i/(0+0i) > [1] NaN+NaNi > > > KubuntuTrusty > - >> (1+2i)/0 > [1] Inf+Infi >> (-1+2i)/0 > [1] -Inf+Infi >> >> 1i/0 > [1] NaN+Infi >> 1i/(0+0i) > [1] NaN+Infi > > Interesting to see what R on Windows delivers. > > Berend Hasselman > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] pull stat out of summary
> On 01 Apr 2017, at 01:54 , Sarah Goslee wrote: > > The short answer is that hold isn't a list-like object, and $ only > works with list-like objects (lists and data frames, mainly). > > You can get the full explanation (VERY full), at > ?Extract > or any of its aliases, like > ?'$' > or > ?'[' > ...and the intermediate answer is: hold["Mean"] -pd > Sarah > > On Fri, Mar 31, 2017 at 7:11 PM, Evan Cooch wrote: >> Continuing my learning curve after 25_ years with using SAS. Want to pull >> the "Mean" forom the summary of something... >> >> test <- rnorm(1000,1.5,1.25) >> >> hold <- summary(test) >> >> names(hold) >> [1] "Min.""1st Qu." "Median" "Mean""3rd Qu." "Max." >> >> OK, so "Mean" is in there. >> So, is there a short form answer for why hold$Mean throws an error, and >> hold["Mean"} returns the mean (as desired)? >> >> Silly question I know, but gotta start somewhere... >> >> Thanks... >> > > -- > Sarah Goslee > http://www.functionaldiversity.org > > ______ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] The R-help community list was started on this day 20 years ago
Not fooling, no. However, r-help/r-announce/r-devel was a restructuring of the r-testers list. This goes back to March 20, 1996. The first archived post of r-testers is • just a test (the 'archiving' does not yet work) -->> Nr. 2 Martin Maechler so the actual start may have been a few days before. ... Incidentally, looking at the last posts of r-testers, it seems that CRAN turned 20 last week: Date: Wed, 26 Mar 1997 16:20:35 +0100 Message-Id: <199703261520.qaa08...@aragorn.ci.tuwien.ac.at> From: Kurt Hornik To: r-test...@stat.math.ethz.ch Subject: R-alpha: ANNOUNCE: CRAN This is a first (alpha) announcement for the Comprehensive R Archive Network (CRAN) project. ... -pd > On 02 Apr 2017, at 08:17 , John wrote: > > On Sat, 1 Apr 2017 11:19:07 -0700 > Henrik Bengtsson wrote: > >> Today, it is been 20 years since Martin Mächler started the R-help >> community list (https://stat.ethz.ch/pipermail/r-help/). The first >> post was written by Ross Ihaka on 1997-04-01: >> >> Subject: R-alpha: R-testers: pmin heisenbug >> From: Ross Ihaka >> When: Tue Apr 1 10:35:48 CEST 1997 >> Archive: https://stat.ethz.ch/pipermail/r-help/1997-April/001488.html >> >> This is a post about R's memory model. We're talking R v0.50 beta. I >> think that the paragraph at the end provides a nice anecdote on the >> importance not to be overwhelmed by problems ahead: >> >> "(The consumption of one cell per string is perhaps the major >> memory problem in R - we didn't design it with large problems in mind. >> It is probably fixable, but it will mean a lot of work)." >> >> We all know the story; an endless number of hours has been put in by >> many contributors throughout the years, making The R Project and its >> community the great experience it is today. >> >> Thank you! >> >> Henrik >> > No fooling? > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] The R-help community list was started on this day 20 years ago
> On 02 Apr 2017, at 14:53 , Spencer Graves > wrote: > > > > On 2017-04-02 4:10 AM, peter dalgaard wrote: >> Not fooling, no. >> >> However, r-help/r-announce/r-devel was a restructuring of the r-testers >> list. This goes back to March 20, 1996. The first archived post of r-testers >> is >> >> • just a test (the 'archiving' does not yet work) -->> Nr. 2 Martin >> Maechler >> >> so the actual start may have been a few days before. > > > So R was 11 when we celebrated its tenth birthday in Ames, Iowa, August > 8-10, 2007? No, but the R Core Team was formed in August 1997. The birthdate of R itself is not well-defined. It could be June 1995 (GPL release), August 1993 (Announcement on S-news), or some night at the Black Crow Cafe in Auckland in the early 90's. -pd > > > Best Wishes, > Spencer Graves >> >> ... >> >> Incidentally, looking at the last posts of r-testers, it seems that CRAN >> turned 20 last week: >> >> Date: Wed, 26 Mar 1997 16:20:35 +0100 >> Message-Id: <199703261520.qaa08...@aragorn.ci.tuwien.ac.at> >> From: Kurt Hornik >> To: r-test...@stat.math.ethz.ch >> >> Subject: R-alpha: ANNOUNCE: CRAN >> >> This is a first (alpha) announcement for the >> >> Comprehensive R Archive Network >> (CRAN) >> >> project. >> ... >> >> >> >> -pd >> >> >> >>> On 02 Apr 2017, at 08:17 , John wrote: >>> >>> On Sat, 1 Apr 2017 11:19:07 -0700 >>> Henrik Bengtsson wrote: >>> >>>> Today, it is been 20 years since Martin Mächler started the R-help >>>> community list (https://stat.ethz.ch/pipermail/r-help/). The first >>>> post was written by Ross Ihaka on 1997-04-01: >>>> >>>> Subject: R-alpha: R-testers: pmin heisenbug >>>> From: Ross Ihaka >>>> When: Tue Apr 1 10:35:48 CEST 1997 >>>> Archive: https://stat.ethz.ch/pipermail/r-help/1997-April/001488.html >>>> >>>> This is a post about R's memory model. We're talking R v0.50 beta. I >>>> think that the paragraph at the end provides a nice anecdote on the >>>> importance not to be overwhelmed by problems ahead: >>>> >>>> "(The consumption of one cell per string is perhaps the major >>>> memory problem in R - we didn't design it with large problems in mind. >>>> It is probably fixable, but it will mean a lot of work)." >>>> >>>> We all know the story; an endless number of hours has been put in by >>>> many contributors throughout the years, making The R Project and its >>>> community the great experience it is today. >>>> >>>> Thank you! >>>> >>>> Henrik >>>> >>> No fooling? >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] The R-help community list was started on this day 20 years ago
> On 02 Apr 2017, at 19:15 , Spencer Graves > wrote: > > > > On 2017-04-02 8:42 AM, peter dalgaard wrote: >>> On 02 Apr 2017, at 14:53 , Spencer Graves >>> wrote: >>> >>> >>> >>> On 2017-04-02 4:10 AM, peter dalgaard wrote: >>>> Not fooling, no. >>>> >>>> However, r-help/r-announce/r-devel was a restructuring of the r-testers >>>> list. This goes back to March 20, 1996. The first archived post of >>>> r-testers is >>>> >>>>• just a test (the 'archiving' does not yet work) -->> Nr. 2 Martin >>>> Maechler >>>> >>>> so the actual start may have been a few days before. >>> >>> So R was 11 when we celebrated its tenth birthday in Ames, Iowa, >>> August 8-10, 2007? >> No, but the R Core Team was formed in August 1997. >> >> The birthdate of R itself is not well-defined. It could be June 1995 (GPL >> release), August 1993 (Announcement on S-news), or some night at the Black >> Crow Cafe in Auckland in the early 90's. > > > The Wikipedia article on "S (programming language)" said it first > appeared in 1976 for the GCOS operating system. "In late 1979, S was ported > from GCOS to UNIX, which would become the new primary platform." I remember > using S or S-PLUS in the late 1980s, when it was only available for UNIX. In > the early 1990s, I got S-PLUS for Windows. I'm pretty sure S-PLUS was NOT > available for Macs in the late 1990s. Did anyone say that it was?? Anyways, as I recall it, part of the genesis of R was exactly that the Auckland computer labs were Mac-based and R&R wanted a mini-S to run on them. -pd > > > Spencer Graves >> >> -pd >> >>> >>> Best Wishes, >>> Spencer Graves >>>> ... >>>> >>>> Incidentally, looking at the last posts of r-testers, it seems that CRAN >>>> turned 20 last week: >>>> >>>> Date: Wed, 26 Mar 1997 16:20:35 +0100 >>>> Message-Id: <199703261520.qaa08...@aragorn.ci.tuwien.ac.at> >>>> From: Kurt Hornik >>>> To: r-test...@stat.math.ethz.ch >>>> >>>> Subject: R-alpha: ANNOUNCE: CRAN >>>> >>>> This is a first (alpha) announcement for the >>>> >>>>Comprehensive R Archive Network >>>>(CRAN) >>>> >>>> project. >>>> ... >>>> >>>> >>>> >>>> -pd >>>> >>>> >>>> >>>>> On 02 Apr 2017, at 08:17 , John wrote: >>>>> >>>>> On Sat, 1 Apr 2017 11:19:07 -0700 >>>>> Henrik Bengtsson wrote: >>>>> >>>>>> Today, it is been 20 years since Martin Mächler started the R-help >>>>>> community list (https://stat.ethz.ch/pipermail/r-help/). The first >>>>>> post was written by Ross Ihaka on 1997-04-01: >>>>>> >>>>>> Subject: R-alpha: R-testers: pmin heisenbug >>>>>> From: Ross Ihaka >>>>>> When: Tue Apr 1 10:35:48 CEST 1997 >>>>>> Archive: https://stat.ethz.ch/pipermail/r-help/1997-April/001488.html >>>>>> >>>>>> This is a post about R's memory model. We're talking R v0.50 beta. I >>>>>> think that the paragraph at the end provides a nice anecdote on the >>>>>> importance not to be overwhelmed by problems ahead: >>>>>> >>>>>> "(The consumption of one cell per string is perhaps the major >>>>>> memory problem in R - we didn't design it with large problems in mind. >>>>>> It is probably fixable, but it will mean a lot of work)." >>>>>> >>>>>> We all know the story; an endless number of hours has been put in by >>>>>> many contributors throughout the years, making The R Project and its >>>>>> community the great experience it is today. >>>>>> >>>>>> Thank you! >>>>>> >>>>>> Henrik >>>>>> >>>>> No fooling? >>>>> >>>>> __ >>>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. > -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R function stopped working
How about inserting print() statements on the output of "ls()" and the value of "filename". In particular, is the value of Plots_path the same as last week? -pd > On 4 Apr 2017, at 10:50 , DANIEL PRECIADO wrote: > > The following function is supposed to search the workspace and save > plots (i.e. listing all objects in the workspace named "Figs", which > are all ggplot2 plots, and saving them as png files) > > SaveFigs <- function() > { > for (i in ls(pattern="_Figs_")) > { > filename = paste(Plots_Path, i, ".png", sep="") > png(filename) > print(eval(as.name(i))) > dev.off() > } > } > > > It was working perfectly until some days ago, but now nothing happens > when the function is called. No error, no output, no result, no files, > nothing at all. Completely useless. > > If I run the for loop inside alone, without the function, it works > perfectly and produces the expected result (png files in the defined > folder). But running it as a function doesn't do anything at all. > > Can anyone explain why did this function simply and suddenly stopped > working? > > (using R version 3.3.3 on an ubuntu 16.10, if that is of any help) > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] R function stopped working
Given the following little experiment > foobar <- 1 > f <- function() ls() > f() character(0) > f <- function(x) ls() > f(2) [1] "x" > ... I am pretty sure that your code _never_ actually worked. It probably helps if you tell ls() which environment to list, as in: > f <- function() ls(.GlobalEnv) > f() [1] "f" "foobar" > On 4 Apr 2017, at 12:27 , DANIEL PRECIADO wrote: > > Thanks, but printing doesn't work within the function either. (i.e, no > result or output, or error). Also, like I said, the loop is working > fine on its own (so the path, name, filename, and all other variables > called from the function exist, are available and are recognized just > fine). It just doesn't do anything (anymore) if the loop is inside a > function. > > > On Tue, 2017-04-04 at 11:21 +0200, peter dalgaard wrote: >> How about inserting print() statements on the output of "ls()" and >> the value of "filename". In particular, is the value of Plots_path >> the same as last week? >> >> -pd >> >> >>> On 4 Apr 2017, at 10:50 , DANIEL PRECIADO >>> wrote: >>> >>> The following function is supposed to search the workspace and save >>> plots (i.e. listing all objects in the workspace named "Figs", >>> which >>> are all ggplot2 plots, and saving them as png files) >>> >>> SaveFigs <- function() >>> { >>> for (i in ls(pattern="_Figs_")) >>> { >>> filename = paste(Plots_Path, i, ".png", sep="") >>> png(filename) >>> print(eval(as.name(i))) >>> dev.off() >>> } >>> } >>> >>> >>> It was working perfectly until some days ago, but now nothing >>> happens >>> when the function is called. No error, no output, no result, no >>> files, >>> nothing at all. Completely useless. >>> >>> If I run the for loop inside alone, without the function, it works >>> perfectly and produces the expected result (png files in the >>> defined >>> folder). But running it as a function doesn't do anything at all. >>> >>> Can anyone explain why did this function simply and suddenly >>> stopped >>> working? >>> >>> (using R version 3.3.3 on an ubuntu 16.10, if that is of any help) >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-g >>> uide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Code to construct table with paired data
Here's one way: > ddw <- reshape(dd, direction="wide", idvar="pair", timevar="treatfac") > names(ddw) [1] "pair" "imprfac.A" "imprfac.B" > xtabs(~ imprfac.A + imprfac.B, ddw) imprfac.B imprfac.A + - + 1 3 - 2 1 (reshape() is a bit of a pain to wrap one's mind around; possibly, the tidyversalists can come up with something easier.) With a bit stronger assumptions on the data set (all pairs complete and in same order for both treatments), there is also > table(A=imprfac[treatfac=="A"], B=imprfac[treatfac=="B"]) B A + - + 1 3 - 2 1 > On 08 Apr 2017, at 13:16 , Mauricio Cardeal wrote: > > Hi! > > Is it possible to automatically construct a table like this: > > #treat B > # improvement > # + - > #treat A improvement + 1 3 > # - 2 1 > > From these data: > > pair <- c(1,1,2,2,3,3,4,4,5,5,6,6,7,7) # identification > treat <- c(1,0,1,0,1,0,1,0,1,0,1,0,1,0) # treatament 1 (A) or 0 (B) > impr <- c(1,0,1,0,1,0,0,1,0,1,0,0,1,1) # improvement 1 (yes) 0 (no) > > treatfac <- factor(treat) > levels(treatfac)<-list("A"=1,"B"=0 ) > imprfac <- factor(impr) > levels(imprfac)<-list("+"=1,"-"=0) > > data.frame(pair,treatfac,imprfac) > >pair treatfac imprfac > > 1 1 A + > 2 1 B - > 3 2 A + > 4 2 B - > 5 3 A + > 6 3 B - > 7 4 A - > 8 4 B + > 9 5 A - > 105 B + > 116 A - > 126 B - > 137 A + > 147 B + > > I tried some functions like table or even xtabs, but the results doesn't > show the pairs combinations. > > > Thanks in advance, > > > Maurício Cardeal > > Federal University of Bahia, Brazil > > > > > [[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. -- 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] Finding Infimum in R
Er, 1/3, of course? (assuming that F is f). The infimum of a set is not necessarily a member of the set. -pd > On 10 Apr 2017, at 16:56 , Boris Steipe wrote: > > Well - the _procedure_ will give a result. > > But think of f(x) = {-1; x <= 1/3 and 1; x > 1/3 > > What should inf{x| F(x) >= 0} be? > What should the procedure return? > > > > > >> On Apr 10, 2017, at 10:38 AM, Bert Gunter wrote: >> >> Given what she said, how does the procedure I suggested fail? >> >> (Always happy to be corrected). >> >> -- 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 Mon, Apr 10, 2017 at 1:57 AM, Boris Steipe >> wrote: >>> Are you sure this is trivial? I have the impression the combination of an >>> ill-posed problem and digital representation of numbers might just create >>> the illusion that is so. >>> >>> B. >>> >>> >>> >>> >>>> On Apr 10, 2017, at 12:34 AM, Bert Gunter wrote: >>>> >>>> Then it's trivial. Check values at the discontinuities and find the >>>> first where it's <0 at the left discontinuity and >0 at the right, if >>>> such exists. Then just use zero finding on that interval (or fit a >>>> line if everything's linear). If none exists, then just find the first >>>> discontinuity where it's > 0. >>>> >>>> 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 Sun, Apr 9, 2017 at 5:38 PM, li li wrote: >>>>> Hi Burt, >>>>> Yes, the function is monotone increasing and points of discontinuity are >>>>> all known. >>>>> They are all numbers between 0 and 1. Thanks very much! >>>>> Hanna >>>>> >>>>> >>>>> 2017-04-09 16:55 GMT-04:00 Bert Gunter : >>>>>> >>>>>> Details matter! >>>>>> >>>>>> 1. Are the points of discontinuity known? This is critical. >>>>>> >>>>>> 2. Can we assume monotonic increasing, as is shown? >>>>>> >>>>>> >>>>>> -- 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 Sun, Apr 9, 2017 at 1:28 PM, li li wrote: >>>>>>> Dear all, >>>>>>> For a piecewise function F similar to the attached graph, I would like >>>>>>> to >>>>>>> find >>>>>>> inf{x| F(x) >=0}. >>>>>>> >>>>>>> >>>>>>> I tried to uniroot. It does not seem to work. Any suggestions? >>>>>>> Thank you very much!! >>>>>>> Hanna >>>>>>> >>>>>>> __ >>>>>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>>>>> https://stat.ethz.ch/mailman/listinfo/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. -- 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] Sample size using residual standard deviation
Or power.t.test() -pd > On 12 Apr 2017, at 18:44 , Bert Gunter wrote: > > Search "sample size power" on rseek.org. Many useful hits, including > "samplesize" package. > > -- 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 Wed, Apr 12, 2017 at 9:32 AM, David Winsemius > wrote: >> >>> On Apr 12, 2017, at 3:20 AM, Jomy Jose wrote: >>> >>> In R how to calculate sample size,where power,residual standard deviation >>> and treatment difference is given.? >> >> Use the non-central t-distribution. The help page has further advice: >> >> ?pt >> >> >>> >>> [[alternative HTML version deleted]] >> >> Please read the Posting Guide before any further replies. >> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >> >> \/\/\/\/\/\/\/\/\/\/\/ >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> ^^ >>> and provide commented, minimal, self-contained, reproducible code. >> >> David Winsemius >> Alameda, CA, USA >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit
Um, tried help(.Rprofile) lately? -pd > On 17 Apr 2017, at 00:08 , Rolf Turner wrote: > > > On 17/04/17 08:46, John C Frain wrote: > >> Bruce >> >> The official documentation for these startup files can be obtained with >> the command >> >> Help(Startup) > > > Minor point of order, Mr. Chairman. That should be: > >help(Startup) > > There is (as far as I know) no such function as "Help()". It is important to > remember that R is case sensitive. > > Another point that is worthy of thought is "How in God's name would any > beginner know or find out about the usage help(Startup)?" Unless they were > explicitly told about it, in the manner which you just demonstrated. The > usage gets a mention in "An Introduction to R" --- but I had to search for it. > > To me the word "startup" is not terribly intuitive. I would tend to search > for "starting" rather than "startup", I think, but I'm not sure what the > average beginner would search for. A search of "An Introduction to R" for > "starting" gets seven or eight hits, one of which is relevant. So it all > takes patience and persistence. > > Also note that "An Introduction to R" mostly uses the word "startup" (lower > case "s") and only uses "Startup" twice. Note also that > >help(startup) > > fails. You have to get that initial "S" right. > > This isn't a criticism of the documentation. I'm just pointing out that > there are problems, mostly insoluble. Until some clever Johnny gets on with > developing that mind_read() function referred to in fortune(182). > > cheers, > > Rolf Turner > > -- > Technical Editor ANZJS > Department of Statistics > University of Auckland > Phone: +64-9-373-7599 ext. 88276 > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] Setting .Rprofile for RStudio on a Windows 7 x64bit
That was aimed at Rolf... For the actual question, I think the best approach would be to follow up on Bill Dunlap's suggestion. The mails from Jeff and Henrik pretty much tell you step by step what to try to find out which files on yours system are being checked in order to find startup code. -pd > On 17 Apr 2017, at 00:43 , BR_email wrote: > > Peter: > Thanks for reply and suggestion. > Sorry, I am not sure how to assess. > The doc is too technical for me to understand. > I found multiple instructions online and in R and RStudio books. > I'm doing what it says, but no success. > The instructions are simple as a-b-c, but some setting within the Windows > system must be the culprit. > > Regards, > Bruce > > Bruce Ratner, Ph.D. > The Significant Statistician™ > (516) 791-3544 > Statistical Predictive Analtyics -- www.DMSTAT1.com > Machine-Learning Data Mining and Modeling -- www.GenIQ.net > > peter dalgaard wrote: >> Um, tried help(.Rprofile) lately? >> >> -pd >> >>> On 17 Apr 2017, at 00:08 , Rolf Turner wrote: >>> >>> >>> On 17/04/17 08:46, John C Frain wrote: >>> >>>> Bruce >>>> >>>> The official documentation for these startup files can be obtained with >>>> the command >>>> >>>> Help(Startup) >>> >>> Minor point of order, Mr. Chairman. That should be: >>> >>>help(Startup) >>> >>> There is (as far as I know) no such function as "Help()". It is important >>> to remember that R is case sensitive. >>> >>> Another point that is worthy of thought is "How in God's name would any >>> beginner know or find out about the usage help(Startup)?" Unless they were >>> explicitly told about it, in the manner which you just demonstrated. The >>> usage gets a mention in "An Introduction to R" --- but I had to search for >>> it. >>> >>> To me the word "startup" is not terribly intuitive. I would tend to search >>> for "starting" rather than "startup", I think, but I'm not sure what the >>> average beginner would search for. A search of "An Introduction to R" for >>> "starting" gets seven or eight hits, one of which is relevant. So it all >>> takes patience and persistence. >>> >>> Also note that "An Introduction to R" mostly uses the word "startup" (lower >>> case "s") and only uses "Startup" twice. Note also that >>> >>>help(startup) >>> >>> fails. You have to get that initial "S" right. >>> >>> This isn't a criticism of the documentation. I'm just pointing out that >>> there are problems, mostly insoluble. Until some clever Johnny gets on >>> with developing that mind_read() function referred to in fortune(182). >>> >>> cheers, >>> >>> Rolf Turner >>> >>> -- >>> Technical Editor ANZJS >>> Department of Statistics >>> University of Auckland >>> Phone: +64-9-373-7599 ext. 88276 >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. > -- 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] Return value from function with For loop
in order to >> persist. Then there is the next level where you discover that there are >> exceptions to that rule: this levels is the level where you realize that >> the `for` function is different from most other R functions. It is really >> a side-effect-fucntion. The assignments made within its body actually >> persist in the global environment. AND it returns NULL. It shares this >> anomalous behavior with `while` and `repeat`.n Almost all functions are >> invoked with a possibly empty argument list. The next and break functions >> have implicit paired (empty) parentheses. >>>> >>>> (My personal opinion is that this is not adequately advertised. Perhaps >> it is an attempt to get people to migrate away from "Fortran-coding" >> behavior?) >>>> >>>> -- >>>> David. >>>> >>>> >>>>> >>>>> -Thanks, >>>>> Ramnik >>>>> >>>>> [[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. >>>> >>>> David Winsemius >>>> Alameda, CA, USA >>>> >>>> __ >>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>> https://stat.ethz.ch/mailman/listinfo/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. -- 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] Setting .Rprofile for RStudio on a Windows 7 x64bit
> On 17 Apr 2017, at 19:01 , BR_email wrote: > > Berend: Something looks good, but RStudio still Rprofile still doees not > affect the launch. > >> source(echo=TRUE, "C:/Users/BruceRatner/Documents/.Rprofile.site") >> options(prompt="R> ") > >> set.seed(12345) > >> rm(list=ls()) > > R> > > > Bruce Ratner, Ph.D. > The Significant Statistician™ > (516) 791-3544 > Statistical Predictive Analtyics -- www.DMSTAT1.com > Machine-Learning Data Mining and Modeling -- www.GenIQ.net > > Berend Hasselman wrote: >> source(echo=TRUE, ""C:/Users/BruceRatner/Documents/.Rprofile.site") > According to the gospel of St.Henrik, that filename is wrong, and possibly the directory too. So try his suggestions. What is the output (show us!) of normalizePath("./.Rprofile") normalizePath("~/.Rprofile") Assuming that the former is "C:/Users/BruceRatner/Documents/.Rprofile" you could try renaming the .Rprofile.site file to that. If need be, use file.rename, as in file.rename(from="C:/Users/BruceRatner/Documents/.Rprofile.site", to="C:/Users/BruceRatner/Documents/.Rprofile") (and restart, obviously). [I wouldn't set the seed in a .Rprofile file, nor would I use rm() there, but that is a different kettle of fish.] -- 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] A new -up?
I believe that the list maintainer is hunting this down. As I understood it, it was more due to incompetence than to actual malice. -pd > On 19 Apr 2017, at 09:48 , Rolf Turner wrote: > > > Now that this mailing list seems to have managed to eliminate the malign > influence of nabble, some clever Johnny seems to have come up with a new way > to cloud the lines of communication. I have started receiving r-help emails > from r-help-arch...@googlegroups.com. It seems > that one cannot reply to this address --- at least I can't. I tried a couple > of times and got bounces. > > However I just received from r-help@r-project.org a reply by Jeff Newmiller > to one of the posts that I received via "r-help-archive". So it seems that > *Jeff* can reply to these things. > > So am I doing something wrong, or is "r-help-archive" messing things up for > other people as well? And if the latter, can something be done to remove its > malign influence? > > cheers, > > Rolf Turner > > -- > Technical Editor ANZJS > Department of Statistics > University of Auckland > Phone: +64-9-373-7599 ext. 88276 > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] Wilcoxon Test
Also, as far as I know just for historical consistency, the test statistic in R is the rank sum of the first group MINUS its minimum possible value: W = 110.5 - sum(1:13) = 19.5 -pd > On 21 Apr 2017, at 14:54 , Achim Zeileis wrote: > > On Fri, 21 Apr 2017, Tripoli Massimiliano wrote: > >> Dear R users, >> Why the result of Wilcoxon sum rank test by R is different from sas >> >> https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_npar1way_sect022.htm >> >> The code is next: >> >> sampleA <- c(1.94, 1.94, 2.92, 2.92, 2.92, 2.92, 3.27, 3.27, 3.27, 3.27, >> 3.7, 3.7, 3.74) >> >> sampleB <- c(3.27, 3.27, 3.27, 3.7, 3.7, 3.74) >> wilcox.test(A,B,paired = F) > > There are different ways how to compute or approximate the asymptotic or > exact conditional distribution of the test statistic: > > SAS reports an asymptotic normal approximation (apparently without continuity > correction along with an asymptotic t approximation and the exact conditional > distribution. > > Base R's stats::wilcox.test can either report the exact conditional > distribution (but only if there are no ties) or the asymptotic normal > distribution (with or without continuity correction). In small samples the > default is to use the former but a warning is issued when there are ties (as > in your case). > > Furthermore, coin::wilcox_test can report either the asymptotic normal > distribution (without continuity correction) or the exact conditional > distribution (even in the presence of ties). > > Thus: > > ## collect data in data.frame > d <- data.frame( > y = c(sampleA, sampleB), > x = factor(rep(0:1, c(length(sampleA), length(sampleB > ) > > ## asymptotic normal distribution without continuity correction > ## (p = 0.0764) > stats::wilcox.test(y ~ x, data = d, exact = FALSE, correct = FALSE) > coin::wilcox_test(y ~ x, data = d, distribution = "asymptotic") > > ## exact conditional distribution (p = 0.1054) > coin::wilcox_test(y ~ x, data = d, distribution = "exact") > > These match SAS's results. The default result of stats::wilcox.test is > different as explained by the warning issued. > > hth, > Z > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R 3.4.0 is released
The build system rolled up R-3.4.0.tar.gz (codename "You Stupid Darkness") this morning. The list below details the changes in this release. You can get the source code from http://cran.r-project.org/src/base/R-3/R-3.4.0.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Binaries for various platforms will appear in due course. For the R Core Team, Peter Dalgaard These are the checksums (md5 and SHA-256) for the freshly created files, in case you wish to check that they are uncorrupted: MD5 (AUTHORS) = f12a9c3881197b20b08dd3d1f9d005e6 MD5 (COPYING) = eb723b61539feef013de476e68b5c50a MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343 MD5 (FAQ) = 0c53e7275ad2057cdc60448f4a71f354 MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b MD5 (NEWS) = ea102623c183b5b8ad93306db6a4f6b6 MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8 MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801 MD5 (NEWS.2) = 71562183d75dd2080d86c42bbf733bb7 MD5 (R-latest.tar.gz) = 75083c23d507b9c16d5c6afbd7a827e7 MD5 (README) = f468f281c919665e276a1b691decbbe6 MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435 MD5 (THANKS) = f60d286bb7294cef00cb0eed4052a66f MD5 (VERSION-INFO.dcf) = 7a8c309440689143c16e8586128523e8 MD5 (R-3/R-3.4.0.tar.gz) = 75083c23d507b9c16d5c6afbd7a827e7 6474d9791fff6a74936296bde3fcb569477f5958e4326189bd6e5ab878e0cd4f AUTHORS e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4 COPYING 6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3 COPYING.LIB 33bd1a8295b3af3e2e8b77c870799e991ced02356df50469b2e688b3cc593ebc FAQ f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31 INSTALL 1798e1bb08e63dca195970600b107e4d6d5a07135da5bec9bcbe16a9c0f408db NEWS 4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62 NEWS.0 12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01 NEWS.1 a10f84be31f897456a31d31690df2fdc3f21a197f28b4d04332cc85005dcd0d2 NEWS.2 288e9ed42457c47720780433b3d5c3c20983048b789291cc6a7baa11f9428b91 R-latest.tar.gz 2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc README 408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9 RESOURCES 52f934a4e8581945cbc1ba234932749066b5744cbd3b1cb467ba6ef164975163 THANKS 2613962d473138a6ddbd10949fff9dfa61160ce6c64b7b2808172857bdd62527 VERSION-INFO.dcf 288e9ed42457c47720780433b3d5c3c20983048b789291cc6a7baa11f9428b91 R-3/R-3.4.0.tar.gz This is the relevant part of the NEWS file CHANGES IN R 3.4.0: SIGNIFICANT USER-VISIBLE CHANGES: * (Unix-alike) The default methods for download.file() and url() now choose "libcurl" except for file:// URLs. There will be small changes in the format and wording of messages, including in rare cases if an issue is a warning or an error. For example, when HTTP re-direction occurs, some messages refer to the final URL rather than the specified one. Those who use proxies should check that their settings are compatible (see ?download.file: the most commonly used forms work for both "internal" and "libcurl"). * table() has been amended to be more internally consistent and become back compatible to R <= 2.7.2 again. Consequently, table(1:2, exclude = NULL) no longer contains a zero count for , but useNA = "always" continues to do so. * summary.default() no longer rounds, but its print method does resulting in less extraneous rounding, notably of numbers in the ten thousands. * factor(x, exclude = L) behaves more rationally when x or L are character vectors. Further, exclude = now behaves as documented for long. * Arithmetic, logic (&, |) and comparison (aka 'relational', e.g., <, ==) operations with arrays now behave consistently, notably for arrays of length zero. Arithmetic between length-1 arrays and longer non-arrays had silently dropped the array attributes and recycled. This now gives a warning and will signal an error in the future, as it has always for logic and comparison operations in these cases (e.g., compare matrix(1,1) + 2:3 and matrix(1,1) < 2:3). * The JIT ('Just In Time') byte-code compiler is now enabled by default at its level 3. This means functions will be compiled on first or second use and top-level loops will be compiled and then run. (Thanks to Tomas Kalibera for extensive work to make this possible.) For now, the compiler will not compile code containing explicit calls to browser(): this is to support single stepping from the browser() call. JIT compilation can be disabled for the rest of the session using compiler::enableJIT(0) or by setting environment variable R_ENABLE_JIT to 0. * xtabs() works more consistently with NAs, also in its result no longer setting them to 0. Further, a new logical option addNA allows to count
Re: [R] Looking for a package to replace xtable
g -- www.GenIQ.net >>> >>> >>> >>>> On Apr 21, 2017, at 4:25 PM, Bruce Ratner PhD wrote: >>>> >>>> David: >>>> Response=rbinom(50,1,0.2), and yhat=runif(50) are simulating the output of >>>> a say logistic model, where Response is actual 0-1 responses, and yhat is >>>> the predicted >>>> response variable. >>>> I usually resample the original data to get some noise out of the data. I >>>> find it valuable if I can resample from a large sample than the original. >>>> (I know this is viewed by some as unorthodox.) >>>> >>>> Your point: I only need Response as a column vector. >>>> That said, what would you alter, please? >>>> Thanks for your time. >>>> Regards, >>>> Bruce >>>> >>>> __ >>>> Bruce Ratner PhD >>>> The Significant Statistician™ >>>> (516) 791-3544 >>>> Statistical Predictive Analytics -- www.DMSTAT1.com >>>> Machine-Learning Data Mining -- www.GenIQ.net >>>> >>>> >>>> >>>>> On Apr 21, 2017, at 3:43 PM, David L Carlson wrote: >>>>> >>>>> You have an issue at the top with >>>>> >>>>> Resp <- data.frame(Response=rbinom(50,1,0.2), yhat=runif(50)) >>>>> Resp <- Resp[order(Response$yhat,decreasing=TRUE),] >>>>> >>>>> Since Response$yhat has not been defined at this point. Presumably you >>>>> want >>>>> >>>>> Resp <- Resp[order(Resp$yhat,decreasing=TRUE),] >>>>> >>>>> The main issue is that you have a variable Response that is located in a >>>>> data frame called ResponseX10. >>>>> >>>>> In creating cum_R you need >>>>> >>>>> cum_R<- with(ResponseX10, cumsum(Response)) >>>>> >>>>> then dec_mean >>>>> >>>>> dec_mean <- with(ResponseX10, aggregate(Response, by=list(decc), mean)) >>>>> >>>>> then dd >>>>> >>>>> dd <- with(ResponseX10, cbind(Response, dd_)) >>>>> >>>>> >>>>> You might consider if Response really needs to be inside a data frame >>>>> that consists of a single column (maybe you do if you need to keep track >>>>> of the row numbers). If you just worked with the vector Response, you >>>>> would not have to use with() or attach(). >>>>> >>>>> I'm not sure what the first few lines of your code are intended to do. >>>>> You choose random binomial values and uniform random values and then >>>>> order the first by the second. But rbinom() is selecting random values so >>>>> what is the purpose of randomizing random values? If the real data >>>>> consist of a vector of 1's and 0's and those need to be randomized, >>>>> sample(data) will do it for you. >>>>> >>>>> Then those numbers are replicated 10 times. Why not just select 500 >>>>> values using rbinom() initially? >>>>> >>>>> >>>>> David C >>>>> >>>>> >>>>> -Original Message- >>>>> From: BR_email [mailto:b...@dmstat1.com] >>>>> Sent: Friday, April 21, 2017 1:22 PM >>>>> To: David L Carlson ; r-help@r-project.org >>>>> Subject: Re: [R] Looking for a package to replace xtable >>>>> >>>>> David: >>>>> I tried somethings and got a little more working. >>>>> Now, I am struck at last line provided: "dec_mean<- >>>>> aggregate(Response ~ decc, dd, mean)" >>>>> Any help is appreciated. >>>>> Bruce >>>>> >>>>> * >>>>> Resp <- data.frame(Response=rbinom(50,1,0.2), yhat=runif(50)) >>>>> Resp <- Resp[order(Response$yhat,decreasing=TRUE),] >>>>> >>>>> ResponseX10<- do.call(rbind, replicate(10, Resp, simplify=FALSE)) >>>>> str(ResponseX10) >>>>> >>>>> ResponseX10<- ResponseX10[order(ResponseX10$yhat,decreasing=TRUE),] >>>>> >>>>> str(ResponseX10) >>>>> head(ResponseX10) >>>>> >>>>> ResponseX10[[2]] <- NULL >>>>> ResponseX10 <- data.frame(ResponseX10) >>>>> str(ResponseX10) >>>>> >>>>> cum_R<- cumsum(Response) >>>>> cum_R >>>>> >>>>> sam_size <- n >> > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Interesting quirk with fractions and rounding / using == for floating point
> On 23 Apr 2017, at 14:49 , J C Nash wrote: > > > So equality in floating point is not always "wrong", though it should be used > with some attention to what is going on. > > Apologies to those (e.g., Peter D.) who have heard this all before. I suspect > there are many to whom it is new. Peter D. still insists on never trusting exact equality, though. There was at least one case in the R sources where age-old code got itself into a condition where a residual terme that provably should decrease on every iteration oscillated between two values of 1-2 ulp in magnitude without ever reaching 0. The main thing is that you cannot trust optimising compilers these days. There is, e.g., no guarantee that a compiler will not transform (x_new + offset) == (x_old + offset) to (x_new + offset) - (x_old + offset) == 0 to (x_new - x_old) + (offset - offset) == 0 to well, you get the point. -pd -- 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] Error with installed.packages with R 3.4.0 on Windows
Yes, we noticed this in the last days of the code freeze before release and shied away from inserting a workaround, partly because we couldn't see what the root of the problem might be. For the purposes of installed.packages it is relatively harmless to treat the NA condition as FALSE, since it is just a matter of whether a cache is valid. I.e., it might cause an unnecessary cache rebuild. For other situations it might be more of an issue. The workaround (NA -> FALSE, basically) is in place in R-patched and R-devel. -pd > On 28 Apr 2017, at 07:47 , Thierry Onkelinx wrote: > > We have several computers with the same problem. > > Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut" : > > Hello, > > I am currently getting a strange error when I call installed.packages(): > > Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) && : > missing value where TRUE/FALSE needed > Calls: installed.packages > > > I am working with R 3.4.0 on Windows. I didn't get this error with R 3.3.3. > Apparently, file.mtime() is returning NA well applied to a directory, and > this causes the entire && expression to be NA, then the "if" fails because > it needs either T or F. > The source of "installed.packages" seems to be roughly the same as in R > 3.3.3, so I wonder if there have been other changes in R, maybe the logical > operators, that would make this function fail. > > Any idea? > > Best regards, > > Jean-Claude Arbaut > >[[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. -- 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] Error with installed.packages with R 3.4.0 on Windows
> On 28 Apr 2017, at 12:08 , Duncan Murdoch wrote: > > On 28/04/2017 4:45 AM, Thierry Onkelinx wrote: >> Dear Peter, >> >> It actually breaks install.packages(). So it is not that innocent. > > I don't think he meant that it is harmless, he meant that the fix is easy, > and is in place in R-patched and R-devel. You should use R-patched and you > won't have the problem. Read more carefully: I said that the _fix_ is harmless for this case, but might not be so in general. -pd > > More generally, there's a lot more variety of systems in the wild than on our > test machines, so we really do rely on people testing things in the > alpha/beta/rc phase. In this case we saw the error too late to fix it (as I > recall, it was very late in rc). If more people had tested, we might have > found it earlier. > > Duncan Murdoch > >> >> Best regards, >> >> Thierry >> >> >> Op 28 apr. 2017 10:36 a.m. schreef "peter dalgaard" : >> >> Yes, we noticed this in the last days of the code freeze before release and >> shied away from inserting a workaround, partly because we couldn't see what >> the root of the problem might be. >> >> For the purposes of installed.packages it is relatively harmless to treat >> the NA condition as FALSE, since it is just a matter of whether a cache is >> valid. I.e., it might cause an unnecessary cache rebuild. For other >> situations it might be more of an issue. >> >> The workaround (NA -> FALSE, basically) is in place in R-patched and >> R-devel. >> >> -pd >> >>> On 28 Apr 2017, at 07:47 , Thierry Onkelinx >> wrote: >>> >>> We have several computers with the same problem. >>> >>> Op 28 apr. 2017 7:25 a.m. schreef "Jean-Claude Arbaut" >> : >>> >>> Hello, >>> >>> I am currently getting a strange error when I call installed.packages(): >>> >>> Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) && : >>> missing value where TRUE/FALSE needed >>> Calls: installed.packages >>> >>> >>> I am working with R 3.4.0 on Windows. I didn't get this error with R >> 3.3.3. >>> Apparently, file.mtime() is returning NA well applied to a directory, and >>> this causes the entire && expression to be NA, then the "if" fails because >>> it needs either T or F. >>> The source of "installed.packages" seems to be roughly the same as in R >>> 3.3.3, so I wonder if there have been other changes in R, maybe the >> logical >>> operators, that would make this function fail. >>> >>> Any idea? >>> >>> Best regards, >>> >>> Jean-Claude Arbaut >>> >>> [[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. >> >> -- >> 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 >> >> [[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. -- 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] how to assign a value to a specific position of a list
assign(paste("list_", i, "[[1]]", sep = ""), 5) creates a new variable with a funny name. You'd have to parse() and eval() to make that work, something like eval(parse(text=paste("list_",i,"[[1]]<-",5, sep=""))) However, --- > fortunes::fortune("parse") If the answer is parse() you should usually rethink the question. -- Thomas Lumley R-help (February 2005) --- It is much easier to handle this using a data structure containing a list of lists: l <- rep(list(list()), 10) for ( i in 1:10 ) l[[i]][[1]] <- 5 > On 30 Apr 2017, at 17:17 , Jinsong Zhao wrote: > > Hi there, > > I have a problem with assign(). Here is the demo code: > > for (i in 1:10) { > # create a list with variable name as list_1, list_2, ..., etc. > assign(paste("list_", i, sep = ""), list()) > # I hope to assign 5 to list_?[[1]], but I don't know how to code it. > # list_1[[1]] <- 5 # works, however > assign(paste("list_", i, "[[1]]", sep = "", 5) # does not work > } > > How to do? Is there any alternatives? Many thanks! > > Best, > Jinsong > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- 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] Lattice xyplot
> On 1 May 2017, at 17:59 , Bert Gunter wrote: > > (Too trivial for the list) ...so you decided to include us only once? >;-) -pd > > I debated saying something similar but decided not to, as polygons can > be drawn e.g. via panel.polygon. > > Cheers, > Bert > > > > > On Mon, May 1, 2017 at 8:25 AM, Jeff Newmiller > wrote: >> It is not a question of whether lattice "understands" the unsorted data... >> imagine trying to plot 4 points to form a square instead of a trend line... >> you would NOT want lattice to sort those points for you. That lattice leaves >> your data alone gives you more flexibility, even while it adds work for >> certain applications. >> >> -- >> Sent from my phone. Please excuse my brevity. >> >> On May 1, 2017 7:34:09 AM PDT, Bert Gunter wrote: >>> Yes. type = "l" connects the points in the order given in the data, so >>> if the x's are not already ordered, the plots will be different after >>> ordering the x's. >>> >>> e.g. >>> >>>> x <- c(3,1,2,4,6,5) >>>> y <- 11:16 >>>> xyplot(y~x. type = "l") >>> >>> >>> As for why ... that's just the way it was designed. You can always >>> order the data first, if you don't want this default. >>> >>> 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 Sun, Apr 30, 2017 at 6:07 PM, array chip via R-help >>> wrote: >>>> Dear all, I am new to lattice, so would appreciate anyone's help on >>> the questions below. I am using xyplot to plot some trend in my >>> dataset. Using the example dataset attached, I am trying to plot >>> variable "y" over variable "time" for each subject "id": >>>> dat<-read.table("dat.txt",sep='\t',header=T,row.names=NULL) >>>> xyplot(y ~ time, data=dat, groups=id, aspect = "fill", type = c("p", >>> "l"), xlab = "Time", ylab = "Y") >>>> >>>> It appears that it just worked fine. But if I sort the "dat" first, >>> the plot will look somewhat different! >>>> dat<-dat[order(dat$id, dat$time),]xyplot(y ~ time, data=dat, >>> groups=id, aspect = "fill", type = c("p", "l"), xlab = "Time", ylab = >>> "Y") >>>> Why is that? Do you need to sort the data first before using xyplot? >>> Why xyplot can not understand the dataset unless it is sorted first? >>>> Thanks, >>>> John >>>> __ >>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Perfect prediction of AR1 series using package dlm, posted on stack exchange
I am not an expert on dlm, but it seems to me that you are getting perfect _filtering_ not _prediction_. If you cast an AR model as a state space model, there is no measurement error on the state values, hence the conditional distribution of theta_t given y_t is just the point value of y_t... -pd > On 4 May 2017, at 12:05 , Ashim Kapoor wrote: > > Dear all, > > I have made a dlm model,where I am getting a perfect prediction. > > Here is a link to the output: > > http://pasteboard.co/9IxVQwjm6.png > > The query and code is on: > > https://stats.stackexchange.com/questions/276449/perfect-prediction-in-case-of-a-univariate-ar1-model-using-dlm > > Can someone here be kind enough to answer my query? > > Best Regards, > Ashim > > [[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. -- 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] Mac-specific encoding bug
> On 7 May 2017, at 08:36 , Oliver Keyes wrote: > > Hey all, > > I've ran into a weird quirk on Mac platforms, which you can read fully > at https://github.com/Ironholds/urltools/issues/70 > > The long and the short of it is that one specific codepoint - \u04cf - > does not print in a UTF-8-y way by default, except when run through > cat(). Compare, for example: > > encodeString("\u04cf") > > and: > > encodeString("\u044D") > > Kevin Ushey was kind enough to bring his expertise, and found that it > may be a locale-specific problem as well as a Mac-specific problem, > because 'sourcetools' shows that there's no locale information for the > character. But this only appears in R - Python has it display > perfectly - so I'm kind of at a loss. Does anyone know what's going > on? Python being less careful than R? Basically, things get encoded if not known to be printable, and "Cyrillic Small Letter Palochka" is (it seems) not recorded as printable in the common utf-8 locales. From what I can google, it is used in Chechen and even then only as a postfix to certain characters. -- 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] Copy and Rename Folder in same directory
> On 8 May 2017, at 13:54 , Duncan Murdoch wrote: > > On 08/05/2017 7:12 AM, Archit Soni wrote: >> Hey Duncan, >> >> There are no sub folders in the folder which its content i want to copy. >> Just 4 files. > > Okay, so you won't need "recursive = TRUE". Um, wouldn't it work just to do file.copy(old.folder, new.folder, recursive=TRUE) Otherwise, I suspect you need to ensure that the destination exists: dir.create(new.folder) file.copy(list.of.files, new.folder) -pd > >> >> list.files('Old Folder Path') gives me the files in this folder. > > That's not the same as you typed below. In the script below, does > list.of.files contain the right names, with fully specified paths? > >> >> I am running this line that gives me False when running for all the 4 files >> >> file.copy(list.files(oldFolder),newFolder,recursive = TRUE) > > The lack of full.names could cause the problem here, if that's not just a > typo in this message. > > Duncan Murdoch > > >> >> >> >> On Mon, May 8, 2017 at 4:36 PM, Duncan Murdoch > <mailto:murdoch.dun...@gmail.com>> wrote: >> >>On 08/05/2017 6:59 AM, Archit Soni wrote: >> >>Hey Ben, >> >>I tried this, >> >># identify the folders >>current.folder <- "C:/Where my files currently live" >>new.folder <- "H:/Where I want my files to be copied to" >> >># find the files that you want >>list.of.files <- list.files(current.folder, >>"SDM\\.tif$",full.names=T) >> >># copy the files to the new folder >>file.copy(list.of.files, new.folder) >> >>But i am still getting FALSE and files are not getting copied >>from the >>folder. However,if I give a single file name it copies that file >>to new >>folder. >> >>Any thoughts ? >> >> >>Getting FALSE where? >> >>Does list.of.files look right? >> >>If it contains any directories, you'll want "recursive = TRUE" in >>file.copy(). >> >>Duncan Murdoch >> >> >> >> >> -- >> Regards >> Archit > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Factors and Alternatives
Inline... > On 9 May 2017, at 12:12 , g.maub...@weinwolf.de wrote: > > Hi All, > > I am using factors in a study for the social sciences. > > I discovered the following: > > -- cut -- > > library(dplyr) > > test1 <- c(rep(1, 4), rep(0, 6)) > d_test1 <- data.frame(test) > > test2 <- factor(test1) > d_test2 <- data.frame(test2) > > test3 <- factor(test1, >levels = c(0, 1), >labels = c("WITHOUT Contact", "WITH Contact")) > d_test3 <- data.frame(test3) > > d_test1 %>% filter(test1 == 0) # works OK > d_test2 %>% filter(test2 == 0) # works OK > d_test3 %>% filter(test3 == 0) # does not work, why? > test3 does not have a level 0. You want test3 == "WITHOUT Contact" Notice that once test3 is created, the input levels are lost, and thus "test3 == 0" becomes meaningless. -pd > myf <- function(ds) { > print(levels(ds$test3)) > print(labels(ds$test3)) > print(as.numeric(ds$test3)) > print(as.character(ds$test3)) > } > > # This showsthat it is not possible to access the original > # values which were the basis to build the factor: > myf(d_test3) > > -- cut -- > > Why is it not possible to use a factor with labels for filtering with the > original values? > Is there a data structure that works like a factor but gives also access > to the original values? > > Kind regards > > Georg > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Generating samples from truncated multivariate Student-t distribution
It's not obvious to me that that marginal distribution of one component of a multivariate truncated t is the corresponding univariate truncated t. In fact, I would expect it to differ because of tail-dependence effects, e.g. > r <- rtmvt(1e5, c(30,0), diag(2), lower=c(29,-Inf), upper=c(31, +Inf), df=4) > sd(r[,2]) [1] 1.191654 > r <- rtmvt(1e5, c(30,0), diag(2), lower=c(35,-Inf), upper=c(37, +Inf), df=4) > sd(r[,2]) [1] 3.504233 -pd > On 9 May 2017, at 19:09 , Czarek Kowalski wrote: > > Dear Members, > I am working with 6-dimensional Student-t distribution with 4 degrees > of freedom truncated to [20; 60]. I have generated 100 000 samples > from truncated multivariate Student-t distribution using rtmvt > function from package ‘tmvtnorm’. I have also calculated mean vector > using equation (3) from attached pdf. The problem is, that after > summing all elements in one column of rtmvt result (and dividing by > 100 000) I do not receive the same result as using (3) equation. Could > You tell me, what is incorrect, why there is a difference? > Yours faithfully > Czarek Kowalski > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error: invalid type (closure) for the variable 'time' - object specific trend
; When I do this regression I will get the original error: "invalid type >>> (closure) for the variable 'time' - object specific trend" >>> >>> With the notation"time" not my colum is meant, but probably the command >>> "time" in R. >>> >>> Can you follow my thoughts? >>> >>> Tobi >>> >>> >>> >>> >>> >>> >>> Am 11.05.2017 um 17:23 schrieb Duncan Murdoch: >>>> Duncan Murdoch >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/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. >> > > > [[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. -- 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] Error: invalid type (closure) for the variable 'time' - object specific trend
> On 14 May 2017, at 10:22 , Tobias Christoph wrote: > > Hey David, > > when I used your suggested formula: plm( log(revenue) ~ log(supply) + > factor(town) + as.numeric(as.character(year)), data=R_Test_log_Neu) I will > get the same results as without considering town and year in the formula. So > this might not the clue for taking into account a linear trend. You probably still want a "*" in the model formula. (It is not obvious to me why a plain factor(town)*year term does not work, something in the panel data frame setup auto-converts it to a factor? But why do you need to say factor(town) then?) -pd > > Please find attached the results of str(R_Test_log_Neu): > > Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 132 obs. of 4 variables: > $ town : num 1 1 1 1 1 1 1 1 1 1 ... > $ year : num 1 2 3 4 5 6 7 8 9 10 ... > $ revenue: num 39.9 43.3 44 43.2 39.1 ... > $ supply : num 1 1 1 1 1 1 35 101 181 323 ... > > > > Hope this is helpful. > > Toby > > > > Am 13.05.2017 um 16:40 schrieb David Winsemius: >>> On May 13, 2017, at 4:07 AM, Tobias Christoph >>> wrote: >>> >>> Hey Peter, >>> >>> thank you. Yes, I want to have "year" in the varibale. >>> But if I use "*town*year*" as a furmula, R will create new factor >>> variable with n levels, where n = (num of towns) x (num of years). What >>> I'm trying to do is create 50 (town x year) variables such that >>> town1xyear is 1,2,3... when town== 1 and zero otherwise, repeat for >>> town2xyear, where state == 2, etc. >>> >>> It is now clear? Sorry for my bad explanations. >>> >> I had suggested that you must provide str(R_Test_log_Neu). I'm still >> suggesting this would be a good idea. >> >> Since you have not done so, we can only guess at the right course to follow >> from your reports of problems and errors. Peter pointed out that the `time` >> function was in the 'stats' package (not from plm or elsewhere as I >> imagined). You are implying that 'year' is currently a factor value with >> levels that appears as the character versions of integers. >> >> You may be able to get closer to what is possible by using: >> >> plm( log(revenue) ~ log(supply) + factor(town) + >> as.numeric(as.character(year)), >> data=R_Test_log_Neu) >> >> This should fix the problem noted by Peter and avoid the potentially >> incorrect construction of the desired linear trend. >> >> If you used the interaction operator "*" between 'town' and the numeric >> version of 'year' it will give you two sets of coefficients involving >> 'town'. The first set will be the mean deviations from the base factor >> level. The other set will be the differences in slopes for the time trends >> for each of the (factored) towns from the overall time trend/slope. And for >> your data you wouldbe constructing a saturated model ... as you observed in >> your first message (which remains in the copied thread below). >> >> > -- 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] Tukey tests in two-way ANOVA
I think you forgot to turn site and year into factors. (The 1 Df is the giveaway). -pd > On 15 May 2017, at 19:40 , Lucy McMahon wrote: > > R-help: > > I'm looking into the abundance of an algal species over site and years using > a two-way ANOVA: > >> summary (aov (fserratus ~ site+year)) >Df Sum Sq Mean Sq F value Pr(>F) > site 1 1487 1486.6 6.094 0.0155 * > year 1 1173 1172.8 4.808 0.0309 * > > But I'm receiving the following warning messages when I run the Tukey test. >> TukeyHSD(aov(fserratus ~ site+year)) > > $site >diff lwr upr > p adj > 1-0 -8.039565 -14.51045 -1.5686850.0154723 > > Warning messages: > 1: In replications(paste("~", xx), data = mf) : non-factors ignored: year > 2: In TukeyHSD.aov(aov(fserratus ~ site + year)) : > 'which' specified some non-factors which will be dropped > > > Any advice would be appreciated, thanks. > > > > > [[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. -- 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] plot problems
> On 16 May 2017, at 02:05 , Duncan Murdoch wrote: > > On 15/05/2017 4:15 PM, sylvie.celer...@free.fr wrote: >> Hello all, >> I'm using RStudio Version 1.0.136 on wondow 7 (64 bite) and I can't >> understand why all my plots are displayed ouside of the Rstudio graphic >> pane. How can I make them go back to the graphic panes ? > > This is a question for RStudio, and should be asked in one of their help > forums. This mailing list is for R itself. Yes. However, if you explicitly start a graphics window device (e.g. quartz() on Macs & I expect windows() on Windows), then that might behave completely ignorant of the fact that you are running RStudio. Also check ?Devices for info on getOption("device"). -pd -- 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] R-3.4.0 fails test
> On 17 May 2017, at 12:31 , Henric Winell wrote: > > On 2017-05-17 09:42, Patrick Connolly wrote: > >> After installing R-3.4.0 I ran 'make check' which halted here: >> $ > tail reg-tests-1d.Rout.fail -n 16 > > This problem was brought up on the R-devel list early this morning. See > https://stat.ethz.ch/pipermail/r-devel/2017-May/074275.html Looks like that one is not the same, occurring a handful of lines further up. Anyways, you might want to a) move the discussion to R-devel b) include your platform (hardware, OS) and time zone info c) run the offending code lines "by hand" and show us the values of format(dlt) and format(dct) so we can see what the problem is, something like dlt <- structure( list(sec = 52, min = 59L, hour = 18L, mday = 6L, mon = 11L, year = 116L, wday = 2L, yday = 340L, isdst = 0L, zone = "CET", gmtoff = 3600L), class = c("POSIXlt", "POSIXt"), tzone = c("", "CET", "CEST")) dlt$sec <- 1 + 1:10 dct <- as.POSIXct(dlt) cbind(format(dlt), format(dct)) -pd > Henric Winell > > > > >>> ## format()ing invalid hand-constructed POSIXlt objects >>> d <- as.POSIXlt("2016-12-06"); d$zone <- 1 >>> tools::assertError(format(d)) >>> d$zone <- NULL >>> stopifnot(identical(format(d),"2016-12-06")) >>> d$zone <- "CET" # = previous, but 'zone' now is last >>> tools::assertError(format(d)) >>> dlt <- structure( >> + list(sec = 52, min = 59L, hour = 18L, mday = 6L, mon = 11L, year = >> 116L, >> + wday = 2L, yday = 340L, isdst = 0L, zone = "CET", gmtoff = 3600L), >> + class = c("POSIXlt", "POSIXt"), tzone = c("", "CET", "CEST")) >>> dlt$sec <- 1 + 1:10 # almost three hours & uses re-cycling .. >>> fd <- format(dlt) >>> stopifnot(length(fd) == 10, identical(fd, format(dct <- as.POSIXct(dlt >> Error: identical(fd, format(dct <- as.POSIXct(dlt))) is not TRUE >> Execution halted >> ... so, of course, the remaining tests aren't done. >> AFAICT, that test will fail anywhere outside of tzone CET, but I could >> be missing something. >> What is the point of this test and is there a better way to move on to >> the remaining tests besides editing the corresponding .R file? >> Changing the line >>> stopifnot(length(fd) == 10, identical(fd, format(dct <- as.POSIXct(dlt >> to >>> stopifnot(length(fd) == 10, identical(fd, format(dct <- as.POSIXlt(dlt)))) >> >> would pass. But would that be any use? >> TIA >> (Linux Mint 17.3) >> > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [FORGED] Logical Operators' inconsistent Behavior
> On 19 May 2017, at 14:24 , Jérémie Juste wrote: > > My apologies if I was not clear enough, > > TRUE & NA could be either TRUE or FALSE and consequently is NA. > why is FALSE & NA = FALSE? NA could be TRUE or FALSE, so FALSE & NA > should be NA? > At the risk of flogging a dead horse: FALSE & TRUE = FALSE FALSE & FALSE = FALSE FALSE & x = FALSE, whatever the value of x, hence FALSE & NA = FALSE Get it? -pd > > On Fri, May 19, 2017 at 2:13 PM, Rolf Turner > wrote: > >> On 20/05/17 00:01, Jérémie Juste wrote: >> >>> Hello, >>> >>> Rolf said, >>> >>> TRUE & FALSE is FALSE but TRUE & TRUE is TRUE, so TRUE & NA could be >>> either TRUE or FALSE and consequently is NA. >>> >>> OTOH FALSE & (anything) is FALSE so FALSE & NA is FALSE. >>> >>> >>> According to this logic why is >>> >>>FALSE & NA >>> >>> [1] FALSE >>> >> >> Huh >> >> >> cheers, >> >> Rolf Turner >> >> -- >> Technical Editor ANZJS >> Department of Statistics >> University of Auckland >> Phone: +64-9-373-7599 ext. 88276 >> > > > > -- > Jérémie Juste > > [[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. -- 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] modulus operator?
Or maybe Mod(), but please, Heidi, don't expect the rest of the world to guess your intentions like that... -pd > On 21 May 2017, at 10:27 , Jim Lemon wrote: > > Hi Heidi, > I think you are looking for the %% operator. See the Arithmetic help > page in the base package. > > Jim > > On Sun, May 21, 2017 at 10:28 AM, McGann, Heidi wrote: >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with system.file
> On 22 May 2017, at 14:43 , Pau Marc Muñoz Torres wrote: > > Hello everybody > > I am trying to use system.file but it returns not file found > > what I have done is > >> sample <- system.file("results.xlsx","estdata", package = > "readxl",mustWork = TRUE) > Error in system.file("results.xlsx", "estdata", package = "readxl", > mustWork = TRUE) : > no file found > > i have checked the path was correct and the file exists with > > FILES <- file.path("results.xlsx") > present <- file.exists(FILES) > > and it returned a true values. Anyone can tell me which can be the problem ? Not if you don't tell us WHERE you expect to find the file... Where is it located, and what is the value of FILES above? It is not unlikely that you misunderstande what system.file() is supposed to do. -pd > > thanks > > Pau Marc Muñoz Torres > skype: pau_marc > http://www.linkedin.com/in/paumarc > http://www.researchgate.net/profile/Pau_Marc_Torres3/info/ > > [[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. -- 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] Duplicate row names are not allowed
Presumably, RCommander's readXL generates an invalid data frame (John?). To investigate, look at row.names(Dataset) and to fix row.names(Dataset) <- NULL If the issue is that Dataset really isn't a data frame, maybe try Dataset <- as.data.frame(Dataset). [Your screenshot made it through to here, but not the data. Notice, as a general matter, that it is preferable to give your code as part of the message text; it is hard to copy-paste from a .png] -pd > On 22 May 2017, at 21:02 , ville iiskola via R-help > wrote: > > Hi > I read a book where was shown an example how to create a probability model > with mlogit. I tried to do like the instruction said but i get error message > that "duplicate row names are not allowed". What could i do to fix it? > > I had the data in excel and imported it to R using R commander. I attach the > data file and print sqreen of my code to here if somebody could help the > novice. Ville<2017-05-21 > (1).png>__ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rpart help
> On 24 May 2017, at 04:38 , Bert Gunter wrote: > > 1. Forget Excel. Erase it from your memory. banish its paradigms from > your practices. Faiing to do so will only bring misery as you explore > R. R is a rational programming language primarily for data analysis, > statistics, and graphics. Excel is, ummm, not. And, never mind Bert's rant, a simple table(single_order, churn) would give info similar to what you claim to have from Excel, minus the risk of finding that the data are not the same, or that Excel was doing something bizarre. -pd > > 2. Have you read the rpart documents and vignettes? That should be > your first port of call for questions about how it works. > > > 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, May 23, 2017 at 6:45 PM, kristen wissmar > wrote: >> Hi R users! >> >> I'm new to R, so I'm starting with a basic exercise in rpart. >> >> I'm predicting if a user will churn based on past order history. I've >> calculated the probabilities in excel, and if user is a single order >> customer (1), then their probability of churn is 90%, if there are multiple >> orders(0) then the probability of churning is 70%. In the R model, the >> probability looks like it's 100% and 53%. In excel I used the count of >> shopper_key to calculate probabilities. So I'm wondering if R has needs a >> shopper_key to count? >> >> It would be helpful if someone could suggest where I'm going wrong. >> >> Thank you! >> >> >> Code - >> m1 <- rpart( churn ~ single_order , data = data2, method="anova" ) >> >> Output- >> n= 22041 >> >> node), split, n, deviance, yval >> * denotes terminal node >> >> 1) root 22041 3229.265 0.8216959 >> 2) single_order< 0.5 8407 2092.852 0.5325324 * >> 3) single_order>=0.5 136340.000 1.000 * >> >> >> shopper_key churn single_order >> 1 1 0 >> 2 1 1 >> 3 0 0 >> 4 1 0 >> 5 1 1 >> 6 1 1 >> 7 1 0 >> 8 1 1 >> 9 0 1 >> 10 1 1 >> >>[[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. -- 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] R 3.4.1 at end of June
Just a quick note to say that we intend to have a patch release, probably on June 30, mainly to pick up a few balls that were dropped on the 3.4.0 release. Full schedule to appear later (just need a little time to actually set it up + checking that the date doesn't collide with schedules of other people). - Peter Dalgaard -- 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-annou...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] New var
As Bert says/implies, "some assembly is required". as.Date() is your friend and you can basically just subtract those to get differences. Also, it seems to me that you are really trying to convert differences to a factor, and then represent the factor using particular dummy variables for successive differences, for use in a linear model of sorts. A combination of cut() and a contrast matrix (see contrasts<-) might be a better structured approach. -pd > On 3 Jun 2017, at 07:13 , Bert Gunter wrote: > > Ii is difficult to provide useful help, because you have failed to > read and follow the posting guide. In particular: > > 1. Plain text, not HTML. > 2. Use dput() or provide code to create your example. Text printouts > such as that which you gave require some work to wrangle into into an > example that we can test. > > Specifically: > > 3. Have you gone through any R tutorials?-- it sure doesn't look like > it. We do expect some effort to learn R before posting. > > 4. What is the format of your date columns? character, factors, > POSIX,...? See ?date-time for details. Note particularly the > "difftime" link to obtain intervals. > > 5. ?ifelse for vectorized conditionals. > > Also, you might want to explain the context of what you are trying to > do. I strongly suspect you shouldn't be doing it at all, but that is > just a guess. > > Be sure to cc your reply to the list, not just to me. > > 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 Fri, Jun 2, 2017 at 8:49 PM, Val wrote: >> Hi all, >> >> I have a data set with time interval and depending on the interval I want >> to create 5 more variables . Sample data below >> >> obs, Start, End >> 1,2/1/2015, 1/1/2017 >> 2,4/11/2010, 1/1/2011 >> 3,1/4/2006, 5/3/2007 >> 4,10/1/2007, 1/1/2008 >> 5,6/1/2011, 1/1/2012 >> 6,10/15/2004,12/1/2004 >> >> First, I want get interval between the start date and end dates >> (End-start). >> >> obs, Start , end, datediff >> 1,2/1/2015, 1/1/2017, 700 >> 2,4/11/2010, 1/1/2011, 265 >> 3,1/4/2006, 5/3/2007, 484 >> 4,10/1/2007, 1/1/2008, 92 >> 5,6/1/2011, 1/1/2012, 214 >> 6,10/15/2004,12/1/2004,47 >> >> Second. I want create 5 more variables t1, t2, t3, t4 and t5 >> The value of each variable is defined as follows >> if datediff < 100 then t1=1, t2=t3=t4=t5=-1. >> if datediff >= 100 and < 200 then t1=0, t2=1,t3=t4=t5=-1, >> if datediff >= 200 and < 300 then t1=0, t2=0,t3=1,t4=t5=-1, >> if datediff >= 300 and < 400 then t1=0, t2=0,t3=0,t4=1,t5=-1, >> if datediff >= 400 and < 500 then t1=0, t2=0,t3=0,t4=0,t5=1, >> if datediff >= 500 then t1=0, t2=0,t3=0,t4=0,t5=0 >> >> The complete out put looks like as follow. >> obs, start, end,datediff, t1, t2, t3, t4, t5 >> 1,2/1/2015, 1/1/2017,700, 0, 0, 0, 0, 0 >> 2, 4/11/2010, 1/1/2011,265, 0, 0, 1, -1, -1 >> 3,1/4/2006, 5/3/2007,484, 0, 0, 0, 0, 1 >> 4, 10/1/2007, 1/1/2008, 92, 1, -1, -1,-1, -1 >> 5 ,6/1/2011,1/1/2012, 214, 0, 0, 1,-1, -1 >> 6, 10/15/2004, 12/1/2004, 47, 1, -1, -1, -1, -1 >> >> Thank you. >> >>[[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. -- 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] nmax parameter in factor function
No anomaly, it is just that you need to know what it is for, before trying to use it. Basically, duplicated() works by looking up entries in a hash table (for which there is a substantial literature, just google it). This will be somewhat more efficient if you know the number of unique values in advance (otherwise the table is the same size as the input vector), so you have the option of setting nmax. If you set nmax too small, you get to keep both pieces. nmax is directly linked to a variable in C code, and I expect that 0-based indexing is the reason that nmax can be one less than the actual number of unique values. -pd > On 4 Jun 2017, at 06:35 , Bert Gunter wrote: > > I'll go just a bit "fer-er." It appears the anomaly -- I hesitate to > call it a bug -- is in the C code for duplicated.default(): > >> duplicated(letters[1:10],nmax=10) > [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > >> duplicated(letters[1:10],nmax=9) > [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > >> duplicated(letters[1:10],nmax=8) ## for all nmax <9 > Error in duplicated.default(letters[1:10], nmax = 8) : hash table is full > > Cleverer folks than I must now explain (and possibly correct me). > > 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 Sat, Jun 3, 2017 at 9:11 PM, Bert Gunter wrote: >> Well, you won't like this, but it is kind of wimpily (is that a word?) >> documented: >> >> If you check the code of factor(), you will see that nmax appears as >> an argument in a call to unique(). ?unique says for nmax, "... see >> duplicated" . And ?duplicated says: >> >> "If nmax is set too small there is liable to be an error: nmax = 1 is >> silently ignored." >> >> So sometimes you get an error when nmax is too small with the hash >> table error message; and sometimes you just apparently get the nmax >> argument ignored: >> >>> identical(factor(letters,nmax = 25), factor(letters,nmax=26)) >> [1] TRUE >> >> and that, to paraphrase what Roger Hammerstein said about Kansas City, >> is about "as fer as I can go." >> >> (http://lyricsplayground.com/alpha/songs/e/everythingsuptodateinkansascity.shtml) >> >> 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 Sat, Jun 3, 2017 at 6:14 PM, Ramnik Bansal >> wrote: >>> I have been trying to understand how the argument 'nmax' works in >>> 'factor' function. R-Documentation states - "Since factors typically >>> have quite a small number of levels, for large vectors x it is helpful >>> to supply nmax as an upper bound on the number of unique values." >>> >>> In the code below what is the reason for error when value of nmax is >>> 24. Why did the same error not occur with nmax = 25 and also how come >>> there are 26 levels when nmax = 25 ? >>> >>>> factor(x = letters, nmax = 26) >>> [1] a b c d e f g h i j k l m n o p q r s t u v w x y z >>> Levels: a b c d e f g h i j k l m n o p q r s t u v w x y z >>> >>>> factor(x = letters, nmax = 25) >>> [1] a b c d e f g h i j k l m n o p q r s t u v w x y z >>> Levels: a b c d e f g h i j k l m n o p q r s t u v w x y z >>> >>>> factor(x = letters, nmax = 24) >>> Error in unique.default(x, nmax = nmax) : hash table is full >>> >>> ______ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] "reverse" quantile function
It would depend on which one of the 9 quantile definitions you are using. The discontinuous ones aren't invertible, and the continuous ones won't be either, if there are ties in the data. This said, it should just be a matter of setting up the inverse of a piecewise linear function. To set ideas, try x <- rnorm(5) curve(quantile(x,p), xname="p") The breakpoints for the default quantiles are n points evenly spread on [0,1], including the endpoints; i.e., for n=5, (0, .25, .5, .75, 1) So: x <- rnorm(5) br <- seq(0, 1, ,5) qq <- quantile(x, br) ## actually == sort(x) pfun <- approxfun(qq, br) (q <- quantile(x, .1234)) pfun(q) There are variations, e.g. the one-liner approx(sort(x), seq(0,1,,length(x)), q)$y -pd > On 16 Jun 2017, at 01:56 , Andras Farkas via R-help > wrote: > > David, > > thanks for the response. In your response the quantile function (if I see > correctly) runs on the columns versus I need to run it on the rows, which is > an easy fix, but that is not exactly what I had in mind... essentially we can > remove t() from my original code to make "res" look like this: > > res<-apply(z, 1, quantile, probs=c(0.3)) > > but after all maybe I did not explain myself clear enough so let me try > again: the known variables to us in what I am trying to do are the data frame > "z' : > > t<-seq(0,24,1) > a<-10*exp(-0.05*t) > b<-10*exp(-0.07*t) > c<-10*exp(-0.1*t) > d<-10*exp(-0.03*t) > > z<-data.frame(a,b,c,d) > > and the vector "res": > > res<-c(10.00, 9.296382, 8.642955, 8.036076 ,7.472374, 6.948723, > 6.462233, 6.010223 ,5.590211 > > ,5.199896 ,4.837147, 4.499989 ,4.186589, 3.895250 ,3.624397, 3.372570, > 3.138415, 2.920675 > , 2.718185 ,2.529864 ,2.354708, 2.191786, 2.040233, 1.899247, 1.768084) > > and I need to find the probability (probs) , the unknown value, which would > result in creating "res", ie: the probs=c(0.3), from: > res<-apply(z, 1, quantile, probs=c(0.3))... > > > a more simplified example assuming : > > k<-c(1:100) > f<-30 > ecdf(k)(f) > > would give us the value of 0.3... so same idea as this, but instead of "k" we > have data frame "z", and instead of "f" we have "res", and need to find the > value of 0.3... Does that make sense? > > much appreciate the help... > > Andras Farkas, > > > On Thursday, June 15, 2017 6:46 PM, David Winsemius > wrote: > > > > >> On Jun 15, 2017, at 12:37 PM, Andras Farkas via R-help >> wrote: >> >> Dear All, >> >> we have: >> >> t<-seq(0,24,1) >> a<-10*exp(-0.05*t) >> b<-10*exp(-0.07*t) >> c<-10*exp(-0.1*t) >> d<-10*exp(-0.03*t) >> z<-data.frame(a,b,c,d) >> >> res<-t(apply(z, 1, quantile, probs=c(0.3))) >> >> >> >> my goal is to do a 'reverse" of the function here that produces "res" on a >> data frame, ie: to get the answer 0.3 back for the percentile location when >> I have "res" available to me... For a single vector this would be done using >> ecdf something like this: >> >> x <- rnorm(100) >> #then I know this value: >> quantile(x,0.33) >> #so do this step >> ecdf(x)(quantile(x,0.33)) >> #to get 0.33 back... >> >> any suggestions on how I could to that for a data frame? > > Can't you just used ecdf and quantile ecdf? > > # See ?ecdf page for both functions > >> lapply( lapply(z, ecdf), quantile, 0.33) > $a > 33% > 4.475758 > > $b > 33% > 3.245151 > > $c > 33% > 2.003595 > > > $d > 33% > 6.173204 > -- > > David Winsemius > Alameda, CA, USA > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hunting a histogram variant
Hmmno... The labels on a stem-and-leaf plots are the values. This is just the measurement number: Observations #2,5,6,9 from level 1 had a temperature between 89 and 90, making up the penultimate column of that histogram. I would conjecture that, like stem-and-leaf, this has fallen out of favour because it doesn't scale well to larger samples. It is fine with 64 observations like this, but with (say) four times as many boxes, you'd lose all legibility. -pd > On 22 Jun 2017, at 06:16 , Bert Gunter wrote: > > ?stem > > for something close and built in. > > 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 Wed, Jun 21, 2017 at 9:01 PM, S Ellison wrote: >> >> I'm looking for a histogram variant in which data points are plotted as >> labelled rectangles 'piled up' to form a histogram. I've posted an example >> at https://www.dropbox.com/s/ozi8bhdn5kqaufm/labelled_histogram.png?dl=0 >> >> It seems to have a long pedigree, as I see it (as in this example) in >> documents going back beyond the '80s. But I've not seen it in recent >> textbooks. So it may be one of those older graphical displays that's just >> fallen out of use. >> >> General questions: >> i) Does this thing have a name? >> ii) Can anyone point me to a literature source for it? >> >> ... and the R question: >> ii) Is it already hiding somewhere in an R package?* >> >> S Ellison >> >> *If it's not, I'll be adding it to one, hence the hunt for due credit/sources >> >> >> >> *** >> This email and any attachments are confidential. Any u...{{dropped:8}} > > ______ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R 3.4.1 is released
The build system rolled up R-3.4.1.tar.gz (codename "Single Candle") this morning. The list below details the changes in this release. You can get the source code from http://cran.r-project.org/src/base/R-3/R-3.4.1.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Binaries for various platforms will appear in due course. For the R Core Team, Peter Dalgaard These are the checksums (md5 and SHA-256) for the freshly created files, in case you wish to check that they are uncorrupted: MD5 (AUTHORS) = f12a9c3881197b20b08dd3d1f9d005e6 MD5 (COPYING) = eb723b61539feef013de476e68b5c50a MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343 MD5 (FAQ) = 8c65d9a0af345a185d3770c9876f1d51 MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b MD5 (NEWS) = 4cd5e22f3fffd3525a65acd7d3ed0e28 MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8 MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801 MD5 (NEWS.2) = 71562183d75dd2080d86c42bbf733bb7 MD5 (R-latest.tar.gz) = 3a79c01dc0527c62e80ffb1c489297ea MD5 (README) = f468f281c919665e276a1b691decbbe6 MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435 MD5 (THANKS) = f60d286bb7294cef00cb0eed4052a66f MD5 (VERSION-INFO.dcf) = cc04bf1371ce85ec7fb32143692ead4e MD5 (R-3/R-3.4.1.tar.gz) = 3a79c01dc0527c62e80ffb1c489297ea 6474d9791fff6a74936296bde3fcb569477f5958e4326189bd6e5ab878e0cd4f AUTHORS e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4 COPYING 6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3 COPYING.LIB f0d18e22b9bdfe1dd91547d401b4ef5c8828b2c956a51dc54e7476196b48f87e FAQ f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31 INSTALL c732c6ec885f4085ba20ae837ac9bcf2ad0952e61fcf910953bdd8dd2c103d23 NEWS 4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62 NEWS.0 12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01 NEWS.1 a10f84be31f897456a31d31690df2fdc3f21a197f28b4d04332cc85005dcd0d2 NEWS.2 shasum: R-2: shasum: R-3: Is a directory 02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78 R-latest.tar.gz 2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc README 408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9 RESOURCES 52f934a4e8581945cbc1ba234932749066b5744cbd3b1cb467ba6ef164975163 THANKS e53d0641f90183fee5b7bec130b77d398634211a111fee3ceefb1536275865be VERSION-INFO.dcf 02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78 R-3/R-3.4.1.tar.gz This is the relevant part of the NEWS file CHANGES IN R 3.4.1: INSTALLATION on a UNIX-ALIKE: * The deprecated support for PCRE versions older than 8.20 has been removed. BUG FIXES: * getParseData() gave incorrect column information when code contained multi-byte characters. (PR#17254) * Asking for help using expressions like ?stats::cor() did not work. (PR#17250) * readRDS(url()) now works. * R CMD Sweave again returns status = 0 on successful completion. * Vignettes listed in .Rbuildignore were not being ignored properly. (PR#17246) * file.mtime() no longer returns NA on Windows when the file or directory is being used by another process. This affected installed.packages(), which is now protected against this. * R CMD INSTALL Windows .zip file obeys --lock and --pkglock flags. * (Windows only) The choose.files() function could return incorrect results when called with multi = FALSE. (PR#17270) * aggregate(, drop = FALSE) now also works in case of near-equal numbers in by. (PR#16918) * fourfoldplot() could encounter integer overflow when calculating the odds ratio. (PR#17286) * parse() no longer gives spurious warnings when extracting srcrefs from a file not encoded in the current locale. This was seen from R CMD check with inst/doc/*.R files, and check has some additional protection for such files. * print.noquote(x) now always returns its argument x (invisibly). * Non-UTF-8 multibyte character sets were not handled properly in source references. (PR#16732) -- 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-annou...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help documentation of "The Studentized range Distribution"
Well, it is clear enough that the problem is in interpreting the documentation. However, when you claim you tested something, and found it inconsistent with tables, it would be advisable to back it up with examples! The description in the help files and in the sources is admittedly confusing. The original paper has this, rather more clear, description in the abstract: "We consider the probability distribution of the maximum of r statistics each distributed as the Studentized range of means calculated from c random samples of size n from normal populations. The rc samples are assumed to be mutually independent and a common pooled—within—samplevariance is used throughout." So the connection is nranges == r, and nmeans == c. (n never actually factors in because sqrt(n) is part of the standardization) For the typical application, r is 1 for the usual studentized range distribution. E.g. for two large groups: > qtukey(.95,2,df=Inf) [1] 2.771808 As there is only one difference to consider, this should be distributed like the absolute value of the difference between two standard normals, and yes: We get our old friend 1.96 from > qtukey(.95,2,df=Inf)/sqrt(2) [1] 1.959964 It is less than fortunate that the help file speaks of "sample size for range". It is marginally defensible, because it is about the standardized range of a sample _of means_, but it is likely to confuse the actual reader into believing that it has to do with the sample size for each mean. -pd > On 10 Jul 2017, at 05:04 , Jeff Newmiller wrote: > > We cannot help you understand what you are doing if you do not show us what > you are doing. Here are some discussions about how to communicate questions > about R [1][2][3]. > > [1] > http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example > > [2] http://adv-r.had.co.nz/Reproducibility.html > > [3] https://cran.r-project.org/web/packages/reprex/index.html > -- > Sent from my phone. Please excuse my brevity. > > On July 6, 2017 11:36:47 AM PDT, Ursula Garczarek > wrote: >> Dear all, >> I wanted to compare Bonferroni vs TukeyHSD correction over a range of >> groups and group sizes, and wanted to use the function qtukey. >> >> In the help documentation it says >> >> qtukey(p, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE) >> Arguments >> q >> >> vector of quantiles. >> >> p >> >> vector of probabilities. >> >> nmeans >> >> sample size for range (same for each group). >> >> df >> >> degrees of freedom for s (see below). >> >> nranges >> >> number of groups whose maximum range is considered. >> >> log.p >> >> logical; if TRUE, probabilities p are given as log(p). >> >> lower.tail >> >> logical; if TRUE (default), probabilities are P[X � x], otherwise, P[X >>> x]. >> >> >> But when I test it, "nmeans" actually should be the number of groups, >> and not "nrange" to fit with tables of the studentized range >> distribution. >> >> Can that be - it should be a rather old procedure, so I wonder whether >> I get something completely wrong... >> >> Regards, >> Ursula >> >> >> >> >> >> >> >> >> >> >> >> >> >> This email and any attachments are confidential and may >> ...{{dropped:8}} > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.