Re: [R] Multiple CSV files in different sheets of an Excel file

2017-11-06 Thread Kamlesh Khollam
Hi Marc and Team, Apology for the late reply. I went through the github code for WriteXLS and accordingly passed required arguments. Its working fine now. I am able to create a excel workbook with multiple csv's. By Merge I mean create a excel workbook by adding multiple csv's as different sheets

[R] FW: Time Series

2017-11-06 Thread Emre Karagülle
Hi, I would like to ask a question about time series. I am trying to convert my data into time series data. I have hourly data from “2015-12-18 00:00” to “2017-10-24 23:00” I am trying the following codes but they are not working. Could you help me out? tseri <- ts(data ,seq(from=as.POSIXct("2015

[R] Using MLE on a somewhat unusual likelihood function

2017-11-06 Thread Hugo André
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

Re: [R] For each entry type in column?

2017-11-06 Thread Boris Steipe
You are right. > On Nov 6, 2017, at 6:47 PM, Bert Gunter wrote: > > Boris: > > "As others have remarked, for added efficiency with large datasets we often > use functions from the apply() family, rather than for-loops." > > That is generally false, though it is a common misconception. App

Re: [R] For each entry type in column?

2017-11-06 Thread Bert Gunter
Boris: "As others have remarked, for added efficiency with large datasets we often use functions from the apply() family, rather than for-loops." That is generally false, though it is a common misconception. Apply-type functions are used to maintain fidelity -- and for some, clarity -- to a funct

Re: [R] For each entry type in column?

2017-11-06 Thread Boris Steipe
Matti - Since you are asking about looping through a column, not looping across columns, it is simply the following: # Note: data.frame() turns strings into factors by default. myDF <- data.frame(type = c("a", "j", "a", "a", "j"), weight = c(12.3, 6.8, 10.5, NA, "5.5")) myDF

Re: [R] For each entry type in column?

2017-11-06 Thread Rui Barradas
Hello, If you want to loop through the columns of a data.frame you can do for(i in names(df)){ [code] } Another way would be lapply(names(df), function(somecol) class(df[[somecol]])) where class(df[[somecol]]) is just an example, you would use whatever fits your needs. When you say tha

Re: [R] For each entry type in column?

2017-11-06 Thread Jeff Newmiller
Maybe you are thinking of the levels function rather than the names function? Which still presumes the column is a factor column, when it might actually be a character column (in which case you might use the unique function). Again, a reproducible example would stop the guessing. -- Sent from

Re: [R] For each entry type in column?

2017-11-06 Thread Jeff Newmiller
All data frames "look like" matrices, but none of them "are" matrices. I think we need you to follow the Posting Guide and supply an R reproducible example that gives us a concrete idea what the data structure is that you are working with, and an example of what you expect to get out of the code

Re: [R] For each entry type in column?

2017-11-06 Thread Bert Gunter
Except that syntax is wrong: > d <- data.frame (a = 1:3, b = letters[1:3]) > names(d$a) NULL -- 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, No

Re: [R] For each entry type in column?

2017-11-06 Thread Matti Viljamaa
It’s sometimes faster to ask from someone who has already learnt the syntax. In this case one has to do e.g. names(data$somecol) To get the collection and then iteration through it is almost like in Python: for(i in names(data$somecol)) { # do something } > Bert Gunter kirjoitti 6.11.2017 k

Re: [R] Error in Zero inflated model (ziP) with bam

2017-11-06 Thread Miluji Sb
Thanks for your reply. Yes, installed (reinstalled) and loaded. I am a bit baffled... Sincerely, Milu On Mon, Nov 6, 2017 at 6:30 PM, Bert Gunter wrote: > Do you have the mgcv package installed (I think it's part of the standard > distro, though) /loaded? ziP is there, not in BAM. > > Other th

Re: [R] For each entry type in column?

2017-11-06 Thread Bert Gunter
Prrobably also worth mentioning for this sort of thing is the "tidyverse" machinery, for which the RStudio site should probably be your first port of call. This will however require learning alternative, and probably additional, paradigms. -- Bert Bert Gunter "The trouble with having an open m

[R] [R-pkgs] New package: data360r to access trade and governance open data

2017-11-06 Thread Ma. Regina Paz Saquido Onglao
Hi everyone, We've recently launched data360r, now available on CRAN at https://cran.r-project.org/web/packages/data360r/index.html This package makes it easy to engage with the APIs of the TCdata360 and Govdata360 open data platforms at https://tcdata360.worldbank.org/ and https://govdata360.

[R] QRA with R Course 12-4 to 12-7-17 - Ft. Collins, CO

2017-11-06 Thread Barbara O'Neill
Quantitative Risk Analysis with R Fort Collins, Colorado, USA December 4-7, 2017 This course will cover the core principles of quantitative risk analysis and Monte Carlo simulation modeling. The focus of the course is on how to conduct accurate and effective quantitative risk analyses, including

Re: [R] For each entry type in column?

2017-11-06 Thread Bert Gunter
Time to go through a tutorial or two! -- This forum cannot replace such self study. Your query evidences some basic confusion, but ?tapply or the equivalent lapply(split(...)) construct are most likely relevant. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people kee

[R] For each entry type in column?

2017-11-06 Thread mviljamaa
How can I do a for loop that does to a data.frame column what: for x in xs: does in Python? Obviously the data.frame column in question holds "levels". What if the data.frame is in matrix form? BR, Matti __ R-help@r-project.org mailing list -- To

Re: [R] Error in Zero inflated model (ziP) with bam

2017-11-06 Thread Bert Gunter
Do you have the mgcv package installed (I think it's part of the standard distro, though) /loaded? ziP is there, not in BAM. Other than that, sorry, no clue. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (

[R] Error in Zero inflated model (ziP) with bam

2017-11-06 Thread Miluji Sb
Dear all, I am trying to use 'bam' to run the following generalized additive model: ### m <- bam(result ~ factor(city) + factor(year) + lnpopulation + s(lnincome_pc) + ,data=full_df,na.action=na.omit,family=ziP(theta = NULL, link = "identity",b=0)) But getting the following error: ### Error in

Re: [R] Survival model error

2017-11-06 Thread David Winsemius
> On Nov 6, 2017, at 5:45 AM, Meghna Govil wrote: > > Thanks David. Could you show me how to do that in my example ? Possibly: kmsurvival_np <- survfit(Surv( tte, censored) ~ . , data=train1_na) I say "possibly" because I don't know whether all the columns of `train1_na` were included in th

Re: [R] Multiple CSV files in different sheets of an Excel file

2017-11-06 Thread Jeff Newmiller
You need to be more specific about what you mean by "merge" (read e.g. ?merge and ?rbind) and show what you did already using a reproducible example [1][2][3]. The fact that you mentioned sheets suggests you are writing to Excel files... they can be troublesome for storing data (NA values, siz

Re: [R] Survival model error

2017-11-06 Thread Michael Dewey
Try putting your data.frame (train_na) as argument to the data= parameter and then in the formula put the actual variable names but without the train_na$ prefix. On 06/11/2017 13:45, Meghna Govil via R-help wrote: Thanks David. Could you show me how to do that in my example ? Thanks, Meghna

Re: [R] Multiple CSV files in different sheets of an Excel file

2017-11-06 Thread Marc Schwartz
> On Nov 6, 2017, at 3:23 AM, Kamlesh Khollam > wrote: > > Hi Team, > I am tried "WriteXLS" package for merging 2 csv files. R script runs > successfully but does not create CSVmerge file. > > Appreciate our help. > > ​Best Regards, > Kamlesh Khollam​ Hi, You appear to be replying to a thr

Re: [R] Survival model error

2017-11-06 Thread Meghna Govil via R-help
Thanks David. Could you show me how to do that in my example ? Thanks, Meghna > On Nov 6, 2017, at 12:58 AM, David Winsemius wrote: > > You should stop trying to use matrices on the RHS and using separate vectors > to Surv. Instead use a data argument and have the names in your formula refer

Re: [R] Multiple CSV files in different sheets of an Excel file

2017-11-06 Thread Kamlesh Khollam
Hi Team, I am tried "WriteXLS" package for merging 2 csv files. R script runs successfully but does not create CSVmerge file. Appreciate our help. ​Best Regards, Kamlesh Khollam​ [[alternative HTML version deleted]] __ R-help@r-project.org mai

Re: [R] Change colour of line in logi.hist.plot

2017-11-06 Thread Göran Bergqvist
Thank you. This worked fine. -Ursprungligt meddelande- Från: David Winsemius [mailto:dwinsem...@comcast.net] Skickat: den 5 november 2017 18:17 Till: Göran Bergqvist Kopia: r-help@r-project.org Ämne: Re: [R] Change colour of line in logi.hist.plot > On Nov 5, 2017, at 6:03 AM, Göran Be