similar to: templating library for R

Displaying 20 results from an estimated 3000 matches similar to: "templating library for R"

2007 Mar 02
3
from function to its name?
Hi, I can get from a string to a function with this name: >f1 <- function(x){ mean(x) } >do.call("f1",list{1:4}) >get("f1") etc... But how do I get from a function to its name? >funcVec <- c(f1,median) >funcVec [[1]] function(x){ mean(x) } > str(funcVec) List of 2 $ :function (x) ..- attr(*, "source")= chr "function(x){ mean(x)
2005 Aug 29
2
reexpand a matrix after subsetting
Hi, suppose I have a matrix (or dataframe) as a result from subsetting. mat <- matrix(1:20,ncol=2) mat[c(3,6,9),] <- NA cc <- complete.cases(mat) sub <- mat[cc,,drop=FALSE] sub <- sub * 2 #some caluculations with sub. now I would like to expand sub somehow so row 3,6, and 9 would be filled with NAs but the rest should be in place again. Is there a simple function for this?
2007 Jul 05
1
ggplot2 customizing
Dear all, I know that ggplot2 documentation is coming along, but at the moment I can't find how to do the following: a) change the title of the legend b) get rid of the closing line at the bottom of the density line. I also observed that the density lines (after limiting the x-scale) extend a little bit into the surrounding of the plot, which can be seen very strong when plotted as pdf.
2007 Aug 09
1
depreciation of $ for atomic vectors
Dear All, I would like to know why $ was deprecated for atomic vectors and what I can use instead. I got used to the following idiom for working with data frames: df <- data.frame(start=1:5,end=10:6) apply(df,1,function(row){ return(row$start + row$end) }) I have a data.frame with named columns and use each row to do something. I would like the named index ($) because the column position in
2008 Nov 03
1
dev2bitmap: extra missing
Hi, I don't know if I am the first one to report the problem: in 2.8.0 dev2bitmap gained aa support, but "extra" is null if neither taa nor naa is specified. > dev2bitmap("plot.pdf",type="pdfwrite") Error in paste(shQuote(gsexe), " -dNOPAUSE -dBATCH -q -sDEVICE=", type, : object "extra" not found >
2005 Dec 13
1
correct C function usage
Hello, I am not sure if I am interfacing with C correctly and _safely_ or if there is a better way esp. with regards to terminating the "returned" array. I am trying to fill an int array with values whose actual size is determined in the C function and is always maximally as large as length(values). I also don't understand the purpose of $ab in the example: conv <- function(a,
2008 Jun 30
1
2.7.0 breaks read.table
Hi, yes a bold statement, but I get different behaviour from 2.6.2 and 2.7.0 in read.table, and I don't find any documentation in http://cran.r-project.org/src/base/NEWS. A file like (space delimited): foo + . bar - . 2.7.0: > tab <- read.table("test.txt",as.is=TRUE) > tab V1 V2 V3 1 foom 0 0 2 bar 0 0 while until now and on 2.6.2 > tab <-
2008 Jan 09
1
Rscript on OSX
Hi, I directed somebody to install R (2.6.1) on his OSX computer, following instructions from http://cran.r-project.org/bin/macosx. She can run R from the console. But plot(1:10) doesn't produce any output or open a window (as I am used to from linux). More importantly: Rscript is not in the path (minor problem ln -s is hopefully doable). I tried to put a hardcoded path to Rscript into the
2009 Jun 16
2
Statistically detecting thresholds...
Rers: I have some ecological data (stream velocity vs. % cover of submerged weeds) that shows strong evidence of a thresholding step-function, e.g. below some velocity, % cover ranges from 0% to 100% (with no apparent relationship to velocity within this range of velocities), but above a certain "threshold" velocity, the % cover does not appear to exceed, say, 10%. There are good
2010 Jan 17
2
For loops in R
Hello. I've just started using R and am trying to figure out if the two codes snippets below have the same output gBest<-floor(runif(popsize,min=1,max=top)) velocity[i,j]<<-.4* velocity[i,j] + 1 * runif(1) * (pbestsVar[i,j] - popVar[i,j]) + 1 * runif(1) * (archiveVar[gBest,j] - popVar[i,j]) and for (i in 1:popsize) { for (j in 1:maxvar) { gBest<-sample(top,size=1)
2011 Mar 18
1
predict lm doubt
Hello, does anyone knows this predict is not resulting? # lm predict dfTestes3sitesCriptic$Velocity_corrected <- ifelse (dfTestes3sitesCriptic$Season == "A" & dfTestes3sitesCriptic$BeforeAfter == "Before", (dfTestes3sitesCriptic$Velocity * mVel3ABefAfter), (ifelse (dfTestes3sitesCriptic$Season == "Sp" & dfTestes3sitesCriptic$BeforeAfter ==
2008 Jul 01
2
Graph Order in xyplot
I have constructed a Trellis style xyplot. lengthf <- factor(length) xyplot(SLI$velocity ~ SLI$width | SLI$lengthf, layout = c(2,7), xlab = "Width (cm)", ylab = "Velocity (m/s^2)", col = "black") This produces a lovely little plot. However, the grouping factor(lengthf) isn't in the right order. My values range from 2-28 and the 2 graph on the bottom left and
2009 Jun 17
2
Difference beetwen element in the same column
Hi, i have this file pressure,k,eps,zeta,f,velocity:0,velocity:1,velocity:2,vtkValidPointMask,Point Coordinates:0,Point Coordinates:1,Point Coordinates:2,vtkOriginalIndices 0.150545,0.000575811,0.0231277,0.000339049,-0.0193008,0.00318629,-6.24066e-07,5.39599e-05,^A,7,0,0,0 0.150546,0.000782719,0.0226157,0.000497957,-0.0192084,0.00367781,5.09813e-06,5.90689e-05,^A,7,0.0003035,0.000225,1
2003 Sep 26
3
Std. errors of intercept and slope
Dear all, I have the following output generated by linear regression. Since there is only one regression intercept and one slope for one set of data, what is the meaning of std. error for intercept and that of slope? Thanks in advance. Sincerely, Minghua > data(thuesen) > attach(thuesen) > lm(short.velocity~blood.glucose) Call: lm(formula = short.velocity ~ blood.glucose)
2012 Feb 29
2
function for filtering and deleting vector entries
Dear helpers I have two data sets saved as vectors (temperature and velocity). Now I need to "take out" a span of temperature and its corresponding velocity in the other vector. How can I achieve that? I tried to write a function,which takes a vector entry and then decides wether to delete the temperature entry or not and simultaneously doing so with same entry in the velocity
2006 Jul 16
2
CFD Plots in R and Other Things
Dear All, I am getting some data from fluid dynamics simulations (air mixing in a pipe, 2D axial symmetry, geometry described by a radial coordinate r and an axial coordinate z) which I'd like to plot and analyze with R. Think about slicing the cylinder along its axial direction to get a set of cross sections which are orthogonal to the z axis. For each section, I have a set of velocity
2010 Feb 16
1
RODBC missing values in integer columns
Hello, We are having some strange issues with RODBC related to integer columns. Whenever we do a sql query the data in a integer column is 150 actual data points then 150 0's then 150 actual data points then 150 0's. However, our database actually has numbers where the 0's are filled in. Furthermore, other datatypes do not have this problem: double and varchar are correct and do not
2005 Dec 04
2
tiff graphics
Colleagues I frequently insert PDF graphics created with R into Word (Office 2004 for Mac) documents. The documents are created on either a Linux machine (RedHat 9) or a Mac (Tiger). I am using R 2.2.0. These pdf graphics often lose a great deal of resolution after insertion into Word compared to their high quality when printed as PDF documents. I recently learned that converting the
2011 Dec 22
1
Adding math symbols to axis labels
I am trying to get m"dot"s^-1 in a x-axis label for a publication ready graph. I can get ms^-1 with no problem, but I can't get the symbol for the "dot" to work. I am have tried the following: plot(x,y,xlab=expression(paste("Target Velocity (",ms^-1,")")),ylab="Passage Probability",ylim=c(0,1)) which works fine. I tried changing to:
2010 Oct 08
1
Trapezoid Rule
Dear R Users, I've never used R before and my professor has asked us to do some pretty intense programming (or it's intense to me at least). Here is the question: Modify the function myquadrature inside the script so that it returns the quadrature of descrete data using the trapezoidal rule. Modify the call to the function at the bottom of the script so that is uses your modifies