Re: [R] how to calculate a numeric's digits count?

2014-10-23 Thread PO SU
Ok,  what i want is  find how many numbers after  . in a numeric ,and i don't know if there is already exists a function to do it( i wrote one by myself which will be showed later). e.g. 1.234 has 3 numbers after . 1 has 0 number 1.5342 has 4 numbers And i solved the above format using: find<-

Re: [R] Installing gWidgetsRGtk2: R session is headless

2014-10-23 Thread Rainer Schuermann
Michael, thanks, that was it! I had installed the packages as root and tried them out as root (not a good idea I know, but I was lazy), while running the the X11 display as user. Worse is that I have done that many times. One more thing learned. Thanks again, Rainer On Thursday 23 October 2014

Re: [R] how to calculate a numeric's digits count?

2014-10-23 Thread Jeff Newmiller
I am baffled. I think those were English words but they didn't make any sense to me. Not was there a reproducible example to turn to. Can you try again? --- Jeff NewmillerThe . . Go L

[R] Clarification on debug output

2014-10-23 Thread Mick Jordan
I hope someone can explain what the #1 means (and for that matter the [2] in the debug output below. I can't find anything in the spec that explains what they mean. Thanks > f(1) debugging in: f(1) debugging in: f() debug at #1: { if (x < 0) -x else x } Browse[2]> __

[R] how to calculate a numeric's digits count?

2014-10-23 Thread PO SU
Dear usRers,   Now i want to cal ,e.g.  cal(1.234)  will get 3  cal(1) will get 0  cal(1.3045) will get 4  But the difficult part is cal(1.3450) will get 4 not 3. So, is there anyone happen to know the solution to this problem, or it can't be solved in R, because 1.340 will always be transformed

Re: [R] Help with GLM starting values in user defined link function

2014-10-23 Thread Andrew.Hoskins
Hi Ken, Many thanks for your advice. Earlier this morning I stepped my way through the glm.fit function to see where things were falling over and realised that first and foremost I had my link function wrong (link and inverse were back to front). I've now fixed this and can get the model to

Re: [R] Interpolate through NAs using monotonic smoothing spline

2014-10-23 Thread Jeff Newmiller
A very limited set of attachment types are allowed on this list.. yours was not one of them. Reading the Posting Guide will inform you about many useful things. Self-contained R code is the expected mode of communication here. >From your description, you might consider monotonic spline fitting t

[R] dotplot with library lattice

2014-10-23 Thread Matthias Weber
Hello together, i have a short question. Maybe anyone can help me to create a barplot in R with the package lattice. I have the following data as ouput values and the following code: Data (d): KOST BudgetIST 1060 -2.18 0 1080 9

[R] Interpolate through NAs using monotonic smoothing spline

2014-10-23 Thread Ingrid Charvet
In the figure attached "test", I would like to interpolate the empty - "NA" section to connect the two curves. 1/ I tried using "na.approx" and "na.spline", without success. na.approx(test,na.rm=FALSE) na.spline(test,na.rm=FALSE) In the first case it just draws a straight line between the end a

[R] OpenStreetMapR

2014-10-23 Thread Theodore Van Rooy
Hi All, This isn't a request for help. I just wanted to post that we've recently completed a new package for R which allows you to do Open Street Map plotting via Leaflet. It's not on CRAN (yet), but it is on Github. http://greentheo.github.io/OpenStreetMapR/ Theodore Van Rooy royaltyanalytics

[R] Heatmap - strange horizontal lines

2014-10-23 Thread zuzana zajkova
Dear list, I would like to make heatmaps from my data. Acctualy, I have already done it, but the issue it that is doesn't work well for all files. All files have the same structure, after importing them I do few calculations using the same script, to obtain variables for plotting. You can find t

Re: [R] Installing gWidgetsRGtk2: R session is headless

2014-10-23 Thread Michael Lawrence
Perhaps this is a permissions (Xauthority) issue: is the same user running both the X11 display and the R session? On Thu, Oct 23, 2014 at 2:40 AM, R wrote: > I have written some gWidgets scripts before in the past but have a > different box now (Debian KWheezy) and cannot get gWidgets working

Re: [R] Computing Water Balance using a loop.

