[R] Best settings for RStudio video recording?

2020-08-13 Thread Jonathan Greenberg
Folks: I was wondering if you all would suggest some helpful RStudio configurations that make recording a session via e.g. zoom the most useful for students doing remote learning. Thoughts? --j -- Jonathan A. Greenberg, PhD Randall Endowed Professor and Associate Professor of Remote Sensing

[R] Checking for a proper "stop" statement...

2018-02-21 Thread Jonathan Greenberg
Folks: Consider the following two use cases: goodfunction <- function() { stop("Something went wrong..." } # vs. badfunction <- function() { notgood() } Is there a way for me to test if the functions make use of a stop() statement WITHOUT modifying the stop() output (assume I can't mod the

[R] R command to open a file browser on Windows and Mac?

2015-08-03 Thread Jonathan Greenberg
Folks: Is there an easy function to open a finder window (on mac) or windows explorer window (on windows) given an input folder? A lot of times I want to be able to see via a file browser my working directory. Is there a good R hack to do this? --j [[alternative HTML version deleted]]

[R] table over a matrix dimension...

2014-07-10 Thread Jonathan Greenberg
R-helpers: I'm trying to determine the frequency of characters for a matrix applied to a single dimension, and generate a matrix as an output. I've come up with a solution, but it appears inelegant -- I was wondering if there is an easier way to accomplish this task: # Create a matrix of factors

[R] StatET and R 3.1.0

2014-04-11 Thread Jonathan Greenberg
R-helpers: I posted a message to the statet listserv, but I thought I'd ask here as well since it is one of the major R developer environments-- has anyone gotten the StatET plugin for Eclipse working with R 3.1.0 yet? Any tricks? I did manage to get rj updated to 2.0 via:

Re: [R] Ignore escape characters in a string...

2014-04-09 Thread Jonathan Greenberg
#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On April 8, 2014 8:00:03 AM PDT, Jonathan Greenberg j...@illinois.edu wrote: R-helpers

[R] Ignore escape characters in a string...

2014-04-08 Thread Jonathan Greenberg
R-helpers: One of the minor irritations I have is copying paths from Windows explorer, which look like: C:\Program Files\R\R-3.0.3 and using them in a setwd() statement, since the \ is, of course, interpreted as an escape character. I have to, at present, manually add in the double slashes or

[R] numeric to factor via lookup table

2014-03-28 Thread Jonathan Greenberg
R-helpers: Hopefully this is an easy one. Given a lookup table: mylevels - data.frame(ID=1:10,code=letters[1:10]) And a set of values (note these do not completely cover the mylevels range): values - c(1,2,5,5,10) How do I convert values to a factor object, using the mylevels to define the

Re: [R] Overriding predict based on newdata...

2014-03-18 Thread Jonathan Greenberg
through the rest of the session and could be source()-ed in further sessions. -- David. On Mar 16, 2014, at 2:09 PM, Jonathan Greenberg wrote: R-helpers: I'm having some trouble with this one -- I figure because I'm a bit of a noob with S3 classes... Here's my challenge: I want

[R] Overriding predict based on newdata...

2014-03-16 Thread Jonathan Greenberg
R-helpers: I'm having some trouble with this one -- I figure because I'm a bit of a noob with S3 classes... Here's my challenge: I want to write a custom predict statement that is triggered based on the presence and class of a *newdata* parameter (not the object parameter). The reason is I am

[R] install packages from R-forge SVN

2014-02-26 Thread Jonathan Greenberg
R-helpers: I was curious if anyone developed a package/approach to installing packages directly from the R-forge SVN subsystem (rather than waiting for it to build)? I can, of course, SVN it command line but I was hoping for an install.packages(svn://) sort of approach. Cheers! --j --

[R] Checking for and adding ... arguments to a function...

2014-02-17 Thread Jonathan Greenberg
R-helpers: I'm guessing this is an easy one for some of you, but I'm a bit stumped. Given some arbitrary function (doesn't matter what it does): myfunction - function(a,b,c) { return(a+b+c) } I want to test this function for the presence of the ellipses (...) and, if they are missing, create a

Re: [R] Official way to set/retrieve options in packages?

2013-10-18 Thread Jonathan Greenberg
))) options(survey.multicore = FALSE) if (is.null(getOption(survey.replicates.mse))) options(survey.replicates.mse = FALSE) } environment: namespace:survey On Sat, Jun 1, 2013 at 4:01 PM, Jonathan Greenberg j...@illinois.eduwrote: R-helpers: Say I'm developing a package that has a set

