Re: [R] Question regarding reservoir volume and water level

2024-04-09 Thread David Stevens via R-help
Water engineer here. The standard approach is to 1) get the storage vs. elevation data from the designers of the reservoir or, barring that, 2) get the bathymetry data from USBR or state DWR, or, if available, get the DEM data from USGS if the survey was done before the reservoir was built or 3

Re: [R] col2rgb() function

2023-07-23 Thread David Stevens via R-help
Nick, I've also made colors transparent by pasting the hex equivalent of, say, 0.3*256 = 76.9 to the hex color code. e.q. for black it might be "#004d" and the 4d is 77 in hex. That way you don't need to convert back and forth so much. If col is "#00" the transparent version is tcol <-

Re: [R] Plotmath isn't working for special characters

2023-01-25 Thread David Stevens
ork? I shouldn't think so, but ... Cheers, Bert On Tue, Jan 24, 2023 at 1:43 PM David Stevens mailto:david.stev...@usu.edu>> wrote: Simple expressions on plots, such as parse(text='x >= y') have been resulting in just a placeholder box (x box y and not the symbol) in my

[R] Plotmath isn't working for special characters

2023-01-24 Thread David Stevens
Simple expressions on plots, such as parse(text='x >= y') have been resulting in just a placeholder box (x box y and not the symbol) in my R plot labels in windows, R v 4.2.2. I haven't down an exhaustive test but <= and >= have this behavior. plot(1,1,main=parse(text="x >= y")) Has anyone els

Re: [R] [EXT] Re: Linestring values to vector

2022-10-21 Thread David Stevens
The way I did this recently is to look into the .dbf file that comes with the shapefile group from ESRI or your feature site, and search the feature names for the one I want. This gives you an index to use to search for the feature in the actual shapefile. Then, once the shapefile is loaded int

Re: [R] date

2019-12-19 Thread David Stevens
Val Another all-base R solution: as.Date(strptime(gs$date,format="%m/%d/%y")) or if you want to add a time field later as.POSIXct(strptime(gs$date,format="%m/%d/%y"))) since strptime produces a list version of the date: class is POSIXt and the subclass is POSIXlt, that can be convenient for e

Re: [R] Errors in R package installation

2019-12-13 Thread David Stevens
I started a new session and entered > rm(list=ls()) > install.packages( + c('lmerTest', 'quantreg', 'rmarkdown', 'SparseM'), + lib = .libPaths()[1L], + destdir = 'c:/myRLib' + ) And this is the result: There are binary versions available but the source versions are later: binary

Re: [R] Errors in R package installation

