similar to: Surprising behavior using seq()

Displaying 20 results from an estimated 2000 matches similar to: "Surprising behavior using seq()"

2010 Oct 05
3
reorder always returns "ordered"
Or at least is seems that way to me. It's not a big problem, but the behavior doesn't match the documentation. (I think r-help is the place to report this. ) > x <- factor(1:5) > x.ro <- reorder(x, rnorm(5)) > is.ordered(x.ro) # should be FALSE according to ?reorder [1] TRUE > > x.ro <- reorder(x, rnorm(5), ordered=FALSE) > is.ordered(x.ro) # should be FALSE
2010 Nov 29
3
Replacing several rows of a matrix at once
Hello Folks. This must be a silly question with a (not) obvious (to me) answer. Consider this: tmp <- matrix(1:200, nrow = 20) vec <- 300:309 tmp[9,] <- vec # replacing one row works fine p <- c(3, 11, 17) tmp[p,] <- vec # replacing multple rows pastes the values down a column and recycles vec. What I want to do is replace multiple rows simultaneously at once. I suppose I can
2010 Dec 09
1
Condional Density Plot from different data
I'm not certain I am using the lattice plot correctly here. Below is reproducible code. Suppose I have two data frames, such as: set.seed(1234) datA <- data.frame(condition = gl(3, 100), scores = c(rnorm(100), rnorm(100, 1,1), rnorm(100, 2,1))) datB <- data.frame(condition = gl(3, 1000), scores = c(rnorm(1000, 3,1), rnorm(1000, 4,1), rnorm(1000, 5,1))) I would like to plot the
2011 May 17
1
scales argument in bwplot (lattice)
Suppose I have data such as the following set.seed(12345) tmp <- data.frame(var1 = rnorm(100), var2 = rnorm(100), var3=rnorm(100, 10, 30)) tmp1 <- data.frame(vars = with(tmp, c(var1, var2, var3)), type = gl(3, 100)) var3 is on a different scale, but I create the following plot, which looks terrible as a result bwplot(~ vars|type, tmp1, layout = c(1,3), ) Of course, I can
2010 Nov 07
1
Rdindex truncating titles?
When building packages these days I keep getting warnings from "R CMD build" to the effect that INDEX is not up to date. The INDEXes always seem to be up do to date to *me*. Then I thought to compare the INDEX from the package source with the INDEX in the installed package (after building with the --force flag set). Doing a diff on the old INDEX (saved outside the source package
2010 Dec 04
2
Error in calcCurveGrob(x, x$debug) : End points must not be identical
Hi All... I haven?t found mention of this error anywhere. I'm trying to draw spline curves using grid graphics. Most of the time, I have no problems, but I have some data sets that give the error in the subject line. I'm not sure which end points are identical, but the end points passed to the function are definitely not identical. Any assistance appreciated! Bryan tst <-
2010 Nov 29
1
Sweave choking on \\ in filename
Dear all, Sweave chokes when using "\\" in the path to the Rnw file. Using "/" works fine. The problem is that Eclipse+StatET uses "\\" in the filename. And example of the error, traceback and sessionInfo are given below. Best regards, Thierry > Sweave("Q:\\BMK\\cursussen\\interne_opleiding\\deelnemerslijst.Rnw", syntax="SweaveSyntaxNoweb")
2010 Dec 06
1
lattice: strip panel function question
Dear list, If have some repeated measurement data which looks something like: time <- rep(1:5 , each=2*4) groups <- rep(c("Case", "Control"), each=4) subjects <- factor(rep(1:(2*4), 5)) responses <- time + rnorm(5*2*4) + as.integer(factor(groups)) data <- data.frame(responses, time, groups, subjects) Now I want to plot each subject in a separate panel:
2010 Nov 20
1
Grid newbie: aligning & scaling viewports
Oh Knowledgeable Ones: I'm working on a project using grid graphics (for the first time). A toy example is given below, run it simply with >foobar() I am wondering why the pink dot and concentric circles are not centered on the 3-color axis system. Further, I feel like the concentric circles don't have the intended radius - if my math is right, the outmost circle should touch the
2010 Nov 11
3
User input after opening graphing device
If I run the following: > windows() > > bringToTop(-1) > > interactive() [1] TRUE > > run <- readline(prompt = "Continue (Yes = 1, No = 2):") Continue (Yes = 1, No = 2): > dummy <- 1 > run [1] "" it does not allow user input though the session is interactive (it jumps right over the readline command). It would be great
2011 Mar 10
1
Lattice: Feature Request
Hi, I'm currently designing some global themes for use with lattice, and have hit a snag. There doesn't appear to be (in xyplot at least) a way of setting a lattice option for the 'scales' parameter at a global level - changes have to be made in each function call. For example, consider the following code: library(lattice) library(latticeExtra) # Create some data temp <-
2010 Oct 28
2
R and Matlab
Dear Group, I am looking for ways to use R and Matlab. Doing the data transformations in R and using the data in Matlab to analyze with some pre-defined scripts. Any good ways to transfer the data into matlab in its most recent version? I tried using R.matlab but the writeMat output is not readable by Matlab. I just need to output a data.frame and read it as is into matlab where I can do any
2011 Mar 14
1
hclust() memory issue
Hi, I have a microarray dataset of dimension 25000x30 and try to clustering using hclust(). But the clustering on the rows failed due to the size: > y<-hclust(dist(data),method='average') Error: cannot allocate vector of size 1.9 Gb I tried to increase the memory using memory.limit(size=3000), still got the same error. I also tried agnes() from cluster package and pvclust() from
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
2011 Feb 04
4
aggregate function - na.action
Can someone please tell me what is up with na.action in aggregate? My (somewhat) reproducible example: (I say somewhat because some lines wouldn't run in a separate session, more below) set.seed(100) dat=data.frame( x1=sample(c(NA,'m','f'), 100, replace=TRUE), x2=sample(c(NA, 1:10), 100, replace=TRUE), x3=sample(c(NA,letters[1:5]), 100, replace=TRUE),
2010 Aug 03
2
Specifying interactions in rms package... error
I am encountering an error I do not know how to debug. The error arises when I try to add an interaction term involving two continuous variables (defined using rcs functions) to an existing (and working) model. The new model reads: model5 <- lrm( B_fainting ~ gender+ rcs(exactage, 7) + rcs(DW_nadler_bv, 7) + rcs(drawtimefrom8am, 7)+ DW_firsttime+ DW_race_eth +
2010 Nov 19
0
Error from sparse pattern matrix product
Hi The following attempt to minimize memory consumption fails. m1 <- Matrix(c(rep(1,1000), rep(0,2000)), 1500) m2 <- as(m1, "ngCMatrix") Then m1 %*% c(1,2) produces the desired matrix product, while m2 %*% c(1,2) results in the error Error in x %*% y : Cholmod error 'invalid xtype' at file:../MatrixOps/cholmod_sdmult.c, line 82 I might be making a wrong
2010 Nov 02
1
Display of NAs in character columns of a data frame under fix() or edit().
Example: xxx <- data.frame(x=1:26,y=letters) xxx$x[c(2,4,6,8)] <- NA xxx$y[c(1,3,5,7)] <- NA yyy <- edit(yyy) The missing values in xxx$y appear as blanks in the spreadsheet window that appears, whereas the missing values in the numeric column "x" appear as "NA" (as I would expect). Is this a bug or a feature? cheers, Rolf Turner P.S. >
2011 Jan 27
1
Can not invoke maxent() of library(dismo) in GNU linux
Dear R-helpers and Dr. Hijmans, I can not invoke maxent() in GNU Linux. Could you give me any directions on that? There is maxent.jar in version 3.3.3e in the right folder. ######################################## R: > jar <- paste(system.file(package="dismo"), "/java/maxent.jar", sep='') > jar [1] "/ebio/abt6/jmao/rpacks/dismo/java/maxent.jar"
2009 Oct 25
3
Importing data from text file with mixed format
Hi, I'm having difficulty importing my textfile that looks something like this: #begin text file Timepoint 1 ObjectNumber Volume SurfaceArea 1 5.3 9.7 2 4.9 8.3 3 5.0 9.1 4 3.5 7.8 Timepoint 2 ObjectNumber Volume SurfaceArea 1 5.1