Re: [R] Error: C stack usage is too close to the limit when using list.files()

2013-09-28 Thread Jonathan Greenberg
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Friday, September 27, 2013 12:56 PM To: Jonathan Greenberg; r-help Subject: Re: [R] Error: C stack usage is too close to the limit when using list.files() Do

[R] Error: C stack usage is too close to the limit when using list.files()

2013-09-27 Thread Jonathan Greenberg
R-helpers: I'm running a file search on my entire drive (Mac OS X) using: files_found - list.files(dir=/,pattern=somepattern,recursive=TRUE,full.names=TRUE) where somepattern is a search pattern (which I have confirmed via a unix find / -name somepattern only returns ~ 3 results). I keep

Re: [R] Error: C stack usage is too close to the limit when using list.files()

2013-09-27 Thread Jonathan Greenberg
... On Fri, Sep 27, 2013 at 2:36 PM, Ben Bolker bbol...@gmail.com wrote: Jonathan Greenberg jgrn at illinois.edu writes: R-helpers: I'm running a file search on my entire drive (Mac OS X) using: files_found - list.files(dir=/,pattern=somepattern,recursive=TRUE,full.names=TRUE) where

[R] library() and install.packages() no longer working (Access is denied error)

2013-09-13 Thread Jonathan Greenberg
In the last week, SOMETHING on my system must have changed because when trying to library() or install.packages() on R 3.0.1 x64 on a Windows 2008 R2 server: library(raster) Error in normalizePath(path.expand(path), winslash, mustWork) : path[1]=D:/Users/[UID]/Documents/R/win-library/3.0:

[R] ifelse question (I'm not sure why this is working)...

2013-09-10 Thread Jonathan Greenberg
R-helpers: One of my intrepid students came up with a solution to a problem where they need to write a function that takes a vector x and a scalar d, and return the indices of the vector x where x %% d is equal to 0 (x is evenly divisible by d). I thought I had a good handle on the potential

[R] Vectorized version of colMeans/rowMeans for higher dimension arrays?

2013-08-29 Thread Jonathan Greenberg
For matrices, colMeans/rowMeans are quick, vectorized functions. But say I have a higher dimensional array: moo - array(runif(400*9*3),dim=c(400,9,3)) And I want to get the mean along the 2nd dimension. I can, of course, use apply: moo1 - apply(moo,c(1,3),mean) But this is not a vectorized

[R] Determining the maximum memory usage of a function

2013-06-20 Thread Jonathan Greenberg
Folks: I apologize for the cross-posting between r-help and r-sig-hpc, but I figured this question was relevant to both lists. I'm writing a function to be applied to an input dataset that will be broken up into chunks for memory management reasons and for parallel execution. I am trying to

Re: [R] Determining the maximum memory usage of a function

2013-06-20 Thread Jonathan Greenberg
, Jonathan Greenberg j...@illinois.edu wrote: Folks: I apologize for the cross-posting between r-help and r-sig-hpc, but I figured this question was relevant to both lists. I'm writing a function to be applied to an input dataset that will be broken up into chunks for memory management reasons

Re: [R] Official way to set/retrieve options in packages?

2013-06-02 Thread Jonathan Greenberg
: namespace:survey On Sat, Jun 1, 2013 at 4:01 PM, Jonathan Greenberg j...@illinois.edu wrote: R-helpers: Say I'm developing a package that has a set of user-definable options that I would like to be persistent across R-invocations (they are saved someplace). Of course, I can

[R] Official way to set/retrieve options in packages?

2013-06-01 Thread Jonathan Greenberg
R-helpers: Say I'm developing a package that has a set of user-definable options that I would like to be persistent across R-invocations (they are saved someplace). Of course, I can create a little text file to be written/read, but I was wondering if there is an officially sanctioned way to do

[R] RCurl: using ls instead of NLST

2013-05-29 Thread Jonathan Greenberg
R-helpers: I'm trying to retrieve the contents of a directory from an ftp site (ideally, the file/folder names as a character vector): ftp://e4ftl01.cr.usgs.gov/MOTA/MCD12C1.005/; # (MODIS data) Where I get the following error via RCurl: require(RCurl) url -

Re: [R] Singular design matrix in rq

2013-04-19 Thread Jonathan Greenberg
Roger: Doh! Just realized I had that error in the code -- raw_data is the same as mydata, so it should be: mydata - read.csv(singular.csv) plot(mydata$predictor,mydata$response) # A big cloud of points, nothing too weird summary(mydata) # No NAs: # Xresponse predictor

[R] Singular design matrix in rq

2013-04-16 Thread Jonathan Greenberg
Quantreggers: I'm trying to run rq() on a dataset I posted at: https://docs.google.com/file/d/0B8Kij67bij_ASUpfcmJ4LTFEUUk/edit?usp=sharing (it's a 1500kb csv file named singular.csv) and am getting the following error: mydata - read.csv(singular.csv) fit_spl - rq(raw_data[,1] ~

[R] Check if a character vector can be coerced to numeric?

2013-03-21 Thread Jonathan Greenberg
Given an arbitrary set of character vectors: myvect1 - c(abc,3,4) myvect2 - c(2,3,4) I would like to develop a function that will convert any vectors that can be PROPERLY converted to a numeric (myvect2) into a numeric, but leaves character vectors which cannot be converted (myvect1) alone. Is

Re: [R] Check if a character vector can be coerced to numeric?

2013-03-21 Thread Jonathan Greenberg
Yep, type.convert was exactly what I was looking for (with as.is=TRUE). Thanks! On Thu, Mar 21, 2013 at 1:31 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 21/03/2013 18:20, Jonathan Greenberg wrote: Given an arbitrary set of character vectors: myvect1 - c(abc,3,4) myvect2 - c

Re: [R] Loading a list into the environment

2013-02-02 Thread Jonathan Greenberg
, Rui Barradas Em 01-02-2013 22:24, Jonathan Greenberg escreveu: R-helpers: Say I have a list: myvariables - list(a=1:10,b=20) Is there a way to load the list components into the environment as variables based on the component names? i.e. by applying this theoretical function

[R] Loading a list into the environment

2013-02-01 Thread Jonathan Greenberg
R-helpers: Say I have a list: myvariables - list(a=1:10,b=20) Is there a way to load the list components into the environment as variables based on the component names? i.e. by applying this theoretical function to myvariables I would have the variables a and b loaded into the environment

Re: [R] Adding a line to barchart

2013-01-23 Thread Jonathan Greenberg
- project.org] On Behalf Of Jonathan Greenberg Sent: Tuesday, January 22, 2013 11:42 PM To: r-help Subject: [R] Adding a line to barchart R-helpers: I need a quick help with the following graph (I'm a lattice newbie): require(lattice) npp=1:5 names(npp)=c(A,B,C,D,E) barchart

[R] Adding a line to barchart

2013-01-22 Thread Jonathan Greenberg
R-helpers: I need a quick help with the following graph (I'm a lattice newbie): require(lattice) npp=1:5 names(npp)=c(A,B,C,D,E) barchart(npp,origin=0,box.width=1) # What I want to do, is add a single vertical line positioned at x = 2 that lays over the bars (say, using a dotted line). How do

[R] Best way to coerce numerical data to a predetermined histogram bin?

2012-12-06 Thread Jonathan Greenberg
Folks: Say I have a set of histogram breaks: breaks=c(1:10,15) # With bin ids: bin_ids=1:(length(breaks)-1) # and some data (note that some of it falls outside the breaks: data=runif(min=1,max=20,n=100) *** What is the MOST EFFICIENT way to classify data into the histogram bins (return the

[R] Best R textbook for undergraduates

2012-10-23 Thread Jonathan Greenberg
R-helpers: I'm sure this question has been asked and answered through the ages, but given there are some new textbooks out there, I wanted to re-pose it. For a course that will cover the application of R for general computing and spatial modeling, what textbook would be best to introduce

[R] Completely ignoring an error in a function...

2012-10-17 Thread Jonathan Greenberg
The code base is a bit too complicated to paste in here, but the gist of my question is this: given I have a function myfunction - function(x) { # Do something A # Do something B # Do something C } Say #Do something B returns this error: Error in cat(list(...), file, sep, fill, labels, append) :

Re: [R] [R-sig-hpc] Quickest way to make a large empty file on disk?

2012-09-28 Thread Jonathan Greenberg
1Kb in size. Hope this helps, Rui Barradas Em 27-09-2012 20:17, Jonathan Greenberg escreveu: Folks: Asked this question some time ago, and found what appeared (at first) to be the best solution, but I'm now finding a new problem. First off, it seemed like ff as Jens suggested worked

Re: [R] [R-sig-hpc] Quickest way to make a large empty file on disk?

2012-09-27 Thread Jonathan Greenberg
the filesystem can handle). However, length appears to be restricted by .Machine$integer.max (I'm on a 64-bit windows box): .Machine$integer.max [1] 2147483647 Any suggestions on how to solve this problem for much larger file sizes? --j On Thu, May 3, 2012 at 10:44 AM, Jonathan Greenberg j

[R] Dummies guide to getting HPC working on R

2012-06-03 Thread Jonathan Greenberg
R-folks: Sorry for the cross-posting, but I wanted to share a link to a (fairly long) blog post I created which tries to take the mystery out of getting R setup for doing high performance/parallel computing if you have to compile R from scratch:

[R] Dummies guide to getting HPC working on R

2012-06-03 Thread Jonathan Greenberg
R-folks. Sorry for the cross-posting, but I wanted to share a link to a (fairly long) blog post I created which tries to take the mystery out of getting R setup for doing high performance/parallel computing if you have to compile R from scratch:

Re: [R] [R-sig-hpc] Quickest way to make a large empty file on disk?

2012-05-03 Thread Jonathan Greenberg
() *Gesendet:* Donnerstag, 03. Mai 2012 um 00:23 Uhr *Von:* Jonathan Greenberg j...@illinois.edu *An:* r-help r-help@r-project.org, r-sig-...@r-project.org *Betreff:* [R-sig-hpc] Quickest way to make a large empty file on disk? R-helpers: What would be the absolute fastest way to make a large empty file

[R] Quickest way to make a large empty file on disk?

2012-05-02 Thread Jonathan Greenberg
R-helpers: What would be the absolute fastest way to make a large empty file (e.g. filled with all zeroes) on disk, given a byte size and a given number number of empty values. I know I can use writeBin, but the object in this case may be far too large to store in main memory. I'm asking

Re: [R] Solve an ordinary or generalized eigenvalue problem in R?

2012-04-23 Thread Jonathan Greenberg
, Jonathan Greenberg wrote: Thanks all (particularly to you, Berend) -- I'll push forward with these solutions and integrate them into my code. I did come across geigen while rooting around in the CCA code but its not formally documented (it just says for internal use or something along those

Re: [R] Solve an ordinary or generalized eigenvalue problem in R?

2012-04-22 Thread Jonathan Greenberg
Thanks all (particularly to you, Berend) -- I'll push forward with these solutions and integrate them into my code. I did come across geigen while rooting around in the CCA code but its not formally documented (it just says for internal use or something along those lines) and as you found out

Re: [R] Solve an ordinary or generalized eigenvalue problem in R?

2012-04-20 Thread Jonathan Greenberg
int* ldvl, double* vr, const int* ldvr, double* work, const int* lwork, int* info); Any ideas? --j On Fri, Apr 20, 2012 at 1:37 AM, Berend Hasselman b...@xs4all.nl wrote: On 19-04-2012, at 20:50, Jonathan Greenberg wrote: Folks: I'm trying to port some code from python over to R

Re: [R] Solve an ordinary or generalized eigenvalue problem in R?

2012-04-20 Thread Jonathan Greenberg
) LAPACK's documentation is: http://www.netlib.org/lapack/double/dggev.f --j On Fri, Apr 20, 2012 at 11:58 AM, Jonathan Greenberg j...@illinois.eduwrote: So I am a complete noob at doing this type of linking. When I write this statement (all the input values are assigned, but I have to confess I

Re: [R] Solve an ordinary or generalized eigenvalue problem in R?

2012-04-20 Thread Jonathan Greenberg
$GENEIGENVALUES=(Rdggev_out$ALPHAR+Rdggev_out$ALPHAI)/Rdggev_out$BETA return(Rdggev_out) } On Fri, Apr 20, 2012 at 12:01 PM, Jonathan Greenberg j...@illinois.eduwrote: Incidentally, if you want to test this out: A [,1] [,2] [,3] [1,] 1457.738 1053.181 1256.953 [2,] 1053.181

