similar to: Help on vectorizing

Displaying 20 results from an estimated 4000 matches similar to: "Help on vectorizing"

2011 Sep 06
2
Sweave : some comments disappear
Dear R-helpers, when I have an R code chunk in a sweave file like this: <<>>= x <- 1:10 # this comment disapears x # this one does not! print(x) #mean mean(x) @ The first comment does not appear in the sweaved document, the second one does. How can this be? I have tried print=TRUE and keep.source=TRUE, but neither seem to affect this behavior. thanks, Remko
2009 Aug 19
2
RGoogleDocs/RCurl through proxy
Dear list, I am trying to use RGoogleDocs, but I am connecting through a proxy server. I know RCurl is used for the connection, which should be able to deal with proxies and such. How do I set this up for RCurl? And can I use those settings with RGoogleDocs as well? I have the name of the proxy server and the port number. (Windows XP). thanks, Remko
2010 Jun 02
2
Faster union of polygons?
Dear R-helpers, thanks for yesterday's speeding-up tip. Here is my next query: I have lots of polygons (not necessarily convex ones, and they never have holes) given by x,y coordinates. I want to get the polygon that is the union of these polygons. This is my current method, but I am hoping there is a faster method (up to thousands of polygons, each with ca. 40 xy points). Example:
2010 Oct 25
2
R-Fortran question (multiple subroutines)
Dear R-helpers, apologies if this is somewhere in a manual, I have not been able to find anything relevant. I run Windows Vista. I have some Fortran code in a subroutine, and have no problem calling this from R with .Fortran, compiling the code either with 'R CMD SHLIB' or independently with gfortran. But is it possible to have more than one subroutine in my source file, one depending
2009 Oct 20
1
system() or shell() with python script
Hi all, I am having some problems calling a python script from R that resides in a folder that is in the path (WindowsXP): > system("quickPadTool.py") Warning message: In system("quickPadTool.py") : quickPadTool.py not found # I also tried 'shell' (and shell.exec as well). > shell("quickPadTool.py") 'quickPadTool.py' is not recognized as an
2010 Mar 30
1
SHLIB not working (Win Vista)
Dear R-helpers, I tried to build a DLL like I have done so many times, but this time on my new machine, but it gives the erorr: (from cmd window) >R CMD SHLIB Boxcnt.f MAKE Version 5.2 Copyright (c) 1987, 2000 Borland Error c:/PROGRA~1/R/R-210~1.1/share/make/winshlib.mk 4: Command syntax error *** 1 errors during make *** The error is not in my Fortran file, because I also tried other files
2009 Jul 20
1
Problem with as.POSIXct on dates object
Dear R-helpers, I have a problem converting an object made with the 'chron' function to a POSIXct object: # Make date based on DOY dat <- chron(dates=232, origin.=c(month=1, day=1, year=2008)) dat #[1] 08/20/08 # Converting to POSIXct uses current timezone (Sydney): as.POSIXct(dat) #[1] "2008-08-20 10:00:00 EST" # Setting GMT timezone has no effect? as.POSIXct(dat,
2010 Oct 19
1
DLL not found
Dear R-helpers, I have a fresh installation of windows vista, and R 2.12.0 (session info below). Problem: > require(sp) Loading required package: sp Error in library.dynam(lib, package, package.lib) : DLL 'lattice' not found: maybe not installed for this architecture? > require(lattice) Loading required package: lattice Failed with error: ?package 'lattice' is not
2007 Mar 13
4
'substitute' question
# I use this code to label a graph with the R2: # graph x <- rnorm(100) y <- x + rnorm(100) lm1 <- lm(y~x) plot(x,y) # label R2text <- substitute(paste(R^2," = ",r2),list(r2=r2)) text(1,-3,R2text, col="red") # i have modified this a bit, so that i have a vector with other labels, each of which # will be labelled on the graph. Example: texts <- c("And the
2011 Jun 28
2
gam confidence interval (package mgcv)
Dear R-helpers, I am trying to construct a confidence interval on a prediction of a gam fit. I have the Wood (2006) book, and section 5.2.7 seems relevant but I am not able to apply that to this, different, problem. Any help is appreciated! Basically I have a function Y = f(X) for two different treatments A and B. I am interested in the treatment ratios : Y(treatment = B) / Y(treatment = A) as
2012 May 03
1
deparse(substitute(x)) on an object with S3 class
Dear list, can someone explain to me why deparse(substitute(x)) does not seem to work when x is of a user-defined S3 class? In my actual problem, my print method is part of a package, and the method is registered in the NAMESPACE, if that should make a difference. > print.testclass <- function(x,...){ xname <- deparse(substitute(x)) cat("Your object name
2009 Feb 11
1
How to tell if lattice is current device?
Dear R-helpers, I have a function that adds some segments to the current plot, but if I the current plot is made with any of the lattice functions (in my case, levelplot), I should use lsegments rather than segments. How can I tell if the current device was made with plot() or e.g. levelplot() or another lattice function? dev.cur() does not help me, it just tells me "windows 2".
2009 Feb 26
2
interpSpline with dates?
Dear R-helpers, can I use a POSIXct date as the x variable in interpSpline? The help page says x and y need to be numeric... is there a workaround? example: library(splines) testdfr <- data.frame(Date=seq(as.POSIXct("2008-08-01"),as.POSIXct("2008-09-01"), length=10)) testdfr$yvar <- rnorm(10) sp <- interpSpline(yvar ~ Date, testdfr) preddfr <-
2003 Feb 26
3
horizontal high-density lines?
Hi all, the option type="h" in plot() makes nice vertical (histogram-like) lines. Is there a way to make similar, horizontal lines? I can of course resort to using lines() multiple times, but i was hoping that there is a more elegant solution. thanks, Remko Duursma Ph.D. student Dept. Forest Resources Forest Biometrics Lab University of Idaho, Moscow, ID.
2009 Feb 13
2
Running examples failed (but there are none).
Dear R-helpers, making a package (windowsXP), that includes a bunch of functions, but none have examples (all example code is within \dontrun{} blocks). I do R CMD check Maeswrap, all bits get OK-ed, except: "Running examples in 'Maeswrap-Ex.R' failed." When I run the 'Maeswrap-Ex.R' file myself, there are no problems. Any pointers? thanks Remko
2003 Sep 01
3
meta-analysis question
Dear R-helpers, i have the following situation: i have a bunch of y=b0 + b1*x from different studies, and want to estimate a "general" y=f(x). I only have the b0,b1's and R-squareds. Should i weigh the separate equations by their R-squared? thanks Remko ^'~,_,~'^'~,_,~'^'~,_,~'^'~,_,~'^'~,_,~'^'~,_,~' Remko Duursma, Ph.D. student
2011 Aug 09
3
Sweave : allowing errors in R code?
Dear R-helpers, sorry if this is obvious, but I can't find this in the documentation. I am using Sweave, and have some code that does not actually work - but I want to include it anyway, including the error message that R produces. But on running Sweave() on my .Rnw file, it simply halts when it gets to the code chunk with the bad code. I can use \verbatim{} instead, but then I don't
2010 May 09
1
Plot polygon in 3D with rgl
Dear R-helpers, an rgl-ers in particular, what is the easiest way to plot a section of a plane in 3D, that is given by the xyz coordinates of the outline? Suppose I have a polygon - which I know for sure is a set of coordinates on the same plane. One method I found is to use surf.tri from the geometry package, and then plot the triangles with rgl.triangles. This method is not perfect though,
2003 Dec 29
2
Rcmd check package failure
Hi all, recently, i tried making a package with my own functions - which worked fine, until i reinstalled MikTex (in Win2000). Now i get the error message: * checking for working latex ... NO * using log directory 'C:/Rlibs/R4PG.Rcheck' * checking for file 'R4PG/DESCRIPTION' ... OK * checking if this is a source package ... OK ERROR Installation failed. But i set the path to
2003 Apr 07
5
How to sort a dataframe?
Dear R-helpers, for the purpose of plotting a dataframe, i am trying to sort a dataframe by one column, for example tester <- data.frame(one=c(3,2,1), two=c(2,3,1)) #> tester # one two #1 3 2 #2 2 3 #3 1 1 # I want to sort "tester" by column "one", so that i get a dataframe # that looks like: #one two #1 1 #2 3 #3 2 I know of 'sort' but