Re: [R] Exporting column names with spaces with write.csv() XXXX

2015-09-05 Thread Dennis Murphy
...or, when trying to read it back into R, read.csv(header = TRUE, text = ' "no good","no good at all" 1,4 2,5 3,6') no.good no.good.at.all 1 1 4 2 2 5 3 3 6 read.csv(header = TRUE, check.names = FALSE, text = ' "no good","no good at al

Re: [R] Exporting column names with spaces with write.csv() XXXX

2015-09-05 Thread Jim Lemon
Hi Dan, I don't get this behavior with R-3.2.2: da.df<-data.frame(1:3,4:6) names(da.df)<-c("no good","no good at all") > da.df no good no good at all 1 1 4 2 2 5 3 3 6 write.csv(da.df,file="gloop.csv",row.names=FALSE) gives me this: "no

Re: [R] Exporting column names with spaces with write.csv() XXXX

2015-09-05 Thread Jeff Newmiller
Reproducible example, please. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Pl

[R] Exporting column names with spaces with write.csv() XXXX

2015-09-05 Thread Dan Abner
Hi all, I have a number of columns with spaces in the column names exactly as I want them in R. When I go to export the data table to csv using write.csv(), the fn adds periods in place of the spaces. Is there a way to suppress the addition of the periods? Thanks, Dan _

Re: [R] [Bayesian Methods] Riemann Sums for Posterior expected loss

2015-09-05 Thread Dan D
Does this get you started? f<-function(t,cx){ (abs(t-cx)*(t >= cx)+10*abs(t-cx)*(t < cx))*dbeta(t,1.05,30) } integrate(f,lower=0,upper=1,cx=0.4)$val # e.g., for c = 0.4 The "integrate" function integrates over the first parameter. Other parameters can be entered as needed. [Note: I used cx as

Re: [R] For logical i and length(i) > length(x), x[i] <- value makes length(x) == length(i)

2015-09-05 Thread Jeff Newmiller
I think this behavior is consistent with typical indexing behaviour in R... I would ask you what result you thought you should get? I, for one, can think of all sorts of uses for numeric indexes that have different lengths than the vector, but am stumped to think of any use for what you are prop

Re: [R] Plots Help

2015-09-05 Thread Dan D
length(post) is 1 (i.e., it is just a single function), but length(post(t)) == length(t) -- View this message in context: http://r.789695.n4.nabble.com/Plots-Help-tp4711894p4711897.html Sent from the R help mailing list archive at Nabble.com. __ R-he

Re: [R] Plots Help

2015-09-05 Thread Dan D
As written, the code does not run because you are trying to plot post vs. t. Try instead: plot(t, post(t)), or, more simply, plot(t, dbeta(t,1.05,30)) -Dan -- View this message in context: http://r.789695.n4.nabble.com/Plots-Help-tp4711894p4711896.html Sent from the R help mailing list archive

Re: [R] Help with vectors!

2015-09-05 Thread Dan D
# your data VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") # declare the new vector New_Vector<-numeric(length(VAS)) # brute force: New_Vector[VAS=="White"]<-1 New_Vector[VAS=="Yellow"]<-2 New_Vector[VAS=="Green"]<-3 New_Vector[VAS=="Black"]<-4 # a litt

[R] For logical i and length(i) > length(x), x[i] <- value makes length(x) == length(i)

2015-09-05 Thread Suharto Anggono Suharto Anggono via R-help
I came across this behavior when I followed the code of function 'rank' in R. It seems that subassignment of a vector by a logical index vector that is longer than the original vector always results in expanding the original vector to the length of the index vector. The resulting length may be

Re: [R] R on Windows 10

2015-09-05 Thread Joyaa
Dear Stephen, I was the new R user having trouble "with Windows 10", but it turns out my issues were due to saving the workspace, rather than anything to do with Windows 10. That problem is now sorted and so far all looks good. HTH, Joyaa John Fox wrote > I can confirm that I'm using R 3.2.2

Re: [R] Composite index reliability questions - cronbach()

2015-09-05 Thread Nick Petschek
Thanks, Jim! The lack of quotes was a typo, but what was not was my forgetting to include the "c(" function... Thanks! On Sat, Sep 5, 2015 at 7:23 AM, Jim Lemon wrote: > Hi Nick, > If you haven't just made a typo on your example in QUESTION 2, the "This > doesn't" line should read: > > cronba

Re: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

2015-09-05 Thread Joyaa Antares
Der JWD, Dear Jeff Newmiller, Many thanks for your useful advice. JWD - I have notepad++ and I don't know why I didn't think of that! Having said that, I will take a look at RStudio that John mentions too. Thanks again. Much appreciated. Joyaa -Original Message- From: jwd

Re: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

2015-09-05 Thread Joyaa Antares
Dear John, You mention, "the Rcmdr manual (accessible via "Help > Introduction to the R Commander")". Apologies for my dumbness, but the manual I did read - and found helpful - before posting is clearly a different one. A 43 page pdf with no section numbers nor any reference to the Worksp

Re: [R] For Loops please help!!

2015-09-05 Thread Dan D
Yes, the cause is memory use patterns, but the price is steep nonetheless. E.g.: rate<-log(400*1.1^(1:30)) # runs about 27x times as fast as the following (test via 'microbenchmark') rate<-numeric(30) for (i in 1:30){ rate[i]<-log(400*1.1^i) } When manipulating large arrays, the difference

Re: [R] For Loops please help!!

2015-09-05 Thread Jeff Newmiller
This is not true. The steep price has to do with memory use patterns like result <- c( result, new value ). Vectorization is cleaner, easier to read, and somewhat faster, but for loops are not the monster that they have a reputation for being if the memory is allocated before the loop and elemen

Re: [R] For Loops please help!!

2015-09-05 Thread Dan D
Also, any time you write "for" in R, you pay a steep price in performance. In a short, simple loop it may not be noticeable, but in a more challenging problem it can be a huge issue. A more efficient way to write your loop would be: infectrate = 400*1.1^(1:30) # calculation cbind(1:30,log(infectra

Re: [R] For Loops please help!!

2015-09-05 Thread Dan D
The code has an error so it won't run as written. Instead of: infectrate[n]= (400)(1.1)^(n); try: infectrate[n]= 400*1.1^n; What I get after making this change looks right. -- View this message in context: http://r.789695.n4.nabble.com/For-Loops-please-help-tp4711882p4711884.html Sent from

[R] factor interaction boxplot ordering by median

2015-09-05 Thread Sergio Fonda
I would to visualize in boxplot a data frame with two factors ordering one factor with the median. As example,suppose to have the InsectSprays dataframe, where an "operator" factor with two levels, op1 and op2, has been added as shown at bottom here. How may be generated a boxplot showing boxes fo

Re: [R] factor interaction boxplot ordering by median

2015-09-05 Thread Sergio Fonda
Great! Thank you All the best SF Il 05/set/2015 15:08, "Marc Schwartz" ha scritto: > > > On Sep 5, 2015, at 7:29 AM, Sergio Fonda > wrote: > > > > I would to visualize in boxplot a data frame with two factors ordering > one > > factor with the median. > > As example,suppose to have the InsectSpr

Re: [R] factor interaction boxplot ordering by median

2015-09-05 Thread Marc Schwartz
> On Sep 5, 2015, at 7:29 AM, Sergio Fonda wrote: > > I would to visualize in boxplot a data frame with two factors ordering one > factor with the median. > As example,suppose to have the InsectSprays dataframe, where an "operator" > factor with two levels, op1 and op2, has been added as shown a

Re: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

2015-09-05 Thread Fox, John
Dear Joyaa, > -Original Message- > From: Joyaa Antares [mailto:jo...@goldcoastosteopathy.com.au] > Sent: September 5, 2015 2:07 AM > To: Fox, John > Cc: r-help@r-project.org > Subject: Re: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows > 10 > > Dear John, > > You menti

Re: [R] Composite index reliability questions - cronbach()

2015-09-05 Thread Jim Lemon
Hi Nick, If you haven't just made a typo on your example in QUESTION 2, the "This doesn't" line should read: cronbach(jdc[,c("Q1","Q2","Q3")]) Without the quotes, R looks for three objects named Q1, Q2 and Q3 and probably doesn't find them. Jim On Sat, Sep 5, 2015 at 7:27 AM, Nick Petschek wr