Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread maxbre
hi thank you all for the great replies, very useful indeed even if some of them a bit too aggressive (which is never, ever a good approach in my very humble opinion... but that's a matter of taste and style I do not want to discuss here); sorry again for bothering someone with such a trivial and i

Re: [R] Infinite Series

2015-07-23 Thread Jeff Newmiller
?cumsum --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Enginee

[R] Infinite Series

2015-07-23 Thread Janh Anni
Dear All, Does anyone know of any R functions that compute partial sums of series? Thanks in advance! Janh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/

Re: [R] Differences in output of lme() when introducing interactions

2015-07-23 Thread Rolf Turner
On 24/07/15 07:07, Therneau, Terry M., Ph.D. wrote: The following are in parody (but like all good parody correct wrt the salient features). The musings of Guernsey McPhearson http://www.senns.demon.co.uk/wprose.html#Mixed http://www.senns.demon.co.uk/wprose.html#FDA In formal publicati

Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread Marissa Fahlberg
Turns out my column and row names were too long to fit in the console and when I widened the window the table didn't automatically adjust and widen as well. I had to widen the console first and then retype the same command so it fit. Silly mistake. I usually keep the console pretty narrow on my lap

[R] “Error in if (abs(x - oldx) < ftol)” when using “lognormal” distribution in mixed logit

2015-07-23 Thread Dera
Hi, I have a question about how to use the mlogit package in R to do analysis of discrete choice survey data. Our survey is about asking people to choose from different insurance policies(with two attributes of deductible and premium). The code I used to fit mixed logit is: [1] ml <- mlogit.data

[R] Table Looks Funny

2015-07-23 Thread Marissa Fahlberg
Hey, I can't seem to import my csv file in such a way that the table looks "normal". The dimensions are correct, 4x7, and I set my header =TRUE, but it still looks weird. Attached is the picture. Any ideas?? Thanks!! -Marissa __ R-help@r-project.org mai

Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread Bert Gunter
Oops, Bill's reply and mine crossed in the email. His is essentially the same as mine except probably more efficient. -- Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Thu, Jul 23, 2015 at 2:44 PM, Willia

Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread William Dunlap
You could do something like the following > rowsToShiftLeft <- c(2,4,5) # 4, not the 3 that was in the original post > mat <- as.matrix(df_start) > mat[rowsToShiftLeft, 1:3] <- mat[rowsToShiftLeft, 2:4] > result <- data.frame(mat[, 1:3], stringsAsFactors=FALSE) > str(result) 'data.frame

[R] R: Re: Differences in output of lme() when introducing interactions

2015-07-23 Thread John Maindonald
Do you have legal advice that suing the University (if that is the right context) would actually be a fruitful way forwards, that it would achieve anything useful within reasonable time and without causing the student severe financial risk? What may work in that context is for students to collect

Re: [R] Contr.sum and coefficient tests

2015-07-23 Thread Ben Bolker
François Collin nottingham.ac.uk> writes: > > Dear all, > I would like to run a linear model which includes two factors: > - The first one has two levels, including a reference level. Thus I > have to use the treatment contrast (contr.treatment, reference level > effect = 0, then the intercep

Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread maxbre
sorry but honestly I do not get your point I need to shift to left by one position (i.e. one column) the entire rows 2,4,5 of "df_start" so that to obtain as final result the structure indicated in "df_end" I know in advance the rows that I need to shift hope it clears a bit, now -- View thi

Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread Sarah Goslee
On Thu, Jul 23, 2015 at 3:56 PM, maxbre wrote: > Hi > > thank you for your reply: it's a neat solution but unfortunately not > applicable to my specific case; I'm going to assume you're replying to me, although there's no context whatsoever in your response (this is the R-help email list, not Nab

Re: [R] interactive Map: Popups

2015-07-23 Thread daniel
Marie-Louise, As long sa I know you have to gie googleVis the ISO code for provinces. GR <- data.frame( ISO = c("DE-BW", "DE-BY", "DE-BE", "DE-BB", "DE-HB", "DE-HH", "DE-HE", "DE-MV", "DE-NI", "DE-NW", "DE-RP", "DE-SL", "DE-SN", "DE-ST", "DE-SH", "DE-TH"), name = c("Baden-Württemberg", "Bayern",

Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread Bert Gunter
Ah, so apparently you require some sort of psychic abilities... For how else would one choose which three values to keep in a row that was: a 2 b 5 based on your specification that "xxx could be anything." Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. An

Re: [R] interactive Map: Popups

2015-07-23 Thread Erich Neuwirth
Some shapefiles for Germany can be found here http://www.statsilk.com/maps/download-free-shapefile-maps > On Jul 23, 2015, at 21:36, Erin Hodgess wrote: > > Hello Erich: > > I just looked at your leaflet package and its examples. It

Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread maxbre
Hi thank you for your reply: it's a neat solution but unfortunately not applicable to my specific case; in fact as I specified in my first post (I may have been not enough clear, sorry for that!) I can not rely on any search method grep-like because the value "xxx" in the rows of "df_start" can b

[R] Confidence intervals of G&K gamma statistics using bootstrap

2015-07-23 Thread varin sacha
Dear R-Experts, I am trying to calculate the confidence intervals of the Goodman & Kruskal gamma statistics using bootstrap. There is no gamma function in the boot package. There is a gamma function in the base package, but it is the usual mathematical function. So, I decide to try to calcula

Re: [R] Differences in output of lme() when introducing interactions

2015-07-23 Thread Therneau, Terry M., Ph.D.
The following are in parody (but like all good parody correct wrt the salient features). The musings of Guernsey McPhearson http://www.senns.demon.co.uk/wprose.html#Mixed http://www.senns.demon.co.uk/wprose.html#FDA In formal publication: Senn, Statistical Issues in Drug Development, sec

Re: [R] interactive Map: Popups

2015-07-23 Thread Marie-Louise
Thank you both very much for your tips, and excuse my horrible english skills. R is new to me so I tried to work with code that was already there. I managed to get close to what I wanted with require(googleVis) G4 = gvisGeoChart(con2, locationvar = "DE", col

[R] How to calculate the average direct effect, average total effect and average indirect effect for spatial regression models with spatial lag of dependent variable

2015-07-23 Thread wenyueyang
Hi, I am using four spatial regression models (SAR, SEM, SAC and SDM) to evaluate the spillover effect of some factors. LeSage and Pace (2009) pointed out that when the spatial lag of the dependent variable is included in the model, parameter estimates lose their conventional interpretation as mar

[R] Contr.sum and coefficient tests

2015-07-23 Thread François Collin
Dear all, I would like to run a linear model which includes two factors: - The first one has two levels, including a reference level. Thus I have to use the treatment contrast (contr.treatment, reference level effect = 0, then the intercept). - The second is a 6-level factor without reference co

Re: [R] Statistical distribution not fitting

2015-07-23 Thread Ben Bolker
Amelia Marsh via R-help r-project.org> writes: > > Dear Sir, > [snip] > Lastly using the command rsnorm(1, mean = m, sd = s, xi = x) > where m, s and x are the estimated parameters obtained from loss > data. The usual procedure is to arrange these simulated values in > descending order

Re: [R] shift by one column given rows in a dataframe

2015-07-23 Thread Sarah Goslee
With one minor change to your reproducible example (thank you!): df_start <- data.frame(v0,v1,v2,v3, stringsAsFactors=FALSE) data.frame(t(apply(df_start, 1, function(i)i[!grepl("xxx", i)])), stringsAsFactors=FALSE) I'll leave it to you to deal with columns that you'd like to have numeric. (You mi

[R] shift by one column given rows in a dataframe

2015-07-23 Thread Massimo Bressan
by considering the following reproducible example: v0<-c("a","xxx","c",rep("xxx",2)) v1<-c(1,"b",3,"d","e") v2<-c(6,2,8,4,5) v3<-c("xxx",7,"xxx",9,10) df_start<-data.frame(v0,v1,v2,v3) df_start v0<-letters[1:5] v1<-1:5 v2<-6:10 df_end<-data.frame(v0,v1,v2) df_end I need to shift by one colum

Re: [R] interactive Map: Popups

2015-07-23 Thread Greg Snow
You might be interested in the HWidentify and HTKidentify functions in the TeachingDemos package. They currently don't do maps, but since the functions are pure R code it would not be hard to modify them. On Wed, Jul 22, 2015 at 5:35 PM, Marie-Louise wrote: > Hello, > I am trying to build a map

Re: [R] Ordering in Sankey diagram using R and googleVis

2015-07-23 Thread Angela via R-help
Hi Jim, I tried it and it while it does make the diagram look more like what I want, there are a few categories still out of order. Thank you for your help! -Angela On Thu, 7/23/15, Jim Lemon wrote: Subject: Re: [R] Ordering in Sankey diagram usi

Re: [R] interactive Map: Popups

2015-07-23 Thread Erich Neuwirth
I am quite happy with that package leaflet which is not yet on CRAN but available on Githib. https://github.com/rstudio/leaflet signature.asc Description: Message signed with OpenPGP using GPGMail __ R-help@r-proje

Re: [R] Ordering in Sankey diagram using R and googleVis

2015-07-23 Thread Jim Lemon
Hi Angela, Assuming that your reformatted data is named "data", have you tried: data[order(data$count,data$before,decreasing=TRUE),] Jim On Thu, Jul 23, 2015 at 3:15 AM, Angela via R-help wrote: > Hello, > > I am trying to figure out if there is a way to order the left side of a > Sankey diagr

Re: [R] Langelier-Ludwig Plots

2015-07-23 Thread Jim Lemon
Hi Rich, Thanks to the link provided by Boris, I now realize that the third example in the radial.plot function help page is almost a Tickell diagram. Another plotting function that is close to the illustrations in that paper is starPie. Learn something every day. Hope this is helpful. Jim On Th

Re: [R] Read ".xlsx" and convert date-column value into Dataframe

2015-07-23 Thread Ivan Calandra
Hi Antony, Except if you have good reasons to use R2.15, it is generally a good idea to upgrade to the latest version. In any case, the solutions that were proposed on the list will definitely work fine. There are however advantages of using readxl, in my opinion. readxl does not use depende

[R] Stats courses in Queensland, Australia

2015-07-23 Thread Highland Statistics Ltd
Apologies for cross-posting There are various remaining seats on the following two statistics courses: Course 1: Introduction to Generalized Linear Models with R. -Bayesian and frequentist approaches - Dates: 11 - 14 August, 2015 Location: Hotel Grand Chancellor, Coral Coast Drive, Palm Cove.

Re: [R] Read ".xlsx" and convert date-column value into Dataframe

2015-07-23 Thread R_Antony
Hi Jim, My requirement is simple. I have to read date-values from the excel file into dataframe, that's all. and i tried using the way you mentioned and it works. Thank you very much ! -- View this message in context: http://r.789695.n4.nabble.com/Read-xlsx-and-convert-date-column-value-into-

Re: [R] Read ".xlsx" and convert date-column value into Dataframe

2015-07-23 Thread R_Antony
Hi Ivan, This way i would've tried but i am using R 2.15 - ReadXL package will support R >=3 versions. Thanks, Antony. -- View this message in context: http://r.789695.n4.nabble.com/Read-xlsx-and-convert-date-column-value-into-Dataframe-tp4710192p4710232.html Sent from the R help mailing list