search for: xy

Displaying 20 results from an estimated 1307 matches for "xy".

Did you mean: xyz
2012 Nov 17
3
transform input argument (matrix) of function
Dear list!   I would like to write a function to transform matrix, which is input argument of a written function. It is easy with new matrix (see below), but my idea is to transform input argument (matrix) of function without any additional matrixes. Here is an example: fun1 <- function(xy) { xy <- cbind(xy[,1], xy[,2], xy[,1] + xy[,2]) return(xy) }   df1 <- matrix(c(1,2,3,1,2,3), ncol = 2) fun1(df1)   fun2 <- function(xy) { xy <- cbind(xy[,1], xy[,2], xy[,1] + xy[,2]) return(invisible(xy)) }   fun2(df1) df1 > should be      [,1] [,2] [,3] [1,]    1    1    2 [2,]    2...
2012 Jun 04
1
Plotting with Rgraphviz
...h directed edges Number of Nodes = 6 Number of Edges = 9 > plot(am.graph, attrs = list(node = list(fillcolor = "lightblue"), + edge = list(arrowsize=0.5))) There were 18 warnings (use warnings() to see them) > warnings() Warning messages: 1: In plot.xy(xy.coords(x, y), type = type, ...) : "len" is not a graphical parameter 2: In plot.xy(xy.coords(x, y), type = type, ...) : "edgemode" is not a graphical parameter 3: In plot.xy(xy.coords(x, y), type = type, ...) : "len" is not a graphical parameter 4: In plot.xy(...
2009 Jun 09
3
Splicing factors without losing levels
Hi list! An operation that I often need is splicing two vectors: > splice(1:3, 4:6) [1] 1 4 2 5 3 6 For numeric vectors I use this hack: splice <- function(x, y) { xy <- cbind(x, y) xy <- t(xy) dim(xy) <- length(x) * 2 return(xy) } So far, so good (?). But I also need splicing for factors and I tried this: splice <- function(x, y) { xy <- cbind(x, y) xy <- t(xy) dim(xy) <- length(x) * 2 if (is.factor(x) &am...
2008 Apr 22
1
plot(x) in 2.7.0 (with y=NULL) proposed code correction
...n(..., col, bg, pch, cex, lty, lwd) plot.window(...) localTitle <- function(..., col, bg, pch, cex, lty, lwd) title(...) if (!is.null(y)) { ## normal plot x against y xlabel <- if (!missing(x)) deparse(substitute(x)) ylabel <- deparse(substitute(y)) xy <- xy.coords(x, y, xlabel, ylabel, log) xlab <- if (is.null(xlab)) xy$xlab else xlab ylab <- if (is.null(ylab)) xy$ylab else ylab xlim <- if (is.null(xlim)) range(xy$x[is.finite(xy$x)]) else xlim ylim <- if (is.null(ylim)) range(xy$y[is.finite(xy$y)])...
2008 May 13
1
deliver exits with status 89 on some but not all mails of a batch
...or example because an employee mailed all other (local) employees, the following happens: Some mails are being delivered as advertised, but on some mails, deliver exits with status 89 and the message bounces. Here is a (postfix) log that illustrates the problem. I replaced all receivers with 'xy', but they are in fact all different. May 13 17:58:32 mail1 postfix/smtpd[28164]: connect from unknown[192.168.0.103] May 13 17:58:32 mail1 postfix/smtpd[28164]: 1D6508FD93FF: client=unknown[192.168.0.103] May 13 17:58:33 mail1 postfix/cleanup[28165]: 1D6508FD93FF: message-id=<200805131758...
2014 Mar 21
1
Memcheck: error in a switch using getGraphicsEvent
...---------------- choiceChangeParam <- function(paramChoice){ texte <- paste(" ~ Choice : menu ~\n",sep="") choix <- getGraphicsEvent(texte,onKeybd=function(key){return(key)}) switch(EXPR=choix, "Up" = { if(xy[1]>1){ paramChoice['toDo'] <- "xy" xy[2]<-1 xy[1]<-xy[1]-1 paramChoice['xy']<-xy }else{paramChoice['toDo'] <- ""} },...
2005 Aug 15
2
How to get a list work in RData file
Dear R-Helper, I want to know how I get a list work which I saved in RData file. For example, > test.xy <- function(x,y) { + xy <- x+y + xy + } > > xyadd <- test.xy(x=2, y=3) > xyadd [1] 5 > x1 <- c(2,43,60,8) > y1 <- c(91,7,5,30) > > xyadd1 <- test.xy(x=x1, y=y1) > xyadd1 [1] 93 50 65 38 > save(list = ls(all=TRUE), file = "testxy.RData...
2010 Aug 26
1
Passing arguments between S4 methods fails within a function:bug? example with raster package.
...his problem came up initially while debugging a function, but it seems to be a more general problem of R. I hope I'm wrong, but I can't find another explanation. Let me illustrate with the raster package. For an object "RasterLayer" (which inherits from Raster), there is a method xyValues defined with the signature (object="RasterLayer",xy="matrix"). There is also a method with signature (object="Raster",xy="vector"). The only thing this method does, is change xy into a matrix and then pass on to the next method using callGeneric again....
1999 Jul 14
2
Weird behavior with names()
...racking System. (RedHat 6.0, R-0.64.2 compiled from source, not RPM). # a trivial test x <- 1:5 y <- 6:10 names(x) <- c("a", "b", "c", "d", "e") names(y) <- c("a", "b", "c", "d", "e") xy <- cbind(x,y) ## test names() > names(x) [1] "a" "b" "c" "d" "e" > names(xy) NULL > names(xy[,1]) [1] "a" "b" "c" "d" "e" So far, so good. But now look at what happens when I trie...
2009 Jun 25
1
Calculating home ranges using mcp in adehabitat
...I've fiddled around with it but to no avail...Below is the output of the demo that I've attempted to follow, followed by a subset of my data (for one individual) and the code I've been trying. Can anyone tell me where I may be going wrong??? #Demo output... > data(puechabon) > xy<-puechabon$locs[,c("X","Y")] > id<-puechabon$locs$Name > ## The data are: > xy[1:4,] ## relocations coordinates X Y 1 699889 3161559 2 700046 3161541 3 698840 3161033 4 699809 3161496 > id[1:4] ## ID [1] Brock Brock Brock Brock Levels:...
2010 Sep 27
2
Adding row name to dataframe
...a value to a dataframe and name the row with a number.? I have tried row.name, rowname, and attr(x,"row.names") but none seem to work.? It seems like it should be simple, so not sure why I can't get it to work.? Any suggestions? Thanks, Tim x<-seq(1,20,2) y<-seq(20,1,-2) xy<-data.frame(x,y) xy<-rbind(xy,c(0,0)) #Threeattempts that fail row.names(xy[11,])<-c("12") rownames(xy[11,])<-c("12") attr(xy[11,], "row.names")<-c("12") ?Tim Clark Marine Ecologist National Park of American Samoa
2012 Dec 29
1
bug in plot.ts?
Dear all, I think I have found a buglet in plot.ts plot.ts(x=1,type="n") # correct: does not show the plot plot.ts(x=1,y=1,type="n") # not correct: does show the plot I did not investigate the problem in depth but it could be related to the switch xy.labels, in fact plot.ts(x=1,y=1,type="n",xy.labels=TRUE) # does show the plot plot.ts(x=1,y=1,type="n",xy.labels=FALSE) # does not show the plot > sessionInfo() R version 2.15.2 Patched (2012-10-26 r61028) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=I...
2006 Jan 21
1
Bug in xy.coords() or documentation error?
Hi, I noticed the following problem with xy.coords() in R 2.2.1-patched (version info at the foot of this email) and R 2.3.0 unstable (subversion no: r37123): > xy.coords(x = matrix(1:20, ncol = 2)) Error in xy.coords(x = matrix(1:20, ncol = 2)) : argument "y" is missing, with no default > xy.coords(x = matrix(1:20,...
2001 Mar 12
2
residuals from lowess fit
...ndent variable, without residuals. e.g. > z <- lowess(....) > names(z) [1] "x" "y" I think from a look at the lowess() function that the coding where residuals are calculated is in C? > lowess function (x, y = NULL, f = 2/3, iter = 3, delta = 0.01 * diff(range(xy$x[o]))) { xy <- xy.coords(x, y) if (length(xy$x) != length(xy$y)) stop("x and y lengths differ") n <- length(xy$x) o <- order(xy$x) .C("lowess", x = as.double(xy$x[o]), as.double(xy$y[o]), n, as.double(f), as.integer(iter), as.doub...
2010 Feb 09
3
split strings in a vector and convert it to a data.frame
hi, I have a vector full of strings like; xy_100_ab xy_101_ab xy_102_ab xy_103_ab I want to seperate each string in three pieces and the separator should be the "_" at the end I want a data.frame like: column1 column2 column3 xy 100 ab xy 101 ab xy 102 ab xy 103 ab I tried strsplit but I couldn't figure out how...
2008 Jul 29
3
table questions
Hi again! Suppose I have the following: > xy <- round(rexp(20),1) > xy [1] 0.1 3.4 1.6 0.4 1.0 1.4 0.2 0.3 1.6 0.2 0.0 0.1 0.1 1.0 2.0 0.9 2.5 0.1 1.5 0.4 > table(xy) xy 0 0.1 0.2 0.3 0.4 0.9 1 1.4 1.5 1.6 2 2.5 3.4 1 4 2 1 2 1 2 1 1 2 1 1 1 > Is there a way to set things up to have 0 - 0.4 0.5 -...
2011 Feb 21
2
(no subject)
...d how can i get it to work so i can load other data? > library(splancs) > area = 6*4 > lambda = 1.5 > N = rpois(1,lambda*area) > u = runif(N,-2,4) > v = runif(N,0,4) > plot(u,v,asp=1) > h = chull(u,v) > h = c(h,h[1]) > plot(u[h],v[h],"1",asp=1) Error in plot.xy(xy, type, ...) : invalid plot type '1' > plot(u[h],v[h],"l",asp=1) > points(u,v) Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet > pts=as.points(u,v) > pointmap(pts) > hullpoly=as.points(u[h],v[h]) > polymap(hullpolly,add=...
2005 Oct 26
0
self starting function for nonlinear least squares.
...photosynthetic rate # Rd is the dark resiration rate (positive value) # theta is the shape parameter # alpha is the initial quantum yeild # (1/(2*theta))* (alpha*Irr + Am - sqrt((alpha*Irr + Am)^2 -4*alpha*theta*Am*Irr))- Rd } attr(,"initial") function (mCall, LHS, data) { xy <- sortedXyData(mCall[["Irr"]], LHS, data) if (nrow(xy) < 3) stop("Too few unique irradiance values") fit <- smooth.spline(xy[, "x"], xy[, "y"]) alpha <- predict(fit, x = 0, deriv = 1)$y if(min(xy[,"x"],na.rm=...
2012 Jun 13
0
Plotted circle does not go through desired points - very long email with code
...much as i could ;-) ? library(plotrix) library(CircStats) library(spatstat) ? plot.new() ?# draw.circle will give an error without a plot open ? although for now i don't want to plot it. r=20 cr <- draw.circle(0, 0, r, nv=200) n <- dim(mat)[1] p <- round(seq(1, 200, 200/n)) xy <- data.frame(x = cr$x[p], y = cr$y[p])? # get coordinates for the 10 points in mat. row.names(xy) <- dimnames(mat)[[2]] ? # decide to draw the arc (circle) between the 8th point in mat (point "H") and its first dependency (point "B") ? i=8 j=1 ? m <- xy$y[i]/xy...
2001 May 04
1
scoping error in xy.coords (PR#932)
Hola! > rm(list=ls(all=TRUE)) > x <- 1:20 > y <- 1+x+rnorm(x) > xy.coords(y ~ x,NULL) ... expected output, correct, but when called from inside lowess: > lowess(y ~ x) Error in xy.coords(x, y) : x and y lengths differ > debug(xy.coords) > lowess(y ~ x) debugging in: xy.coords(x, y) ... long listing deleted if (is.language(x)) { if (in...