[R] Reading grib data

2013-03-23 Thread Bedassa Regassa
Hi I have been using reading netcdf but I can't get the command to read grib data. Please, I need help. Thank you -- --- *Bedassa Regassa Cheneka* *Adama Science and Technology Univesity* *Natural Resource Management* *P.O.BOX---193* *Assela *

Re: [R] 2D filled.contour plot with 1D histograms by axes

2013-03-23 Thread Jing Lu
Sorry, I didn't reply the email, because I post my question to: http://stackoverflow.com/questions/15511290/discrete-data-for-ggplot-stat-density2d I switched to ggplot2, and tried stat_density2d. But I got error for a few count data descriptors: Error in function (x, y, h, n = 25, lims =

[R] Saving a Random Forest Model

2013-03-23 Thread Lorenzo Isella
Dear All, Please consider the snippet at the end of the email The output of the randomForest model is rf1 (i.e. the trained model). Now, is there a way to save this rf1 so that, in a different R session, I can just load it without repeating the analysis? Of course I have in mind much more

Re: [R] Saving a Random Forest Model

2013-03-23 Thread Rui Barradas
Hello, ?save can save any R object. To load it back into R, use ?load. Hope this helps, Rui Barradas Em 23-03-2013 10:35, Lorenzo Isella escreveu: Dear All, Please consider the snippet at the end of the email The output of the randomForest model is rf1 (i.e. the trained model). Now, is there

Re: [R] ggplot2 will not draw a rectangle. Error: ggplot2 doesn't know how to deal with data of class XXX

2013-03-23 Thread John Kane
Thanks to everyone on this. Both Jeff's and Rui's approach worked. It looks like they do equivalent things , that is supplying the x and y values in geom_rect. The worst of it is I think I saw an example using the NULL NULL approach and did not realise the significance of it. John Kane

[R] Error with custom function in apply: ”Error in FUN(newX[, i], ...) : unused argument(s) (newX[, i])”

2013-03-23 Thread Camilo Mora
Hi everyone, I wonder if I can get your help using a custom function in apply. Imagine the following dataframe called data: LowLim HighLim A1 A2 A3 A4 4 6 3 4 5 6 4 6 4 5 5

[R] help on writing a function

2013-03-23 Thread Andras Farkas
Dear All   If you could please help me with a solution on the following: we have:   a -matrix(c(1,2,3,4,5)) x -matrix(c(0.3,0.2,0.1,0.08,0.05)) b -50*exp(-x[1]*a[1]) d -b*exp(-x[2]*a[2]) e -d*exp(-x[3]*a[3]) f -e*exp(-x[4]*a[4]) g -f*exp(-x[5]*a[5])   I would like to be able to calculate g with

Re: [R] Error with custom function in apply: ”Error in FUN(newX[, i], ...) : unused argument(s) (newX[, i])”

2013-03-23 Thread Rui Barradas
Hello, The following should be faster. It preallocates a vector of length nrows instead of extending 'a' on every iteration. a2 - character(nrows) for(b in 1:nrows) { c= ColChange(data[b,1],data[b,2],data[b,3:6],2) a2[b]=c } all.equal(c(a), a2) As for the use of apply, I'm

Re: [R] help on writing a function

2013-03-23 Thread Rui Barradas
Hello, Try this one liner. g2 - 50 * prod(exp(-x*a)) identical(g, g2) # TRUE Hope this helps, Rui Barradas Em 23-03-2013 11:27, Andras Farkas escreveu: Dear All If you could please help me with a solution on the following: we have: a -matrix(c(1,2,3,4,5)) x

[R] Character change to Unicode format escape character when create a data frame

2013-03-23 Thread Huidong Tian
Hi, I want to create a data frame including a column containing some special characters, like ø. when I print that data frame out, the content change to U+00F8, and when save the data frame to a txt file, the content keep in that style, but I need it in its original form, anybody can

Re: [R] boxplot

2013-03-23 Thread Janh Anni
Hello John, I apologize for the delayed response. Yes I am referring to the same type of data in the data sets. For example, the arsenic concentrations in individual groundwater monitoring wells at a groundwater contaminated site, where one well may have 12 concentration measurements, another

Re: [R] Error with custom function in apply: ”Error in FUN(newX[, i], ...) : unused argument(s) (newX[, i])”