2014-10-23 Thread MacQueen, Don
If I understand the problem correctly, then I’d suggest this: ndays <- nrow(Wb30) for (iday in 2:ndays) { Wb30$Water_Balance[iday] <- Wb30$Water_Balance[iday-1] + Wb30$Rainfall[iday] - Wb30$Evaporation[iday] Wb30$Water_Balance[iday] <- min(Wb30$Water_Balance[iday], 100) Wb30$Water_Ba

Re: [R] Apply Function to Columns

2014-10-23 Thread Rui Barradas
Hello, Yes, you can use lapply. Maybe something like the following. Note that the result is a list with one member per species. (Untested). ddeg.correlog.list <- lapply(9:11, function(p) correlog(plant[plant[,p]=="1", 2], plant[plant[,p]=="1", 3], plant[plant[,p]=="1", 4])) Hope this help

[R] Apply Function to Columns

2014-10-23 Thread Sarah
Hello List, I have a database which consist of 912 plots. For each plot, I have the presence/absence information of 260 species of plants and also 5 different environmental variables (ddeg, mind, srad, slp, topo). The dataframe looks like this: Plot_NumberX Y ddeg mi

Re: [R] Help with GLM starting values in user defined link function

2014-10-23 Thread Ken Knoblauch
csiro.au> writes: > I'm trying to fit a binomial GLM with user defined link function (negative exponential), however I seem to > be unable to find the correct starting values to initialise such a model. I've tried taking starting > values from a logistic and log models fit to the same data an

[R] Problem getting Option Quotes

2014-10-23 Thread Robert Sherry
I am using R and quantmod to get stock and option quotes. However, it has stopped working. I expect the following function call to produce a list of options: getOptionChain( "XOM", Exp = "2015-01-20" ) However, I get the following error messages: Error in lapply(strsplit(opt, ""), f

Re: [R] Computing Water Balance using a loop.

2014-10-23 Thread Jeff Newmiller
Sorry... That last expression was backward... Wb30$ValidWB <- with( Wb30, 0 == cumsum( Water_Balance < 0 | 100 < Water_Balance ) ) --- Jeff NewmillerThe . . Go Live... DCN:B

Re: [R] Computing Water Balance using a loop.

2014-10-23 Thread Jeff Newmiller
Counting chickens after they have left the coop is not going to work. If your inputs push w outside the limits of physics then your input data are invalid. Arbitrarily forcing w to fit in that case partially ignores the inputs anyway... and since there are many ways for the data to be invalid yo

Re: [R] Computing Water Balance using a loop.

2014-10-23 Thread Frederic Ntirenganya
Dear Duncan, Those condition should be there and also look at Rainfall and evaporation columns. If i change it to be like the following loop, it can't do it. The problem is how to include those conditions and also respect the formula? wb=c() for (w in 1:length(Wb30$Water_Balance)){ if(w<0){

Re: [R] Help Getting the Price of Gold

2014-10-23 Thread Duncan Murdoch
On 23/10/2014, 8:56 AM, Robert Sherry wrote: > I am trying to get the current price of gold for my application. I am > using the library quantmod. The > R commands I use are: > getMetals(c('XAU'), from=Sys.Date(), autoassign = FALSE ) > XAUUSD$XAU.USD[1,1] > > I would expect the value

[R] Help Getting the Price of Gold

2014-10-23 Thread Robert Sherry
I am trying to get the current price of gold for my application. I am using the library quantmod. The R commands I use are: getMetals(c('XAU'), from=Sys.Date(), autoassign = FALSE ) XAUUSD$XAU.USD[1,1] I would expect the value in XAUUSD$XAU.USD[1,1] to be a scalar but it comes back

Re: [R] Computing Water Balance using a loop.

2014-10-23 Thread Duncan Murdoch
On 23/10/2014, 8:33 AM, Frederic Ntirenganya wrote: > Dear All, > > I want to calculate water balance using the following formula: > Water balance today = Water balance yesterday + Rainfall − Evaporation > > This is a sample of data I am using: > > head(Wb30) > May Rainfall Evaporation Water_B

[R] Computing Water Balance using a loop.

2014-10-23 Thread Frederic Ntirenganya
Dear All, I want to calculate water balance using the following formula: Water balance today = Water balance yesterday + Rainfall − Evaporation This is a sample of data I am using: head(Wb30) May Rainfall Evaporation Water_Balance 1 70 5 0 2 8 10

Re: [R] assignment 2 part 1,2,3

2014-10-23 Thread S Ellison
> I am not taking this course for a grade, just self interest. I am stock with > making the function. is there any where I can see how is done. Go to the HTML help for R and read "An Introduction to R", section 10, "Writing your own functions" (the clue's in the title). Don't miss out section 10

Re: [R] Merge of the rows by finding the sum of the rows

2014-10-23 Thread Rui Barradas
Hello, Try aggregate(Rain ~ Year + Month, data = dat, FUN = sum) Hope this helps, Rui Barradas Em 23-10-2014 01:29, Hafizuddin Arshad escreveu: Dear R users, Can someone help me on this? I would like to find the sum of the Rain if the Month appears more than once. For example in row 3 and

[R] Installing gWidgetsRGtk2: R session is headless

2014-10-23 Thread R
I have written some gWidgets scripts before in the past but have a different box now (Debian KWheezy) and cannot get gWidgets working. It may be an obvious mistake but auntie Google (who has helped me a lot to get as far as I am now) leaves me in the dark now. Here is where I am stuck: - - - - -

Re: [R] Fwd: as.POSIXlt() Function

2014-10-23 Thread Vasantha Kumar Kesavan
PST8PDT is the valid timezone in my machine and I have verified it. I am followed your suggestion. there is no difference in the output. *> Sys.setenv(TZ="America/Los_Angeles");* *> Sys.getenv("TZ");* * TZ * *"America/Los_Angeles" * *> as.POSIXlt(Sys.Date());* *[1] "2014-10-22