similar to: which() over a matrix

Displaying 20 results from an estimated 2000 matches similar to: "which() over a matrix"

2007 Aug 06
2
warnings()
Hi, Is there a way to know which library is giving a warning? Specifically, I'm getting a set of warnings: "Too many open raster files" Thanks and best wishes, -- Javier Garc?a-Pintado Institute of Earth Sciences Jaume Almera (CSIC) Lluis Sole Sabaris s/n, 08028 Barcelona Phone: +34 934095410 Fax: +34 934110012 e-mail:jgarcia at ija.csic.es
2007 Feb 01
3
indexing without looping
Hello, I've got a data.frame like this: > > assignation <- data.frame(value=c(6.5,7.5,8.5,12.0),class=c(1,3,5,2)) > > assignation > value class 1 6.5 1 2 7.5 3 3 8.5 5 4 12.0 2 > > > and a long vector of classes like this: > > x <- c(1,1,2,7,6,5,4,3,2,2,2...) > And would like to obtain a vector of length =
2007 Feb 01
3
indexing
Hello, In a nutshell, I've got a data.frame like this: > assignation <- data.frame(value=c(6.5,7.5,8.5,12.0),class=c(1,3,5,2)) > assignation value class 1 6.5 1 2 7.5 3 3 8.5 5 4 12.0 2 > and a long vector of classes like this: > x <- c(1,1,2,7,6,5,4,3,2,2,2...) And would like to obtain a vector of length = length(x), with the corresponding
2006 Dec 12
3
expression()
Hi, I'm trying to use expression() to write a text to a graphic in the margin. Using: mtext(expression(beta),side=1,line=2) writes a perfect beta greek character, but I need to add a subindex "max", and I'm trying: mtext(paste(expression(beta),"max"),side=1,line=2) simply writes "beta max" in the plot. Please, Could you tell me what I'm doing wrong?
2007 May 21
1
help with this indexing
Hi all, Let's say I have a long data frame and a short one, both with three colums: $east, $north, $value And I need to fill in the short$value, extracting the corresponding value from long$value, for coinciding $east and $north in both tables. I know the possibility: for (i in 1:length(short$value)){ short$value[i] <- long$value[long$east==short$east & long$north==short$north] } How
2006 Dec 19
1
xaxt="n" for image()
Hi, The argument xaxt="n" for removing the x axis from a image plot does not work for me. I'm really using a function called plot.grassmeta() in library GRASS that is a wrapper for image(), but it seems to me that the problem is not in plot.grassmeta() but in image(). If I'm right could you tell me if there is a way to remove one axis from a call to image()? Thanks and wishes,
2007 Jan 05
1
gstat package. "singular" attibute
Hello, I'm using the gstat package within R for an automated procedure that uses ordinary kriging. I can see that there is a logical ("singular") atrtibute of some adjusted model semivariograms: .- attr(*, "singular")= logi TRUE I cannot find documentation about the exact meaning and the implications of this attribute, and I dont know anything about the inner calculations
2007 Aug 07
0
warning in library(GRASS)
Hi, With your help I've found out that library(GRASS) is the responsible for several warnings I'm obtaining. I've got a loop (~100 runs) and for every loop, I'm carrying out several operations over a sequence of raster maps (12) read from the GRASS GIS. But for every map and loop I always use RGRASS.temp as the R-workspace name for the imported raster files, no matter the name of
2009 Mar 21
0
Solved: [Fwd: Matching failure in merge()]
I've found where the problem was and a way to solve this problem: One dataset was encoded (and read) as UTF-8 and the other one was encoded (en read) as latin3 In this case, even if at the terminal you see the same characters, R states that the two elements are not equal. Don't know if this is the way it has to be, or this is a bug. Anyway, editing the second file (encoded as latin3)
2007 Jul 24
1
Renamig a factor
Which is the proper way to rename a factor? If I do: test$Parc[test$Parc=="Ol?rdola"]<-"Ol?rdola" R complains that Warning message: invalid factor level, NAs generated in: `[<-.factor`(`*tmp*`, test$Parc == "Ol?rdola", value = "Ol?rdola") Thanks Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra "Jaume Almera" (CSIC) LLuis Sole
2008 Apr 18
1
space between plots
I've set layout(matrix(c(1,3,2,4),ncol=2)) and par(mar=c(0, 4, 4, 0) + 0.0) and par(mar=c(0, 0, 4, 3) + 0.0) for the upper-left and upper-right plots, but still get an space between both plots, is there any way to completely eliminate that space? Thanks Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra "Jaume Almera" (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain
2008 May 19
2
Log or diary file
Hi! Is it possible to set a file to which both commands and output would get automatically saved? I've tried with sink(), but only get the output. I mean something like a combined history and sink, as you get with File/Save to File.. in the windows GUI. Tis is done with diary filename in Matlab, and you can state diary on and diary off to control what is being saved to the file. Thanks Agus
2008 Sep 12
2
Greyed text in the background of a plot
Hi! Is there any way of having a greyed ("ghosted") text (i.e, 2006) in the background of a plot? I'm making a dynamic plot and would like to show the year of each time step as a big greyed text in the background. (the idea comes from Hans Rosling video: http://video.google.com/videoplay?docid=4237353244338529080&sourceid=searchfeed ) Thanks Agus -- Dr. Agustin Lobo Institut
2009 Jul 03
4
Function to eliminate blank space within strings?
Is there an specific function to eliminate blank space within strings? Thanks -- Dr. Agustin Lobo Institut de Ciencies de la Terra "Jaume Almera" (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: Agustin.Lobo at ija.csic.es http://www.ija.csic.es/gt/obster
2009 Sep 02
1
Problem at subsetting matrix by using dimnames
Given: > mitest <- matrix(1:16,ncol=4) > dimnames(mitest)[[1]] <- c("a","b","c","d") > dimnames(mitest)[[2]] <- c("a","b","c","d") > mitest a b c d a 1 5 9 13 b 2 6 10 14 c 3 7 11 15 d 4 8 12 16 I can do: > mitest[cbind(c(1,2,3),c(2,3,2))] [1] 5 10 7 but using the names does not
2008 Jul 28
1
Converting from char to POSIX:
Given char vector delme2: > str(delme2) chr [1:1065] "30-1-08 8:48:21" "30-1-08 8:55:17" "30-1-08 9:00:22" ... I do: > delme3 <- strptime(delme2,format="%d-%m-%y %H:%M:%S") But then: > str(delme3) POSIXlt[1:9], format: "2008-01-30 08:48:21" "2008-01-30 08:55:17" ... > length(delme3) [1] 9 whie >
2008 May 21
2
Proportional axes
Hi! If I'm plotting 2 variables with the same units (i.e. wing length of 2 species), how can I force that X and Y axes have the same size for length unit? For example, if X ranges from 0 to 10 and Y ranges from 10 to 30, I want Y axis to be twice as long as X axis. I know I can just put xlim and ylim from 0 to 30, i.e., plot(runif(10,0,10),runif(10,10,30),xlim=c(0,30),ylim=c(0,30)) but this
2011 Aug 24
1
as.numeric() and POSIXct format
Hi! I'm confused by this: > as.numeric(as.POSIXct(518400,origin="2001-01-01")) [1] 978822000 I guess the problem is that as.numeric() assumes a different origin, but cannot find any default origin. How can I get back the seconds from the POSIXct format? In other words, which the inverse function of as.POSIXct()? I've tried as.numeric and unclass() using a origin=
2008 Jun 27
4
Recoding
Hi! Given a vector (or a factor within a df),i.e. v1 <- c(1,1,1,2,3,4,1,10,3) and a dictionary cbind(c(1,2,3),c(1001,1002,1003)) is there a function (on the same line than recode() in car) to get v2 as c(1001,1001,1001,1002,1003,4,1001,10,1003) ? I'm using myself a function based on match() since long ago (I think that thanks to advice by Prof. B. Ripley), but would like to know if there
2007 Oct 26
2
cut.dendrogram and cutree
Hi! In the example: hc <- hclust(dist(USArrests), "ave") dend1 <- as.dendrogram(hc) dend2 <- cut(dend1, h=70) Do the branches "Branch 1", "Branch 2", "Branch 2"...in dend2$upper str(dend2$upper) --[dendrogram w/ 2 branches and 4 members at h = 152] |--[dendrogram w/ 2 branches and 2 members at h = 77.6] | |--leaf "Branch 1" (h=