2019-12-13 Thread David Stevens
m. Best David > install.packages(c("callr", "cli", "data.table", "english", "exactRankTests", > "glmnet", "leafpop", "lmerTest", "multcomp", "plyr", "quantreg", "R.utils&q

Re: [R] Errors in R package installation

2019-12-13 Thread David Stevens
Ivan - thanks for looking into this. My answers to your comments are below. Cheers David On 12/13/2019 1:46 AM, Ivan Krylov wrote: On Thu, 12 Dec 2019 15:48:13 + David Stevens <mailto:david.stev...@usu.edu> wrote: Certain R packages will not install properly on my Windows 10 co

Re: [R] Errors in R package installation

2019-12-12 Thread David Stevens
d it. Seems good. > I think you might find the discussion here to be relevant > > https://community.rstudio.com/t/cant-install-package-remotes-when-trying-to-install-devtools/34121 > > Good luck, > Eric > > On Thu, Dec 12, 2019 at 6:08 PM David Stevens wrote: >

Re: [R] Errors in R package installation

2019-12-12 Thread David Stevens
I'm unable to discover. Best David On 12/12/2019 8:56 AM, Eric Berger wrote: Apparently it does not like that the fact that your user 'David Stevens' has a blank. Looking at the documentation ?install.packages it seems that if you modify your call to something like install.packages

[R] Errors in R package installation

2019-12-12 Thread David Stevens
exit status The downloaded source packages are in �C:\Users\David Stevens\AppData\Local\Temp\Rtmpk5NqrI\downloaded_packages� both using RStudio 1.2.5019 and the Rgui.exe 3.6.2. I look in the download folder and the callr_3.4.0.tar.gz is there but the installer can't find it. This h

Re: [R] Non-Linear Regression Help

2017-05-10 Thread David Stevens
16434. The nls() application is the easy part. Good luck David Stevens On 5/4/2017 4:58 PM, Zachary Shadomy wrote: > I am having some errors come up in my first section of code. I have no > issue in plotting the points. Is there an easier method for creating a > non-linear regression us

Re: [R] Computing growth rate

2016-12-15 Thread David Stevens
Berend - Unless you need the change in sales year by year, you might consider looking at each company's sales over the years and use regression or other type of trend analysis to get an overall trend... Or, if not, simply divide diff(sales) by diff(fyear1) for each company so at least you get t

Re: [R] warning on generic function when building R package

2015-10-27 Thread David Stevens
Sorry to be a late comer to this problem but I'm having a similar issue. My function is called by ode from deSolve ADM1_C <- function(t,state,parameters,...){ with(as.list(c(state,parameters)), { # do some stuff here and return a list containing a vector of derivatives to ode ... }) } in w

Re: [R] Make a Excel chart by R code

2015-04-15 Thread David Stevens
By this, do you mean you want to use R to send data to Excel and have Excel create the graph without your intervention, or to use R to create a graph that looks like one of those that Excel produces? David On 4/14/2015 9:54 PM, jpm miao wrote: Hi, I understand that there're many great gr

Re: [R] R vs. RStudio?

2015-01-11 Thread David Stevens
There are other R-friendly editors too. Tinn-R and Notepad++ come to mind. On 1/10/2015 11:04 PM, billy am wrote: I concur. Pls try it. -- | http://billyam.com || http://use-r.com || http://shinyserver.com (BET

Re: [R] Merge rows

2014-07-14 Thread David Stevens
acter(vnam)]]<-newvec[-1] David On 7/12/2014 8:33 AM, David Stevens wrote: This is a (very) slightly modified version of Jim's reply that takes the sender's email our of the list element and uses it as the name so it can be accessed as newdat$'senders email' or newdat[['

Re: [R] Merge rows

2014-07-12 Thread David Stevens
This is a (very) slightly modified version of Jim's reply that takes the sender's email our of the list element and uses it as the name so it can be accessed as newdat$'senders email' or newdat[['senders email']] newdat<-list() for(sndr in unique(rdvdf$sender)) { newvec<- as.character(unique

Re: [R] Population growthrate with Euler-Lotka

2014-06-30 Thread David Stevens
Mark - good on you for jumping into R with both feet. In addition to Simon's advice, the error message you are getting means that the two endpoints (r.range in your case) do not give function values that are of the opposite sign and so either the function has no roots on the interval or has an

Re: [R] saving a 'get' object in R

2014-06-25 Thread David Stevens
don't have a bunch of different objects cluttering your workspace, just a single list. On Tue, Jun 24, 2014 at 2:57 PM, David Stevens wrote: Thanks to all for the replies. I tried all three and they work great. I was misinterpreting the list = parameter in save(...) and I get your point about ov

Re: [R] saving a 'get' object in R

2014-06-24 Thread David Stevens
; wrote: I think that you are looking for the `list` argument in `save`. save( list=foo, file=paste0(foo, '.Rdata') ) In general it is best to avoid using the assign function (and get when possible). Usually there are better alternatives. On Tue, Jun 24, 2014 at 2:35 PM, David Stevens

[R] saving a 'get' object in R

2014-06-24 Thread David Stevens
;)) # though this generates " in save(get(foo), file = paste(foo, ".rData", sep = "")) : object ‘get(foo)’ not found", whereas get(foo) at the command prompt yields the contents of my.x There's a concept I'm missing here. Can anyone help? Regards D

Re: [R] minor tick marks on boxplot log scale

2014-05-07 Thread David Stevens
On closer inspection, change n=5 to n=10 in major.ticks <- pretty(lims,n=5) Then, I get 10^0, 10^1, etc. with all the minors. Is this what you want? David On 5/7/2014 10:32 AM, Shane Carey wrote: Hey, Im using the function below to create minor tick marks on log scale. It only plots every se

Re: [R] minor tick marks on boxplot log scale

2014-05-07 Thread David Stevens
060 [23] 5.698970 5.778151 5.845098 5.903090 5.954243 7.00 7.301030 7.477121 7.602060 7.698970 7.778151 [34] 7.845098 7.903090 7.954243 Note how they go from 1-2, then 3-4, 5-6, etc skipping every other decade. Check the lines that produce minor.ticks David Stevens On 5/7/2014 10:32 AM, Sh

Re: [R] plots

2014-03-14 Thread David Stevens
David Carlson's solution is obviously better! (sorry, I just saw it) David Stevens On 3/14/2014 4:57 PM, David Stevens wrote: Renalda - your figure got stripped out. I'll assume you mean to have depth on the vertical axis with a zero at the top and increasing (+) depth as you go

Re: [R] plots

2014-03-14 Thread David Stevens
4,6,8,10),labels=c(0,2,4,6,8,10) )# if you want labels at 0,2,4,6,8,10 David Stevens Good luck On 3/14/2014 1:55 AM, Renalda Munubi-Misinzo wrote: I would like to have a plot with values in a reversed order (as shown in fig 2). I tried to plot the graph in R using the following codes plot(densi