Re: [R] Solve an ordinary or generalized eigenvalue problem in R?

2012-04-20 Thread Jonathan Greenberg
My apologies: When reviewing my initial email I made a typo -- what I needed was dggev, not dgeev. I have confirmed that my function reproduces the scipy outputs I mentioned in my first email. The function is part of lapack. I'm not an R noob, I just haven't dealt with external Fortran or C

[R] Solve an ordinary or generalized eigenvalue problem in R?

2012-04-19 Thread Jonathan Greenberg
Folks: I'm trying to port some code from python over to R, and I'm running into a wall finding R code that can solve a generalized eigenvalue problem following this function model: http://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eig.html Any ideas? I don't want to call python

[R] Listing the contents of an FTP directory via R?

2012-04-09 Thread Jonathan Greenberg
R-helpers: I'd like to be able to store all the file information from an ftp site (e.g. file and foldernames) through an R command. Any ideas how to do this? Here's an example site to use: ftp://e4ftl01.cr.usgs.gov/MOTA/MCD15A3.005 --j -- Jonathan A. Greenberg, PhD Assistant Professor

Re: [R] Listing the contents of an FTP directory via R?

2012-04-09 Thread Jonathan Greenberg
wrote: A couple of ways. using Rcurl   you can use the  curlOption of dirlistonly. otherwise you can read the page and parse.  I've got some code around here to do that. Steve On Mon, Apr 9, 2012 at 11:27 AM, Jonathan Greenberg j...@illinois.edu wrote: R-helpers: I'd like to be able

