[R] source files in temp environment

2017-12-02 Thread Alexander Shenkin
Hi all, I often keep code in separate files for organizational purposes, and source() that code from higher level scripts. One problem is that those sourced files often create temporary variables that I don't want to keep around. I could clean up after myself with lots of rm()'s, but that's

Re: [R] To implement OO or not in R package, and if so, how to structure it?

2017-09-14 Thread Alexander Shenkin
Did you read this? https://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf Maybe it could give you some insight in how to create package. That resource is ~9 years old. There are more modern treatments available. You can read mine at http://r-pkgs.had.co.nz. Hadley Thanks both.

[R] To implement OO or not in R package, and if so, how to structure it?

2017-09-14 Thread Alexander Shenkin
Hello all, I am trying to decide how to structure an R package. Specifically, do I use OO classes, or just provide functions? If the former, how should I structure the objects in relation to the type of data the package is intended to manage? I have searched for, but haven't found, resourc

[R] Calculating cumulative lengths of hierarchical topology

2017-07-03 Thread Alexander Shenkin
Hello All, I need to calculate cumulative lengths along a hierarchical network topology (it's a representation of a tree). I can roll my own, but thought that there might be a package out there that would handle hierarchical network topology functions such as this nicely (and that might brin

Re: [R] Maximum # of DLLs reached, or, how to clean up after yourself?

2016-09-14 Thread Alexander Shenkin
ng the namespace does not unload DLL * checking loading without being on the library search path ... OK For further details on my thoughts on this, see https://github.com/HenrikBengtsson/Wishlist-for-R/issues/29. Hope this helps Henrik On Tue, Sep 13, 2016 at 6:05 AM, Alexander Shenkin wrote: Hello a

[R] Maximum # of DLLs reached, or, how to clean up after yourself?

2016-09-13 Thread Alexander Shenkin
Hello all, I have a number of analyses that call bunches of sub-scripts, and in the end, I get the "maximal number of DLLs reached" error. This has been asked before (e.g. http://stackoverflow.com/questions/36974206/r-maximal-number-of-dlls-reached), and the general answer is, "just clean up

[R] Factors in nlme: singularity in backsolve error

2016-07-19 Thread Alexander Shenkin
Hello all, I tried posting on r-sig-ME, but it's not going through. So I thought I would try here. Apologies if this ends up being a cross-post if it eventually goes through there I am parameterizing exponential fits for some metabolic scaling models. I have done this in lmer already,

[R] remove fixed effect in predict.merMod

2016-05-19 Thread Alexander Shenkin
Hello all, I've run a model, and now would like to extract residuals. However, I have set sum-to-zero contrasts for the categorical fixed effect (contr.sum). Because I am interested in looking at the variation in the residuals associated with that fixed effect (along with other levels), I n

Re: [R] Fit a smooth closed shape through 4 points

2016-03-21 Thread Alexander Shenkin
only going to get a very rough approximation no matter the method used. Regards, Charles On Mon, Mar 21, 2016 at 7:59 AM, Alexander Shenkin mailto:ashen...@ufl.edu>> wrote: Hello all, I have sets of 4 x/y points through which I would like to fit closed, smoothed shapes that g

[R] Fit a smooth closed shape through 4 points

2016-03-21 Thread Alexander Shenkin
Hello all, I have sets of 4 x/y points through which I would like to fit closed, smoothed shapes that go through those 4 points exactly. smooth.spline doesn't like my data, since there are only 3 unique x points, and even then, i'm not sure smooth.spline likes making closed shapes. Might an

[R] ggplot: geom_bar not respecting factor order when stacking

2016-02-04 Thread Alexander Shenkin
Hi all, ggplot2 (v2.0.0) does not seem to respect factor order when stacking bars in geom_bar(). ## > dput(temp) structure(list(phylo_sig = c(0.148740270638472, 0.148740270638472, 0.148740270638472, 0.148740270638472, 0.148740270638472), trait = c("p_corrected_percent", "p_co

[R] apply function across dataframe columns for non-exclusive groups

2015-10-21 Thread Alexander Shenkin
Hello all, I've been banging my head over what must be a simple solution. I would like to apply a function across columns of a dataframe for rows grouped across different columns. These groups are not exclusive. See below for an example. Happy to use dplyr, data.table, or whatever. Any g

[R] Quantifying widths of polygons

2015-09-25 Thread Alexander Shenkin
Hello all, I am working with data on tree crowns, and this data describes points (verticies) around the polyhedron of the crown volume (think of the crown as a single volume with vertices and faces). I can calculate maximum z distance between any 2 points (maximum depth) and maximum x/y dist

[R] return named list from foreach

2015-02-20 Thread Alexander Shenkin
Hello all, I've been trying to figure out how to return a named list from foreach. Given that the order of the returned list is guaranteed to be in the order in which the object is passed to foreach, list members can be named afterwards. However, I'm wondering if there's a better way to do i

[R] expected arguments for rgl.triangles

2014-11-14 Thread Alexander Shenkin
Hello all, I have a set of points in 3D space that represent vertices of a non-convex polyhedron. I would like to plot this polyhedron, and have been trying to do so with rgl.triangles, but to no avail. I imagine I don't understand what rgl.triangles expects for arguments. I have construct

[R] dimensions of polyhedrons

2014-06-10 Thread Alexander Shenkin
Hello all, I have sets of points in (x,y,z) that represent polyhedron vertices (actually tree crowns). I have used convhulln to estimate volumes (the shapes are not necessarily convex, but good enough for now). Now I would like to extract various dimensions of these shapes - horizontal width

[R] How to define and calculate volume of 3D polygon?

2014-05-19 Thread Alexander Shenkin
Hi Folks, I have a set of x,y,z points in 3D space that defines the outline of a tree crown (5 - 15 perimeter points + 1 top & bottom point). I would like to calculate the volume of the corresponding 3D polygon based on those points. I have been able to use geometry::convhulln, but I think t

[R] Finding files matching full path regex

2014-02-27 Thread Alexander Shenkin
Hi folks, I'm interested in finding files by matching both filenames and directories via regex. If I have: dir1_pat1/file1.csv dir2_pat1/file2.csv dir2_pat1/file3.txt dir3_pat2/file4.csv I would like to find, for example, all csv files in directories that have "pat1" in their

Re: [R] How to vectorize plot graphic?

2013-12-01 Thread Alexander Shenkin
> /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > ----------- > Sent from my phone. Please excuse my brevity. > > Alexander Shenkin wrote: >> Hi Folks, >> >> Using ggplot, I've produced the followin

Re: [R] How to vectorize plot graphic?

2013-12-01 Thread Alexander Shenkin
p of my head, I'd suggest trying ggsave() with the extension > ".svg" . I realize that SVG files are not recognized by some image display > apps (Microsoft Windows I'm looking at YOU), but IMHO it's the best choice > for vectorized images. > > >

[R] How to vectorize plot graphic?

2013-12-01 Thread Alexander Shenkin
Hi Folks, Using ggplot, I've produced the following graphic: http://i.imgur.com/39a139C.png The graphics in the plot seem to be bitmapped and not vectorized. That is, the vertical and horizontal lines jump rows of pixels instead of having just nice, angled lines. Any thoughts about how to get t

[R] devtools: rtools not compatible with 3.0.1

2013-06-11 Thread Alexander Shenkin
Hi Folks, I'm trying to load devtools in R 3.0.1 in order to run the dev version of lme4. I've updated devtools, and just installed Rtools30.exe. However, I get the following warning (in R-Studio, RGui, and R.exe, both x64 and i386): - WARNING: Rtools is required to build R pack

Re: [R] exporting tables to word

2013-04-02 Thread Alexander Shenkin
d suggest looking at the help files > associated with the "rtf" package to make any modifications, such as adding > other regression results/tables. > > Thanks and hope this helps, > > Carlos > > > On Tue, Apr 2, 2013 at 12:13 PM, Alexander Shenkin wrote: &

Re: [R] exporting tables to word

2013-04-02 Thread Alexander Shenkin
of spss (by means of > spsspivottable.Display()) > Frans > > > 2013/4/2 Alexander Shenkin > >> Hello all, >> >> What is your preferred method to export tables (from ftable()) to Word? >> Do you just export to

[R] exporting tables to word

2013-04-02 Thread Alexander Shenkin
Hello all, What is your preferred method to export tables (from ftable()) to Word? Do you just export to a text file and then copy/paste? Or perhaps via HTML output? Thanks, Allie __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/list

Re: [R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread Alexander Shenkin
Thanks, John. Your solution gives me: > ddply(my_df, .(a), summarize, mm = mean(dat), number = length(dat)) a mm number 1 0 14 3 2 1 11 3 I'm looking for (and Ista found a way): >> a b c mean n >> 1 1 * * 11 3 >> 2 * 1 * 14 3 >> 3 * * 1 12 3 thanks, allie On 3/20/2013 3:2

Re: [R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread Alexander Shenkin
"mean"=mean(x$dat), "n"=nrow(x))) > > ? > > Best, > Ista > > On Wed, Mar 20, 2013 at 3:57 PM, Alexander Shenkin wrote: >> Hi folks, >> >> I'm trying to figure out how to get summarized data based on multiple >> columns

[R] summarize dataframe based on multiple cols, not their combinations

2013-03-20 Thread Alexander Shenkin
Hi folks, I'm trying to figure out how to get summarized data based on multiple columns. However, instead of giving summaries for every combination of categorical columns, I want it for each value of each categorical column regardless of the other columns. I could do this with three different co

[R] extract indep vars from formula

2012-11-07 Thread Alexander Shenkin
Hello, I'm trying to extract the independent variables from a formula. The closest I've been able to come, aside from rolling my own, is the following: > a = y ~ b * x > attr(terms(formula(a)),"variables") The reason I'm doing this is that I'm building a grid of points that I use to construct a

Re: [R] backreferences in gregexpr

2012-11-03 Thread Alexander Shenkin
On 11/2/2012 5:14 PM, Gabor Grothendieck wrote: > On Fri, Nov 2, 2012 at 6:02 PM, Alexander Shenkin wrote: >> Hi Folks, >> >> I'm trying to extract just the backreferences from a regex. >> >>> temp = "abcd1234abcd1234" >>> regma

[R] backreferences in gregexpr

2012-11-02 Thread Alexander Shenkin
Hi Folks, I'm trying to extract just the backreferences from a regex. > temp = "abcd1234abcd1234" > regmatches(temp, gregexpr("(?:abcd)(1234)", temp)) [[1]] [1] "abcd1234" "abcd1234" What I would like is: [1] "1234" "1234" Note: I know I can just match 1234 here, but the actual example is compl

Re: [R] Which packages are incompatible with 64-bit R?

2012-10-19 Thread Alexander Shenkin
y") > pkgnames32 = pkgs32[,"Package"] > pkgnames64 = pkgs64[,"Package"] > as.character(pkgnames32[which(is.na(match(pkgnames32, pkgnames64)))]) [1] "RSVGTipsDevice" "RSvgDevice" "eco""rcqp" "sparsenet"

[R] Which packages are incompatible with 64-bit R?

2012-10-19 Thread Alexander Shenkin
Hi folks, Despite the pain of migrating to 64-bit R (I have to install 64-bit Office also due to RODBC), I'm considering making the leap due to memory issues. Is there any place that lists packages that are 64-bit incompatible? Or, will I just have to march through all my packages and check th

Re: [R] bigmemory for dataframes?

2012-10-18 Thread Alexander Shenkin
System Info: R 2.14.2 Windows 7 Pro x64 SP1 8GB RAM On 10/18/2012 3:42 PM, Alexander Shenkin wrote: > Hi Folks, > > I've been bumping my head against the 4GB limit for 32-bit R. I can't > go to 64-bit R due to package compatibility issues (ROBDC - possible but > pa

[R] bigmemory for dataframes?

2012-10-18 Thread Alexander Shenkin
Hi Folks, I've been bumping my head against the 4GB limit for 32-bit R. I can't go to 64-bit R due to package compatibility issues (ROBDC - possible but painful, xlsReadWrite - not possible, and others). I have a number of big dataframes whose columns all sorts of data types - factor, character,

[R] how to know where you've been sourced from

2012-09-26 Thread Alexander Shenkin
Hello All, I need a script to perform different actions depending on the file from which it was source()'d. Thus, my script needs a way to figure out from whence it was sourced. There seems to be some relevant information in sys.calls() (see below). However, I need to get at the name of the fil

[R] remove all terms with interaction factor in formula

2012-09-13 Thread Alexander Shenkin
Hi Folks, I'm trying to find a way to remove all terms in a formula that contain a particular interaction. For example, in the formula below, I'd like to remove all terms that contain the b:c interaction. > attributes(terms( ~ a*b*c*d))$term.labels [1] "a" "b" "c" "d" "a

Re: [R] POSIXct-coerced NA's not considered NA by is.na()

2012-08-24 Thread Alexander Shenkin
_date [1] NA Warning message: In as.POSIXlt.POSIXct(x, tz) : NAs introduced by coercion > is.na(bad_date) # shouldn't this be TRUE? [1] FALSE As nasty as it may be, shouldn't something showing up as "NA" result in TRUE when being tested by is.na()? Just to put some context a

[R] POSIXct-coerced NA's not considered NA by is.na()

2012-08-24 Thread Alexander Shenkin
Hello folks, I found a strangeness while experimenting with POSIXct vectors and lists. It seems that coerced NA's aren't "real" NAs, at least as considered by is.na()? > date_vec = c(as.POSIXct(now()), as.POSIXct(now()+1),NA,"b") > date_vec [1] "2012-08-22 15:00:46 COT" "2012-08-22 15:00:47 COT"

[R] Sweave: R chunk inside caption?

2012-08-21 Thread Alexander Shenkin
Hi Folks, I'm surprised, but I didn't find this question addressed anywhere. I'd like to generate a LaTeX caption with R code. I've tried the code below, but I get the following TeX error: ! Argument of \@caption has an extra }. \par l.21 } Any thoughts? Perhaps I'll have to