[R] cluster package - Installation problems

2013-07-15 Thread David Stevens
Group - I'm having problems with the 'cluster' package. Installation appears successful but attempts to load it with either library() or require() result in the error message Error in library(cluster) : there is no package called ‘cluster’ All that appears to be installed is cluster.dll in the

[R] Axis scaling for pairs plots

2013-07-09 Thread David Stevens
I have a question concerning axis scaling for pairs plots. My data set has columns with differing units and I want a pairs plot with scatter+an lm line+a correlation confidence ellipse for each lower panel. The 95% confidence ellipse (using the ellipse package+a polygon) gives me an ellipse tha

[R] lines with colored segments

2012-11-04 Thread David Stevens
Hello all I'm trying to create a plot similar to a plot.default(..., type='b') with points plotted connected by lines that leave small gaps between the end of the line and the point symbol, BUT, with each line segment's color controlled by a category. plot... draws the line color uniformly acc

Re: [R] rJava install - "%1 is not a valid Win32 application."

2012-10-24 Thread David Stevens
on of Java directly from Oracle. I then tried to load the rJava library and got Error : .onLoad failed in loadNamespace() for 'rJava', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable to load shared object 'D:/Users/David Stevens/Documents/R/win-lib

Re: [R] VarCorr procedure from lme4

2012-05-01 Thread David Stevens
That was it - detaching 'nlme' was the trick. Thanks Walmes and the rest. David On 5/1/2012 7:47 PM, David Stevens wrote: > Yes - I also have nlme. Bad juju? > > David > > On 5/1/2012 1:32 PM, Walmes Zeviani wrote: >> It could be a bad coexistence between pack

Re: [R] VarCorr procedure from lme4

2012-05-01 Thread David Stevens
Yes - I also have nlme. Bad juju? David On 5/1/2012 1:32 PM, Walmes Zeviani wrote: > It could be a bad coexistence between packages in the same R session. Are > you using nlme and/or doBy packages too? > > Bests. > Walmes. > > =

[R] VarCorr procedure from lme4

2012-05-01 Thread David Stevens
Folks In trying to use lmer for a hierarchical model, I encountered the following message: Error in UseMethod("VarCorr") : no applicable method for 'VarCorr' applied to an object of class "mer" foo.mer <- lmer(y ~ TP + (TP|M),data=joe.q) > head(joe.q[,1:5]) TP M AB Trty 1 1

[R] Filling matrices

2012-03-19 Thread David Stevens
I'm a bit clumsy about many things in R. Here's my problem. I'm trying to build a square sparse matrix and populate it without looping (bad practice, right). I have vectors of matched row/column pairs for which the matrix entries have common characteristics and am look for a way to fill the ent

[R] path enumeration in a graph

2012-02-07 Thread David Stevens
I'm dipping my toe in graph theory and found that R has a rich collection of network and graph tools. However, I can't seem to put my finger on the solution to my problem. There are several procedures available in R for finding a shortest path along edges between vertices based on the cost of t

Re: [R] combining data structures

2012-02-04 Thread David Stevens
Thanks for the reply. Two things - I must have something missing because copying and pasting your example gave me an error ... your definitions of nn Output = do.call(as.data.frame(rbind),nn) Error in as.data.frame.default(rbind) : cannot coerce class '"function"' into a data.frame The se

[R] combining data structures

2012-02-03 Thread David Stevens
Group It's unlikely I'm trying this the best way, but I'm trying to create a data structure from elements like nNode = 2 nn = vector("list",nNode) nn[[1]] = list(Node = "1", Connect.up = c(NULL), Connect.down = c(2,3)) nn[[2]] = list(Node = "2", Connect.up = c(1), Connect.down = c(4,5))

Re: [R] problem in fitting model in NLS function

2012-01-31 Thread David Stevens
are noisy. Kudos for replication though. Let us know how it works out. David Stevens On 1/31/2012 7:11 AM, ram basnet wrote: > Dear R users, > > I am struggling to fit expo-linear equation to my data using "nls" function. > I am always getting error message as i highlighted bel