Re: [R] Listing the contents of an FTP directory via R?

2012-04-09 Thread Jonathan Greenberg
:45 PM, steven mosher mosherste...@gmail.com wrote: Ya I hit the same error with my code that reads directories. I'll try some other stuff . I think I hit this error before I  with usgs. On Mon, Apr 9, 2012 at 11:40 AM, Jonathan Greenberg j...@illinois.edu wrote: Steven: Thanks -- I seem

[R] Best way to search r- functions and mailing list?

2012-04-05 Thread Jonathan Greenberg
R-helpers: It looks like http://finzi.psych.upenn.edu/search.html has stopped spidering the mailing lists -- this used to be my go-to site for searching for R solutions. Are there any good replacements for this? I want to be able to search both functions and mailing lists at the same time.

[R] Parallel writes in R

2012-04-02 Thread Jonathan Greenberg
R-helpers: I'm curious what support R has for parallel writes to a binary file? If I want to use snow to have each node write different rows of a flat binary file (possibly out of sequence), are there any tricks/issues I should be aware of? --j -- Jonathan A. Greenberg, PhD Assistant Professor

[R] Ignoring version numbers when installing packages...

2012-03-30 Thread Jonathan Greenberg
R-helpers: I'm trying to install a package from r-forge, and I'm wondering if there is a way to force R to install a package, even if the package requires a certain version of R (short of modifying the DESCRIPTION file)? Cheers! --j -- Jonathan A. Greenberg, PhD Assistant Professor Department

Re: [R] Ignoring version numbers when installing packages...

2012-03-30 Thread Jonathan Greenberg
wrote: On 30/03/2012 12:05 PM, Jonathan Greenberg wrote: R-helpers: I'm trying to install a package from r-forge, and I'm wondering if there is a way to force R to install a package, even if the package requires a certain version of R (short of modifying the DESCRIPTION file)?  Cheers! You

[R] Creating a list from all combinations of two lists

2011-11-21 Thread Jonathan Greenberg
R-helpers: Say I have two lists of arbitrary elements, e.g.: list1=list(c(1:3),R is fun!,c(3:6)) list2=list(c(10:5),c(5:3),c(13,5),I am so confused) I would like to produce a single new list that is composed of all combinations of the top level of list1 and list2, e.g.:

[R] How do I query ... in a function call?

2011-11-21 Thread Jonathan Greenberg
This is probably a very noobish question, but if I want to create a function that allows an undetermined number of, say, numeric vectors to be fed to it, I would use: myfunction = function(...) { # Do something } Right? If so, how do I a) count the number of vectors fed to the function, and b)

[R] Setting hostname in the .Renvironment

2011-11-20 Thread Jonathan Greenberg
This is a follow-up to a question I asked a few years back. We have a pair of computers that share a common home directory (and therefor a common .Renviron) with identical hardware, but very different sets of libraries such that using a shared R_LIBS between two computers does not work. They

[R] setMethods/setGeneric problem when R CMD CHECK'ing a package

2011-08-24 Thread Jonathan Greenberg
R-helpers: I'm trying to build a package, but I'm a bit new to the whole S3/S4 methods concept. I'm trying to add a new definition of the zoo function as.yearmon, but I'm getting the following error when it gets to this point during a package install: *** R CMD INSTALL STARStools * installing

Re: [R] Easier ways to create .Rd files?

2011-08-24 Thread Jonathan Greenberg
it if you change the function arguments). Kevin Wright On Tue, Aug 23, 2011 at 6:55 PM, Jonathan Greenberg greenb...@ucdavis.edu wrote: R-helpers: Are there any ways to auto-generate R-friendly (e.g. will pass a compilation check) .Rd files given a set of .R code?  How about GUIs that help

Re: [R] setMethods/setGeneric problem when R CMD CHECK'ing a package