[R] export table in separate file

2012-08-10 Thread Alexander Shenkin
Hi Folks, I'm using Sweave to generate png & pdf graphics that I then "Import & Link" in a Word document. This let's me create sharable and editable dynamic documents. They are dynamic in that I can regenerate figures when the data changes, and have those figures automatically updated in my Word

Re: [R] r-forge down?

2012-08-07 Thread Alexander Shenkin
PM, Roy Mendelssohn wrote: > http://www.rforge.net > > -Roy > > On Aug 7, 2012, at 3:25 PM, Alexander Shenkin wrote: > >> Hi Folks, >> >> I've looked around, haven't found anything, and I'm not sure where else >> to check. I haven't vis

[R] r-forge down?

2012-08-07 Thread Alexander Shenkin
Hi Folks, I've looked around, haven't found anything, and I'm not sure where else to check. I haven't visited R-forge (http://r-forge.r-project.org) in a long time. Now that I'm trying, it seems to be down. Anyone know if this is a temporary condition, and if so, when it's expected to rise agai

Re: [R] sweave tables as images?

2012-05-25 Thread Alexander Shenkin
ecessarily a desirable thing (the spacing between rows and columns > can become too large). > > > HTH, > > baptiste > > > [*] experimental code at https://gist.github.com/2013903 > > On 26 May 2012 09:16, Alexander Shenkin wrote: >> Thanks Yihui, >> >> Th

Re: [R] sweave tables as images?

2012-05-25 Thread Alexander Shenkin
s in this case, though. > > Regards, > Yihui > -- > Yihui Xie > Phone: 515-294-2465 Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA > > > On Fri, May 25, 2012 at 2:44 PM, Alexander Shenkin wrote: >> grid.

Re: [R] sweave tables as images?

2012-05-25 Thread Alexander Shenkin
; > On Mon, May 21, 2012 at 4:29 PM, Alexander Shenkin wrote: >> Hello folks, >> >> I've been on a journey trying to figure out how to manage documents that >> are amenable to sharing and editing, but that contain dynamic content >> generated by R. I'v

[R] use list as function arguments

2012-05-24 Thread Alexander Shenkin
Hello Folks, Is there any way to pass a list into a function such that the function will use the list as its arguments? I haven't been able to figure that out. The background: I'm trying to build a function that will apply another function multiple times, each time with a different set of specif

Re: [R] sweave tables as images?

2012-05-22 Thread Alexander Shenkin
, Allie On 5/22/2012 4:36 AM, Liviu Andronic wrote: > On Mon, May 21, 2012 at 10:29 PM, Alexander Shenkin wrote: >> So, I think it will be better if I can somehow generate the tables as >> images. Is there any way to generate tables as images in separate files >> in Sweave?

Re: [R] sweave tables as images?

2012-05-21 Thread Alexander Shenkin
Thanks Michael - I think grid.table does the trick. On 5/21/2012 3:33 PM, R. Michael Weylandt wrote: > Take a look at addtable2plot in plotrix or grid.table / tableGrob in > gridExtras. > > Michael > > On Mon, May 21, 2012 at 4:29 PM, Alexander Shenkin wrote: >> Hello fol

[R] sweave tables as images?

2012-05-21 Thread Alexander Shenkin
Hello folks, I've been on a journey trying to figure out how to manage documents that are amenable to sharing and editing, but that contain dynamic content generated by R. I've come to the following solution: I use Sweave to generate labeled png & pdf figures, and I "Insert & Link" those figures

[R] auditing R's memory usage

2012-05-04 Thread Alexander Shenkin
Hi Folks, I'm running 32-bit R 2.14 in RStudio on my Win 7 x64 system with 8GB RAM. I'm getting memory problems as R wants to swallow more than the 4GB limit. I think I'm stuck at 4GB as I have to use 32-bit R for a number of packages (ODBC, etc). However, I doubt I really need to be using that

Re: [R] rgl.Sweave not producing transparency in pdf plots with alpha

2012-05-02 Thread Alexander Shenkin
On 5/2/2012 11:40 AM, Duncan Murdoch wrote: > On 02/05/2012 12:26 PM, Duncan Murdoch wrote: >> On 02/05/2012 11:00 AM, Alexander Shenkin wrote: >> > Hi Folks, >> > >> > I'm trying to get rgl.Sweave to produce plots with transparency. >> > H

[R] rgl.Sweave not producing transparency in pdf plots with alpha

2012-05-02 Thread Alexander Shenkin
Hi Folks, I'm trying to get rgl.Sweave to produce plots with transparency. However, it just seems to produce opaque plots when pdf is the output type. Perhaps this is a known issue? I'll just use .png in the meantime, but wanted to see about this, as I didn't see it in the documentation (though

Re: [R] Coding columns for survival analysis

2012-04-16 Thread Alexander Shenkin
found <- pmin(cumsum(.row) + 1, 3) # cannot be greater than 3 > + # determined where it died > + die <- cumsum(diff(c(0, .row)) != 0) > + # replace value at die == 2 with 4 > + found[die == 2] <- 4 > + c(NA, "found", "alive",

[R] Coding columns for survival analysis

2012-04-13 Thread Alexander Shenkin
Hello Folks, I have 5 columns for thousands of tree records that record whether that tree was alive or dead. I want to recode the columns such that the cell reads "found" when a live tree is first observed, "alive" for when a tree is found alive and is not just found, and "mort" when it was previ

Re: [R] How do Sweave users collaborate with Word users?

2012-04-09 Thread Alexander Shenkin
art of the document. >> >> SWord is by Thomas Baier tho...@statconn.com, author of the statconnDCOM >> interface >> that is underneath RExcel. See rcom.univie.ac.at for information and >> download and to >> sign up on the rcom email list. >> >> Ri

Re: [R] How do Sweave users collaborate with Word users?

2012-04-09 Thread Alexander Shenkin
formation and download and to > sign up on the rcom email list. > > Rich > > On Sat, Apr 7, 2012 at 4:54 PM, Alexander Shenkin <mailto:ashen...@ufl.edu>> wrote: > > Hello All, > > I'm getting my workflow switched over to Sweave, which is very

Re: [R] How do Sweave users collaborate with Word users?

2012-04-08 Thread Alexander Shenkin
e through a version control system like > SVN or GIT. Markdown is easy to write and cleaner compared to Word. > > Regards, > Yihui > -- > Yihui Xie > Phone: 515-294-2465 Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, A

[R] How do Sweave users collaborate with Word users?

2012-04-07 Thread Alexander Shenkin
Hello All, I'm getting my workflow switched over to Sweave, which is very cool. However, I collaborate with folks (as many of you must as well) who use Word to Track Changes amongst a group while crafting a paper. In the simplest case, there will just be two people (one Sweave user and one Word u

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Alexander Shenkin
> > Regards, > Yihui > -- > Yihui Xie > Phone: 515-294-2465 Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA > > > > On Thu, Apr 5, 2012 at 12:26 PM, Alexander Shenkin wrote: >> Yep, I'm using RSt

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Alexander Shenkin
Ames, IA > > > > On Thu, Apr 5, 2012 at 11:22 AM, Duncan Murdoch > wrote: >> On 04/04/2012 3:25 PM, Alexander Shenkin wrote: >>> >>> Hello Folks, >>> >>> When I run the document below through sweave, rgui.exe/rsession.exe >>> lea

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Alexander Shenkin
PM, Alexander Shenkin wrote: >> Hello Folks, >> >> When I run the document below through sweave, rgui.exe/rsession.exe >> leaves a file handle open to the sweave-001.pdf graphic (as verified by >> process explorer). Pdflatex.exe then crashes (with a Permission Denied >

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-05 Thread Alexander Shenkin
ssing code chunks with options ... > 1 : keep.source term verbatim pdf > > Error: chunk 1 > Error in plot.xy(xy, type, ...) : object 'foo' not found > R> ls() > [1] "col.yellowbg" "df" > R> dev.list() > pdf > 2 > R> dev.off() > nu

Re: [R] Rgui maintains open file handles after Sweave error

2012-04-04 Thread Alexander Shenkin
uot; "yes" > On 4/4/2012 2:45 PM, Henrik Bengtsson wrote: > See ?closeAllConnections > > Suggestion to the maintainer of Sweave: "atomify" the figure > generation, e.g. use { pdf(); on.exit(dev.off()); {...}; } or similar, > instead of { pdf(); {...}; dev.off(); }

[R] Rgui maintains open file handles after Sweave error

2012-04-04 Thread Alexander Shenkin
Hello Folks, When I run the document below through sweave, rgui.exe/rsession.exe leaves a file handle open to the sweave-001.pdf graphic (as verified by process explorer). Pdflatex.exe then crashes (with a Permission Denied error) because the graphic file is locked. This only seems to happen whe

[R] summaryBy: transformed variable on RHS of formula?

2012-04-02 Thread Alexander Shenkin
Hi Folks, I'm trying to cut my data inside the summaryBy function. Perhaps formulas don't work that way? I'd like to avoid adding another column if possible, but if I have to, I have to. Any ideas? Thanks, Allie require(doBy) df = dataframe(a <- rnorm(100), b <-rnorm(100)) summary

[R] dot products

2012-03-07 Thread Alexander Shenkin
Hello, I need to take a dot product of each row of a dataframe and a vector. The number of columns will be dynamic. The way I've been doing it so far is contorted. Is there a better way? dotproduct <- function(dataf, v2) { apply(t(t(as.matrix(a)) * v2),1,sum) #contorted! }

[R] Vectorizing a loop

2012-02-07 Thread Alexander Shenkin
Hello Folks, I'm trying to vectorize a loop that processes rows of a dataframe. It involves lots of conditionals, such as "If column 10 == 3, and if column 3 is True, and both column 5 and 6 are False, then set column 4 to True". So, for example, any ideas about vectorizing the following? df =

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Alexander Shenkin
On 6/22/2011 4:09 PM, Brian Diggs wrote: > On 6/22/2011 1:37 PM, Alexander Shenkin wrote: >> On 6/22/2011 3:34 PM, Brian Diggs wrote: >>> On 6/22/2011 12:09 PM, Luke Miller wrote: >>>> For what it's worth, I cannot reproduce this problem under a nearly >>&g

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Alexander Shenkin
wday = 0L, yday = 123L, isdst = -1L), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst" ), class = c("POSIXlt", "POSIXt")) > dput(as.POSIXct(strptim

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Alexander Shenkin
he switchover took place near the beginning of > April in 1992, so you should have isdst=1 by May 3. > Perhaps you have an odd timezone file on your machine. > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > >> -Original Message- >> From:

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Alexander Shenkin
On 6/22/2011 1:34 PM, Sarah Goslee wrote: > On Wed, Jun 22, 2011 at 2:28 PM, David Winsemius > wrote: >> >> On Jun 22, 2011, at 2:03 PM, Sarah Goslee wrote: >> >>> Hi, >>> >>> On Wed, Jun 22, 2011 at 11:40 AM, Alexander Shenkin >>> wr

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Alexander Shenkin
On 6/22/2011 1:03 PM, Sarah Goslee wrote: > Hi, > > On Wed, Jun 22, 2011 at 11:40 AM, Alexander Shenkin wrote: >>> is.na(strptime("5/2/1992", format="%m/%d/%Y")) >> [1] FALSE >>> is.na(strptime("5/3/1992", format="%m/%d/%Y&quo

[R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Alexander Shenkin
> is.na(strptime("5/2/1992", format="%m/%d/%Y")) [1] FALSE > is.na(strptime("5/3/1992", format="%m/%d/%Y")) [1] TRUE Any idea what's going on with this? Running strptime against all dates from around 1946, only 5/3/1992 was converted as "NA". Even stranger, it still seems to have a value associa

[R] reproduction archives

2011-06-05 Thread Alexander Shenkin
Hello Folks, As some of my old code broke when an updated package changed its interface, I started thinking about reproduction of analyses. It's not good enough to save our code - we have to save the package versions those analyses used as well as the R-core. I saw a couple references to "reprod

[R] holding objects in dataframes

2011-01-14 Thread Alexander Shenkin
Hello list, I need to keep track of objects that are related to particular observations. In this case, I need to keep track of polygons that are associated with observations. What I would ideally have is one column of a dataframe hold a "polygonal" object (from the spatstat package). My questio

[R] RODBC for 64-bit R with 32-bit Access

2010-12-17 Thread Alexander Shenkin
Hello Folks, I do hope this is the correct place to post (and not in R-SIG-DB). I have spent the better part of a day searching for an answer to this question, and have yet to resolve it. I am trying to query an .accdb Access database (with 32-bit Office 2007 currently residing on the machine) w

[R] dmultinomial

2010-11-18 Thread Alexander Shenkin
Hello All, I'm trying to run a maximum likelihood analysis using dmultinomial (i'm avoiding dmultinom as I'd like to run it with vectors for the ML stuff). However, I'm having a hard time getting even the simplest example running. Any help would be greatly appreciated. > library(mc2d) > dmultin

[R] dmultinomial

2010-11-18 Thread Alexander Shenkin
Hello All, I'm trying to run a maximum likelihood analysis using dmultinomial (i'm avoiding dmultinom as I'd like to run it with vectors for the ML stuff). However, I'm having a hard time getting even the simplest example running. Any help would be greatly appreciated. > library(mc2d) > dmultin

[R] translate vector of numbers to indicies of 0/1 matrix

2010-11-17 Thread Alexander Shenkin
Hello All, Searched around, haven't found a decent solution. I'd like to translate a vector of numbers to a matrix (or to a list of vectors) such that the vector values would serve as indicies of the 1's in an otherwise-zero-filled matrix (or list of vectors). For example: > a = c(1,3,3,4) # pe

Re: [R] finding euclidean proximate points in two datasets

2010-05-20 Thread Alexander Shenkin
On 5/20/2010 9:18 AM, David Winsemius wrote: > > On May 20, 2010, at 10:02 AM, Alexander Shenkin wrote: > >> Hello all, >> >> I've been pouring through the various spatial packages, but haven't come >> across the right thing yet. > > There is a

[R] finding euclidean proximate points in two datasets

2010-05-20 Thread Alexander Shenkin
very welcome. Thanks in advance. Thanks, Allie -- Alexander Shenkin PhD Candidate School of Natural Resources and Environment University of Florida http://snre.ufl.edu/people/students.asp __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/l

Re: [R] export dataframe's column classes to a list

2010-05-19 Thread Alexander Shenkin
> >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- >> project.org] On Behalf Of Alexander Shenkin >> Sent: Thursday, 20 May 2010 8:19 a.m. >> To: r-help@r-project.org >> Subject: [R] export dataframe's column cla

[R] export dataframe's column classes to a list

2010-05-19 Thread Alexander Shenkin
_col_classes()" function above. Any thoughts are greatly appreciated! Thanks, Allie -- Alexander Shenkin PhD Candidate School of Natural Resources and Environment University of Florida http://snre.ufl.edu/people/students.asp __ R-help@r-pro

Re: [R] timing a function

2010-05-17 Thread Alexander Shenkin
You could also put the call to system.time inside the function itself: f = function(x) { system.time({ ... #function's code ret_val = ... }); flush.console(); return ret_val; } i s'pose you'd miss out on the time taken to jump to the function code, return the value, et

[R] pnmath on windows

2010-05-13 Thread Alexander Shenkin
not, does anyone know what the bottleneck there is? That is, what keeps me from compiling it myself and handing it to a friend with another windows system? Thanks, Allie -- Alexander Shenkin PhD Candidate School of Natural Resources and Environment University of Florida http://snre.ufl.

Re: [R] R for windows 64 bit

2010-01-12 Thread Alexander Shenkin
Hi Alessia, Note that, while your physical limit might be 6 GB, Windows memory management allows more memory than that to be allocated (aka Virtual Memory, or at least that's what they called it in XP). Windows swaps out memory from RAM to the hard disk and back when necessary (please excuse the

Re: [R] Avoiding loops

2009-09-02 Thread Alexander Shenkin
Though, from my limited understanding, the 'apply' family of functions are actually just loops. Please correct me if I'm wrong. So, while more readable (which is important), they're not necessarily more efficient than explicit 'for' loops. allie On 9/2/2009 3:13 AM, Phil Spector wrote: > Here's

Re: [R] Regular expression to define contents between parentheses

2009-08-25 Thread Alexander Shenkin
Hi Judith, This probably isn't the only way to do it, but: gsub("\\(.*?\\)", "", myvector, perl=TRUE) seems to do the trick. The problem is that regular expressions are greedy, so you were matching everything between the first and last parens, as you noticed. Putting the question mark ther

Re: [R] Convert list to data frame while controlling column types

2009-08-24 Thread Alexander Shenkin
sed the previous emails. > Your final_dataf is same as df. Yes, that is the point. As I mentioned in the first email of this thread, I was trying to get around as.data.frame's automatic conversion routines, in order to retain the original column types. And it turned out that gsub() w

Re: [R] Convert list to data frame while controlling column types

2009-08-23 Thread Alexander Shenkin
left out "as.data.frame" in my previous solution. So it now becomes: > final_dataf = as.data.frame(lapply(final_dataf, function(x){ is.na(x) + <- grep('^\\s*$',x); return(x) }), stringsAsFactors = FALSE) Hope that clarifies things, and thanks for your help. Thanks, All

Re: [R] Convert list to data frame while controlling column types

2009-08-22 Thread Alexander Shenkin
On 8/21/2009 3:04 PM, David Winsemius wrote: > > On Aug 21, 2009, at 3:41 PM, Alexander Shenkin wrote: > >> Thanks everyone for their replies, both on- and off-list. I should >> clarify, since I left out some important information. My original >> dataframe has some

Re: [R] Convert list to data frame while controlling column types

2009-08-21 Thread Alexander Shenkin
, take the more specified class names(col_types)=NULL col_types = unlist(col_types) final_dataf = as.data.frame(lapply(final_dataf, function(x) gsub('^\\s*$',NA,x)), stringsAsFactors = FALSE) final_dataf = reset_col_types(final_dataf, col_types) Thanks, Allie On 8/21/2009 10:54 AM

[R] Convert list to data frame while controlling column types

2009-08-21 Thread Alexander Shenkin
Hello all, I have a list which I'd like to convert to a data frame, while maintaining control of the columns' data types (akin to the colClasses argument in read.table). My numeric columns, for example, are getting converted to factors by as.data.frame. Is there a way to do this, or will I have

[R] Symbolic references - passing variable names into functions

2009-08-12 Thread Alexander Shenkin
Hello All, I am trying to write a function which would operate on columns of a dataframe specified in parameters passed to that function. f = function(dataf, col1 = "column1", col2 = "column2") { dataf$col1 = dataf$col2 # just as an example } The above, of course, does not work a