Re: [R] Easier way to do this?

2012-01-31 Thread David Stevens
has a bunch of other useful experimental design goodies. David Stevens On 1/31/2012 12:34 PM, Sarah Goslee wrote: > Which part? This might help: > rep(1:5, each=9) > > > On Tue, Jan 31, 2012 at 1:22 PM, Daniel Negusse > wrote: >> can someone tell me if there is an easier w

Re: [R] detecting noise in data?

2012-01-24 Thread David Stevens
New York. This type of discovery can feed into the prespecifying of groups and cluster analysis as Bert suggested. It might be an independent way. I've done similar analysis using R but I don't know of any packages. It isn't difficult to code. David Stevens On 1/24/2012 4:12 P

Re: [R] Solving Equations

2012-01-22 Thread David Stevens
nd automatically by > > install.packages("XML") > > and it was when I just tried it. Perhaps David has "CRAN (extras)" > disabled in his list of selected repositories? > > Duncan Murdoch > >> >> Michael >> >> On Sun, Jan 22,

Re: [R] Solving Equations

2012-01-22 Thread David Stevens
ontrib/r-release/ReadMe > > but it suggests builds are available from Prof Ripley (to whom be > honor and praise for ever and ever, amen!) here: > http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.14/ > > Michael > > On Sun, Jan 22, 2012 at 3:52 PM, David Stevens wro

Re: [R] Solving Equations

2012-01-22 Thread David Stevens
http://www.omegahat.org/R";) but got Installing package(s) into 'D:/Users/David Stevens/Documents/R/win-library/2.14' (as 'lib' is unspecified) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package 'XML' is not available (for R versio

Re: [R] Calling Fortran from R: Issues with dynamic loading of fortran dll

2012-01-16 Thread David Stevens
lly about differences between 32- and 64-bit code that comes from the compilers and interfaces between R and shared libraries Any and all help is appreciated! David On 1/16/2012 7:37 AM, Duncan Murdoch wrote: > On 16/01/2012 8:55 AM, David Stevens wrote: >> I installed RTools -

Re: [R] Calling Fortran from R: Issues with dynamic loading of fortran dll

2012-01-16 Thread David Stevens
esponse/foo.dll': LoadLibrary failure: %1 is not a valid Win32 application. Any thoughts? David S On 1/15/2012 5:09 PM, Duncan Murdoch wrote: > On 12-01-15 5:34 PM, David Stevens wrote: >> I successfully used .Fortran to load and execute my fortran procedures >> unde

[R] Calling Fortran from R: Issues with dynamic loading of fortran dll

2012-01-15 Thread David Stevens
I successfully used .Fortran to load and execute my fortran procedures under WinXP and 32 bit R. Alas, the same isn't true with my next Windows 7/64 machine, R 2.14.1 (64 bit) and the gnu gfortran (64) compiler (mingw64 v. 4.6.1). Though I'm able to compile the routines from the command line us

Re: [R] Create variable with AND IF statement

2012-01-02 Thread David Stevens
Could it be if(variable1.fac == 0 & variable2.num == 0) {variable3 = 1} # brackets {} aren't strictly required for a one liner. if(variable1.fac == 0 & variable2.num >= 0) {variable3 = 2} # brackets {} aren't strictly required for a one liner. if(variable1.fac == 1 & variable2.nu

Re: [R] Estimating model parameters for system of equations

2011-11-15 Thread David Stevens
iance with normality, independence, and constant variance. 5. Collect Nobel prize! This is one approach I've used with success. There are others, as hinted at by Arne. Good luck - keep us posted on how it goes. Regards David Stevens On 11/15/2011 12:17 PM, Arne Henningsen wrote: >

Re: [R] nonlinear model

2011-10-24 Thread David Stevens
#x27;re problem is more fundamental. Plot the data, then plot a line that follows your model and ask yourself whether the model looks like the data. Good luck David Stevens On 10/24/2011 8:47 AM, mitra Rahmati wrote: > mod = nls(A~ Amax * (1-exp(-b*Pot)),start=list(Amax=10,b=0.003))

Re: [R] assign using =

2011-06-27 Thread David Stevens
I'm not an expert but some third party libraries won't recognize = as an assignment for some objects (I learned this empirically) when the assignment is made within a function. Using <- protects you from these unknows, as you have discovered on your own. Regards David On 6/27/2011 8:34 AM, Be