2013-03-23 Thread Bert Gunter
Better(?): The inequalities can be vectorized and rle() can then by apply()ed on the rows: (d is your data frame. data' is a really bad name) out - d[,3:6] d[,1] d[,3:6]d[,2] a - apply(as.matrix(out),1, rle) a will be a list each component of which will have the consecutive runs information

[R] problem with pan package?

2013-03-23 Thread Dustin Fife
Hi, I'm not sure if this is a question for just the maintainer, but I'm having issues with the pan package. Using the author's example code *data(marijuana) # we only use the complete data to illustrate marijuana - subset(marijuana,!is.na(y)) attach(marijuana) pred -

[R] panel model hausman test

2013-03-23 Thread londonphd
Hi, I am trying to run panel regression using Fixed and Random effects models. I am getting the following error message after running the hausman test Fmodel=plm(gdp ~ labour+gfcf+oil+coal+gas+hydroel+nuclear+rnwable, model = within, data = new.frame,index = c(id)) Rmodel=plm(gdp ~

Re: [R] Character change to Unicode format escape character when create a data frame

2013-03-23 Thread David Winsemius
On Mar 23, 2013, at 7:08 AM, Huidong Tian wrote: Hi, I want to create a data frame including a column containing some special characters, like ø. when I print that data frame out, the content change to U+00F8, and when save the data frame to a txt file, the content keep in that style,

[R] LOOCV over SVM,KNN

2013-03-23 Thread Nicolás Sánchez
Good afternoon. I would like to know if there is any function in R to do LOOCV with these classifiers: 1)SVM 2)Neural Networks 3)C4.5 ( J48) 4)KNN Thanks a lot! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Converting a character vector to numeric

2013-03-23 Thread Christofer Bogaso
Hello again, Let say I have following vector: Vec - c(0.0365780769, (1.09738648244378), (0.812507787221523), 0.5778069963, (0.452456601362355), -1.8900812605, -1.8716093762, 0.0055217041, -0.4769192333, -2.4133018880) Now I want to convert this vector to numeric vector. I am having problem to

Re: [R] Converting a character vector to numeric

2013-03-23 Thread Rui Barradas
Hello, Try the following. It issues a warning because of the second as.numeric. (It still has the parenthesis.) ifelse(grepl(\\(, Vec), -as.numeric(sub(\\((.*)\\), \\1, Vec)), as.numeric(Vec)) Hope this helps, Rui Barradas Em 23-03-2013 19:51, Christofer Bogaso escreveu: Hello again,

Re: [R] Converting a character vector to numeric

2013-03-23 Thread arun
Hi, Try this: Vec[grepl(\\(,Vec)]-paste0(-,gsub([()],,Vec[grepl(\\(,Vec)])) as.numeric(Vec) # [1]  0.036578077 -1.097386482 -0.812507787  0.577806996 -0.452456601  #[6] -1.890081260 -1.871609376  0.005521704 -0.476919233 -2.413301888 A.K. - Original Message - From: Christofer Bogaso

Re: [R] Converting a character vector to numeric

2013-03-23 Thread Bert Gunter
Use gsub to convert the parenthesized expressions. newvec - gsub(\\((.+)\\), -\\1, Vec) If you have to do much of this, you should learn about regular expressions -- there are many good tutorials on the Web -- and stop asking for help here. Cheers, Bert On Sat, Mar 23, 2013 at 12:51 PM,

Re: [R] LOOCV over SVM,KNN

2013-03-23 Thread mxkuhn
train() in caret. See http://caret.r-forge.r-project.org/ Also, the C5.0 function in the C50 is much more effective than J48. Max On Mar 23, 2013, at 2:57 PM, Nicolás Sánchez eni...@gmail.com wrote: Good afternoon. I would like to know if there is any function in R to do LOOCV with

[R] RWeka and Back Propagation NN

2013-03-23 Thread Rui Esteves
Hello, I have a trained Back Propagation Neural Network model in weka. I would like to re-evaluate the NN using R with a given input. How can I do this? I could not find an example of RWeca that applies to NN Thanks, Rui __ R-help@r-project.org

[R] Non-convergence error for GLMM with LME4?

2013-03-23 Thread Leanna Jones
Hello! I am trying to run a GLMM using LME4, and keep getting the warning message: In mer_finalize(ans) : false convergence (8) I am quite new to R, and in looking into this thus far, it appears that there are a variety of reasons why this might occur, such as needing to standardize some

Re: [R] Non-convergence error for GLMM with LME4?

2013-03-23 Thread Bert Gunter
Post on r-sig-mixed-models not here. You also might try shortening and simplifying your post per The Posting Guide (link at the bottom of this post) to increase the chance that you'll get a reply. -- Bert On Sat, Mar 23, 2013 at 1:47 PM, Leanna Jones leanna_jo...@hotmail.comwrote: Hello! I

Re: [R] Converting a character vector to numeric

2013-03-23 Thread David Winsemius
On Mar 23, 2013, at 12:51 PM, Christofer Bogaso wrote: Hello again, Let say I have following vector: Vec - c(0.0365780769, (1.09738648244378), (0.812507787221523), 0.5778069963, (0.452456601362355), -1.8900812605, -1.8716093762, 0.0055217041, -0.4769192333, -2.4133018880) If this is to