2011-08-24 Thread Jonathan Greenberg
(as.yearmon, signature(x = SpatialPointsDataFrameListZoo), as.yearmon.SpatialPointsDataFrameListZoo ) --j 2011/8/24 Uwe Ligges lig...@statistik.tu-dortmund.de: On 24.08.2011 10:30, Jonathan Greenberg wrote: R-helpers: I'm trying to build a package, but I'm a bit new to the whole S3/S4

[R] Easier ways to create .Rd files?

2011-08-23 Thread Jonathan Greenberg
R-helpers: Are there any ways to auto-generate R-friendly (e.g. will pass a compilation check) .Rd files given a set of .R code? How about GUIs that help properly format the .Rd files? Thanks! I want a basic set of .Rd files that I can update as I go, but as with most things my documentation

[R] Best way to setClass and setMethod for an R package?

2011-08-20 Thread Jonathan Greenberg
Folks: I'm putting together an R package, and I was wondering where, specifically, I put both class definitions (via setClass) as well as setMethod calls? Is there a particular file name I need to use? Thanks! --j -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial

Re: [R] Data frame to list?

2011-08-10 Thread Jonathan Greenberg
Answered my own question. ?split Never mind! --j On Wed, Aug 10, 2011 at 7:35 PM, Jonathan Greenberg greenb...@ucdavis.edu wrote: R-helpers: Is there an easy way to transfer a data frame to a list, where each list element is a dataframe containing a single row from the original data frame

[R] Data frame to list?

2011-08-10 Thread Jonathan Greenberg
R-helpers: Is there an easy way to transfer a data frame to a list, where each list element is a dataframe containing a single row from the original data frame? --j -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial Technologies and Remote Sensing (CSTARS) Department

[R] Data frame to list

2011-07-28 Thread Jonathan Greenberg
I'm hoping this is an easy problem that I'm missing something obvious. Given: x=c(1,1,1,2,2,3,3,3) y=c(1:length(x)) dataframe=data.frame(x,y) I would like to convert this to a list for use with certain functions, where each entry of the list is a subsetted dataframe based on dataframe$x I can

Re: [R] Data frame to list

2011-07-28 Thread Jonathan Greenberg
Center 223 East Steinfest Road Antigo, WI 54409 USA From: Jonathan Greenberg j...@illinois.edu To: r-help r-help@r-project.org Date: 07/28/2011 03:22 PM Subject: [R] Data frame to list Sent by: r-help-boun...@r-project.org -- I'm hoping this is an easy problem

Re: [R] Querying the path separator?

2011-06-30 Thread Jonathan Greenberg
, Jun 28, 2011 at 11:05 PM, Berend Hasselman b...@xs4all.nl wrote: Jonathan Greenberg wrote: The problem is that I'm trying to create a path to use with a system() call, and the command window will not work with the forward slash, only with the standard backslash.  I do understand that within R

[R] Querying the path separator?

2011-06-28 Thread Jonathan Greenberg
Hopefully this is a pretty easy fix -- I need to have R query the path separator for some code I'm trying to write (it involves using a system() call) -- the call requires a path and a wildcard, e.g.: command=mycommand /path/to/*.files in the case of unix or, command=mycommand.exe

Re: [R] Querying the path separator?

2011-06-28 Thread Jonathan Greenberg
is Windows (in which case use \) or other (in which case use /) -- there isn't a more clever way of doing this? --j On Tue, Jun 28, 2011 at 7:10 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: See file.path(). /Henrik On Tue, Jun 28, 2011 at 6:59 PM, Jonathan Greenberg greenb...@ucdavis.edu

Re: [R] Querying the path separator?

2011-06-28 Thread Jonathan Greenberg
--- Sent from my phone. Please excuse my brevity. Jonathan Greenberg greenb...@ucdavis.edu wrote: Thanks Henrik, but as the help for this function states: Note The components are separated by / (not \) on Windows. , the slashes it uses are incorrect for use

[R] Passing a function as a parameter...

2010-09-22 Thread Jonathan Greenberg
R-helpers: If I want to pass a character name of a function TO a function, and then have that function executed, how would I do this? I want an arbitrary version of the following, where any function can be used (e.g. I don't want the if-then statement here): apply_some_function -

Re: [R] Removing inter-bar spaces in barchart

2010-08-26 Thread Jonathan Greenberg
Oops, small typo, should be: barchart_test_heights=sin(c(1:100)) barchart_test_bins=c(c(1:50),c(1:50)) groups=c(rep(1,50),rep(2,50)) # Wish below didn't have spaces! barchart(barchart_test_bins~barchart_test_heights,groups=groups) On Wed, Aug 25, 2010 at 4:46 PM, Jonathan Greenberg greenb

Re: [R] Removing inter-bar spaces in barchart

2010-08-26 Thread Jonathan Greenberg
another function if that makes this easier. On Wed, Aug 25, 2010 at 1:55 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 24, 2010, at 10:20 PM, Jonathan Greenberg wrote: Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE

[R] Removing inter-bar spaces in barchart

2010-08-25 Thread Jonathan Greenberg
Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE)). My problem is that I can't, for the life of me, seem to get rid of the inter-bar space -- box.ratio set to 1 doesn't do much. Any ideas? I'd ideally want zero space between the

[R] Evaluating a string

2010-07-01 Thread Jonathan Greenberg
Rhelpers: How do I get R to evaluate a string, as if it was an R statement, e.g.: a=3 b=2 operator=- statement_string=paste(a,operator,b,sep=) --j __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

[R] using zoo() to coerce time series to a different reference frame

2010-06-29 Thread Jonathan Greenberg
Folks: I have two sets of dates, and one set of data: *** require(chron) require(zoo) reference_dates=seq.dates(01/01/92, 12/31/92, by = months) data_dates=seq.dates(01/15/91, 12/15/93, by = months) data=1:length(data_dates) reference_zoo=zoo(order.by=reference_dates)

[R] seq.dates in reverse?

2010-06-29 Thread Jonathan Greenberg
Pardon the barrage of time series related questions, but another issue I'm trying to solve is how to determine a sequence of dates a la seq.dates() except going BACKWARDS in time, e.g. if seq.dates() allowed for the to variables to be set alone, rather than the from=. Ultimately, I'd like to have

Re: [R] exists() and functions

2010-06-25 Thread Jonathan Greenberg
, Jonathan Greenberg greenb...@ucdavis.edu wrote: I'm a bit confused about how exists() work within a function -- I want to test for unassigned variables, but I'm doing tests in the main environment to figure out the function, so the variables DO exist in the parent environment of a function call

[R] exists() and functions

2010-06-25 Thread Jonathan Greenberg
I'm a bit confused about how exists() work within a function -- I want to test for unassigned variables, but I'm doing tests in the main environment to figure out the function, so the variables DO exist in the parent environment of a function call. Why does: myfunction -

[R] RSQLite and fetching rows from multiple tables

2010-06-21 Thread Jonathan Greenberg
I'm trying to use RSQLite statement to cycle through a large database in chunks via the fetch(...,n=2). As far as I can tell, however, it keeps re-fetching the same beginning set of rows -- any ideas what might be wrong with the following code? The select statement is pulling from multiple

[R] Fastest way to merge matrix columns into a comma delimited string?

2010-06-15 Thread Jonathan Greenberg
Folks: Say I have a matrix: test=matrix(c(1,2,3),nrow=10,ncol=3) I would like to have an output character vector where each line is row's values delimited by commas, e.g.: 1,2,3 2,3,1 3,1,2 ... 1,2,3 What is the fastest way of doing this? I can paste() row-by-row but this seems an

Re: [R] Matrix to database -- best practices/efficiency?

2010-06-08 Thread Jonathan Greenberg
= as.vector(my_matrix) ) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jonathan Greenberg Sent: Tuesday, 8 June 2010 12:34 PM To: r-help Subject: [R] Matrix to database -- best practices/efficiency? I have a matrix

[R] Matrix to database -- best practices/efficiency?

2010-06-07 Thread Jonathan Greenberg
I have a matrix of, say, M and N dimensions: my_matrix=matrix(c(1:60),nrow=6,ncol=10) I have two id vectors corresponding to the rows and columns, e.g.: id_m=seq(10,60,by=10) id_n=seq(100,1000,by=100) I would like to create a proper database (let's say a data.frame for this example -- i'm

Re: [R] R and ATLAS

2010-05-27 Thread Jonathan Greenberg
-core machine, you will see CPU usage of nearly 400%. Note though that this will not discriminate ATLAS from other multi-threaded BLASes. HTH, Peter On Wed, May 26, 2010 at 2:16 PM, Jonathan Greenberg greenb...@ucdavis.edu wrote: Rhelpers: I recently installed the 64-bit version of R

[R] R and ATLAS

2010-05-26 Thread Jonathan Greenberg
Rhelpers: I recently installed the 64-bit version of R on my Debian system, and afterwards was asked if it was compiled using ATLAS. Is there a way to test to see if R is using ATLAS? --j __ R-help@r-project.org mailing list

[R] Comparing histograms?

2010-05-13 Thread Jonathan Greenberg
Rhelpers: I'm curious what the appropriate analysis to use for testing the hypothesis that two histograms are statistically different from one another? Thanks! --j __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] RSQLite equivalent of .schema?

2010-05-12 Thread Jonathan Greenberg
Rhelpers: (Thanks for the previous help with getting a where statement working). Now on to my next question -- our database guru has asked me to run .schema on an sqlite database, and I was wondering if there is an equivalent in R to do this? Thanks! --j

[R] dbSendQuery with R variables

2010-05-10 Thread Jonathan Greenberg
Rhelpers: I'd like to modify this RSQLite statement: rs_stations-dbSendQuery(con_stations, select * from stations) so that stations is actually an R variable, e.g.: stations=c(stationA,stationB) How would I modify the above statement to query from stations[[1]] (aka stationA)? --j

[R] R and screen (UNIX question)

2010-03-03 Thread Jonathan Greenberg
I'm having a mixed experience with using R and UNIX's screen function -- sometimes when I close a connection that used screen, the R process is killed (which, in theory, it shouldn't be -- it should be running in the background). Does anyone have any ideas on how well (or not) R behaves with

[R] Using auto.key with two variable plots

2010-01-30 Thread Jonathan Greenberg
Rhelpers: Having a problem solving this. I have an xyplot call that looks like this: print(xyplot(temp_species_EAM_Pred_Pop$x+temp_species_NULL_Pred_Pop$x~temp_species_EAM_Pred_Pop$Action,main=current_species, xlab=Action,ylab=Predicted Pop,

[R] Data frame of different sized lists in a function call

2010-01-28 Thread Jonathan Greenberg
I'm hoping to get some best practice feedback for constructing a function call which takes an undefined set of DIFFERENT length vectors -- e.g. say we have two lists: list1=c(1:10) list2=c(2:4) lists = data.frame(list1,list2) coerces those two to be the same length (recycling list2 to fill

[R] x,y plot question (two sets of labels)

2010-01-20 Thread Jonathan Greenberg
I'm trying to figure out the best way to do a scatterplot using the following data as an example: plothelp_x=1:10 plothelp_A1=sin(plothelp_x) plothelp_A2=tan(plothelp_x) plothelp_B=c(A,B,C,A,B,C,A,B,C,A) (note that all 4 of these vectors have 10 entries each) What I would like is to have two

Re: [R] Finally, the first R spam!

2010-01-11 Thread Jonathan Greenberg
I got that same email from Steve Blum: Hi folks, Which is the best statistical package out there. I am out of work and looking to get the best buck for my money. Tx - ed --j Max Kuhn wrote: ... and this one I received this morning: Hi folks, Which is the best statistical package

[R] Safe way to automatically install required packages...

2009-11-02 Thread Jonathan Greenberg
R-helpers: I'm working on an r-package that I want to make as easy-to-use as possible for a novice R-user, which includes automatically installing required packages. I, myself, am a novice R-packager, so the solution I came up with was to embed: print(Loading required packages...) if

[R] Aggregate and cross tabulation

2009-10-27 Thread Jonathan Greenberg
R-helpers: I have a data frame containing 4 factor variables (let's say A,B,C, and D) and 1 numerical variable (N). I would like to produce a cross-tabulated data frame in which A,B,C are individual columns, each factor of D is its own column, and the field is calculated as a given

[R] splitting a vector of strings...

2009-10-22 Thread Jonathan Greenberg
Quick question -- if I have a vector of strings that I'd like to split into two new vectors based on a substring that is inside of each string, what is the most efficient way to do this? The substring that I want to split on is multiple characters, if that matters, and it is contained in

Re: [R] splitting a vector of strings...

2009-10-22 Thread Jonathan Greenberg
: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jonathan Greenberg Sent: Thursday, October 22, 2009 7:35 PM To: r-help Subject: [R] splitting a vector of strings... Quick question -- if I have a vector of strings that I'd like to split

[R] Stochastic (transition) matrices: how to determine distributions and variance?

2009-08-30 Thread Jonathan Greenberg
(apologies for the cross-posting, and for this being a more general stats question rather than a specific-to-R one. I assure you I will be doing the actual analysis in R :) I am trying to determine the distribution and variance for a classic stochastic (transition) matrix problem such that:

[R] Best R text editors?

2009-08-27 Thread Jonathan Greenberg
Quick informal poll: what is everyone's favorite text editor for working with R? I'd like to hear from people who are using editors that have some level of direct R interface (e.g. Tinn-R, Komodo+SciViews). Thanks! --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial

  1   2   >