[R] interior and exterior colors of a map

2009-11-25 Thread dxc13
mage WITHIN the United States boundary. Does anyone know a way to do this? Thanks in advance, dxc13 -- View this message in context: http://old.nabble.com/interior-and-exterior-colors-of-a-map-tp26507134p26507134.html Sent from the R help mailing list archiv

Re: [R] Deleting columns from a matrix

2009-05-24 Thread dxc13
at[, ind] > > > I hope it helps. > > Best, > Dimitris > > > dxc13 wrote: >> useR's, >> I have a matrix given by the code: >> mat <- >> matrix(c(rep(NA,10),1,2,3,4,5,6,7,8,9,10,10,9,8,NA,6,5,4,NA,2,1,rep(NA,10),1,2,3,4,NA,6,7,8,9,10),10,

[R] Deleting columns from a matrix

2009-05-24 Thread dxc13
ontain all missing values and which don't. Is there a function or something else that may be able to help me accomplish this? Thanks in advance. dxc13 -- View this message in context: http://www.nabble.com/Deleting-columns-from-a-matrix-tp23695656p23695656.html Sent from the R help

Re: [R] how to calculate means of matrix elements

2009-05-19 Thread dxc13
eck wrote: > > Try this: > > (mat1 + mat2 + mat3) / 3 > > On Mon, May 18, 2009 at 8:40 PM, dxc13 wrote: >> >> useR's, >> I have several matrices of size 4x4 that I want to calculate means of >> their >> respective positions with.  For exampl

[R] how to calculate means of matrix elements

2009-05-18 Thread dxc13
et this result I need? Thanks in advance, dxc13 -- View this message in context: http://www.nabble.com/how-to-calculate-means-of-matrix-elements-tp23607694p23607694.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.or

[R] can I plot a matrix of colors?

2009-05-14 Thread dxc13
60 & cellcol < 75] <- "#EE9A00" #Red cellcol[cellcol >= 75 & cellcol < 90] <- "#EE" #Firebrick cellcol[cellcol >= 90] <- "#B2" My question is, can I plot this matrix using image() or do the colors need to be in a

[R] Overlaying two plots

2009-05-13 Thread dxc13
, xlab="Longitude", ylab="Latitude") abline(v=-180, h=90, col="red") abline(v=180, h=-90, col="red") Can anyone help? Thanks in advance. dxc13 http://www.nabble.com/file/p23526662/TM_WORLD_BORDERS_SIMPL-0.2.RData TM_WORLD_BORDERS_SIMPL-0.2.RData http://

Re: [R] plotting a grid with color on a map

2009-05-13 Thread dxc13
Thanks, Jim. This seems to be what I am looking for. Just have to fine tune the colors to get some distinctive greens, blues, yellows and oranges in there and I should be good to go. Jim Lemon-2 wrote: > > It was the NAs that fooled color2D.matplot. This gets your colors, > although not exac

[R] plotting a grid with color on a map

2009-05-12 Thread dxc13
o create a map of the world using map() and add a grid to it using map.grid(), but I can't color code the cells the way I need. Is there a way to do this in R? Thanks again. dxc13 http://www.nabble.com/file/p23514804/time1test.txt time1test.txt -- View this message in context: http://www.nabb

Re: [R] Plotting colors on a world map

2009-05-12 Thread dxc13
in getting this task accomplished. Thanks Duncan Murdoch-2 wrote: > > On 5/11/2009 10:32 AM, dxc13 wrote: >> Hi useR's >> >> I have created a simple map of the world using the following code: >> m <- map(xlim=c(-180,180), ylim=c(-90,90)) >> map.axes()

[R] Plotting colors on a world map

2009-05-11 Thread dxc13
re colors in their respective grid cells on the map? Take this data matrix as some example data: T <- sample(-10:90, 2592, replace=TRUE) mat <- matrix(T, nrow=36, ncol=72) Thanks in advance, dxc13 -- View this message in context: http://www.nabble.com/Plotting-colors-on-a-world-map-tp234

[R] A variation on the bar plot

2009-05-04 Thread dxc13
6 4.53 4.29 4.47 Hope this is clear, Thanks in advance. dxc13 -- View this message in context: http://www.nabble.com/A-variation-on-the-bar-plot-tp23374466p23374466.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pro

Re: [R] gridding values in a data frame

2009-04-30 Thread dxc13
Thank you for your input. I will give it a try and see how it works out. I always have the same problem when programming...I always make things more complicated than they really are :-). Much appreciated. jdeisenberg wrote: > > > > dxc13 wrote: >> >> Hi all, >

[R] gridding values in a data frame

2009-04-30 Thread dxc13
to be put into a grid cell, than that cell should get a missing value, NA, put into it. Also, could the gridded result for each time be written to a text file before processing the next time value? Hope this is clear. Thanks in advance. dxc13 -- View this message in context: http

[R] how to cite R data sets

2008-11-04 Thread dxc13
Hi, As part of a project I am doing, I am using the "airquality" data set that comes built into R as a means of showing an example of how my analysis will be carried out. I know that citation("package") will produce a citation for any R package, but is there a proper way to cite this data set?

[R] smoothing with the Gaussian kernel

2008-09-04 Thread dxc13
useR's, Does anyone know what function or package allows one to specify use of the Gaussian kernel to smooth a data set, or is this just the default for most functions? Thanks, dxc13 -- View this message in context: http://www.nabble.com/smoothing-with-the-Gaussian-kernel-tp19323294p193

[R] how to draw a perspective pyramid

2008-08-31 Thread dxc13
Dear list, I am trying to construct a perspective plot of a 2D triangle, or pyramid. I can easily do the one dimensional plot (code below), but I can't figure out how to do it in a perspective plot for two input variables. Does anyone have a simple solution? Thanks! Derek #code for a triangl

Re: [R] help with "persp" function

2008-08-30 Thread dxc13
Yes, this works nicely. Thank you! jholtman wrote: > > Is this what you want to do: > > x <- seq(from=1,to=3,by=.1) > y <- seq(1,4,by=.1) > z <- matrix(1, length(x), length(y)) > persp(x=x,y=y,z,zlim=c(0,2)) > > > On Sat, Aug 30, 2008 at 2:08 PM, dxc1

[R] help with "persp" function

2008-08-30 Thread dxc13
is a plane, not a cube. Below is my current code. Any help is appreciated Thanks in advance dxc13 x <- seq(from=1,to=3,by=.1) y <- seq(1,4,by=.1) f <- array(1,dim=c(21,1)) z <- as.matrix(cbind(x,y,f)) persp(x=x,y=y,z) -- View this message in context: http://www.nabble.com/help

Re: [R] finding a faster way to do an iterative computation

2008-07-29 Thread dxc13
Thank you to all who applied. These all seem to work the way I want them to. The outer function seems really useful, I probably could use that for a lot of my work. Thanks! Rolf Turner-3 wrote: > > > On 30/07/2008, at 6:12 AM, dxc13 wrote: > >> >> useR's, >

[R] finding a faster way to do an iterative computation

2008-07-29 Thread dxc13
gt; x [1] 1 2 3 4 5 > xk [1] 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 I want to do: abs(x-xk[i]) where i = 1 to length(xk)=13. It should result in a 13 by 5 matrix or data frame. Does anyone have a "quicker" solution than FOR loops or apply()? Much appreciation and t

[R] simple random number generation

2008-07-24 Thread dxc13
useR's, I want to randomly generate 500 numbers from the standard normal distribution, i.e. N(0,1), but I only want them to be generated in the range -1.5 to 1.5. Does anyone have a simple way to do this? Thanks, dxc13 -- View this message in context: http://www.nabble.com/simple-r

[R] including data frames in R packages

2008-02-24 Thread dxc13
useR's, Does any one know if there is a size limitation on the data frames that can be included in R packages. I have a data set in a text file that I would like to include in a package I am building and it is 8.5 MB in size. Will this be problematic? Is the process for including data sets in

[R] applying a function to data frame columns

2008-02-21 Thread dxc13
of hard-coding this, can the function given above, which will restrict the u data frame to values within the ranges of each variable, be done with the apply function? Thanks in advance. dxc13 -- View this message in context: http://www.nabble.com/applying-a-function-to-data-frame-columns-tp15

[R] extending code to handle more variables

2008-02-20 Thread dxc13
(x[,2] - xk$x2[j]) Ik1 <- which(w1 <= h[1]) Ik2 <- which(w2 <= h[2]) Ik <- intersect(Ik1, Ik2) YIk <- yvals[Ik] yk[j] <- mean(YIk) } The result is the one-dimensional vector yk. Does anyone know how to extend this code to cover any num

Re: [R] intersecting rows of a matrix

2008-02-20 Thread dxc13
.call(intersection,lk.list) > > 2008/2/20, dxc13 <[EMAIL PROTECTED]>: >> >> useR's, >> >> First, I would like to say thanks to John Fox for providing this segment >> of >> code to perform intersection for multiple sets: >> intersection &

Re: [R] intersecting rows of a matrix

2008-02-20 Thread dxc13
Thanks Gabor, that works great! Gabor Grothendieck wrote: > > Try this: > > do.call(intersection, unname(as.data.frame(t(mat > > > On Wed, Feb 20, 2008 at 6:45 PM, dxc13 <[EMAIL PROTECTED]> wrote: >> >> useR's, >> >> First, I

[R] intersecting rows of a matrix

2008-02-20 Thread dxc13
useR's, First, I would like to say thanks to John Fox for providing this segment of code to perform intersection for multiple sets: intersection <- function(x, y, ...){ if (missing(...)) intersect(x, y) else intersect(x, intersection(y, ...)) } I want to execute this function on

[R] re placing values in a matrix

2008-02-01 Thread dxc13
useR's, Consider: y <- c(20, 25, 30) > m <- matrix(c(0.0,1,NA,0.5,1.25,0.75, 0.5, NA, > NA),byrow=TRUE,nrow=3,ncol=3) > m [,1] [,2] [,3] [1,] 0.0 1.00 NA [2,] 0.5 1.25 0.75 [3,] 0.5 NA NA For each numeric value, I want to replace them with their corresponding y-value. The result s

[R] re stricting points in a data frame

2008-01-30 Thread dxc13
atisfied for both points, not just one of them; i.e., if an x1 point satisfies this, but its corresponding x2 point does not, then this point should be removed. Does anyone know a way to do this, in general, for any data frame? Hope this is not confusing. Thanks in advance dxc13 -- View this m

[R] help with levelplot()

2008-01-22 Thread dxc13
useR's, I want to create a "movie" of a sin function (from 0 to pi/2) using levelplot() in the lattice package. I basically want to create 20 or so plots of the sin function starting with an amplitude of 0 and ending at amplitude 1. By using a loop and plotting these in succession, it will have

[R] color ranges on a 2D plot

2008-01-16 Thread dxc13
useR's I am trying to color the points on a scatter plot (code below) with two colors. Red for values 0.5 -1.0 and blue for 0.0 - .49. Does anyone know a easy way to do this? x <- runif(100, 0, 1) y <- runif(100, 0, 1) plot(y ~ x, pch=16) Thanks, dxc13 -- View this message in con

Re: [R] matching values in a list

2008-01-11 Thread dxc13
nction(x) mean(as.numeric(names(x))[x >> == length(a)])) >> >> By the way, note that the a you define is slightly different from the >> a displayed in your post. >> >> >> On Jan 11, 2008 6:09 PM, dxc13 <[EMAIL PROTECTED]> wrote: >> > >> > use

[R] matching values in a list

2008-01-11 Thread dxc13
erage of 10 and 13. Then repeat the same process for the second column. The data here is only a sample, but with the data I work with, there are many more columns in each matrix in the list. Does anyone know a efficient way to do this? Maybe using lapply()? Thanks in advance. dxc13 -- Vie

Re: [R] changing the values in a list

2008-01-10 Thread dxc13
I will give it a try, thanks for your input! Peter McMahan wrote: > > > On Jan 10, 2008, at 9:48 PM, Peter McMahan wrote: > >> y <- matrix(rep(y,ncol(x)),nrow=nrow(y)) >> x[is.na(x)] <- y[is.na(x)] > > oops, i meant: > y <- matrix(rep(y,ncol(res)),nrow=nrow(y)) > res[is.na(res)] <- y[is.na(r

[R] changing the values in a list

2008-01-10 Thread dxc13
useR's, Does anyone know of an efficient way to change the values in a list to different numbers stored in an object? For example, consider the following: y <- matrix(c(20, 13, 25, 10, 17), ncol = 1) > res [[1]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [

Re: [R] using mapply()

2008-01-08 Thread dxc13
Rizopoulos > Ph.D. Student > Biostatistical Centre > School of Public Health > Catholic University of Leuven > > Address: Kapucijnenvoer 35, Leuven, Belgium > Tel: +32/(0)16/336899 > Fax: +32/(0)16/337015 > Web: http://med.kuleuven.be/biostat/ > http://www.st

[R] using mapply()

2008-01-08 Thread dxc13
useR's, This is a follow up question to one I previously asked. Consider the 3-element list below > res [[1]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] NA NA NA 1.25 0.25 0.75 NA NA NANANANA 1.25 0.25 [2,] 1.25 0.25 0.7

Re: [R] using lapply()

2008-01-08 Thread dxc13
lic University of Leuven > > Address: Kapucijnenvoer 35, Leuven, Belgium > Tel: +32/(0)16/336899 > Fax: +32/(0)16/337015 > Web: http://med.kuleuven.be/biostat/ > http://www.student.kuleuven.be/~m0390867/dimitris.htm > > > - Original Message - > From: "

[R] using lapply()

2008-01-08 Thread dxc13
useR's, I am trying to find a quick way to change some values in a list that are subject to a condition to be NA. Consider the 3x1 matrix: delta <- matrix(c(2.5,2.5,1), nrow = 1) And consider the list named v that has 3 elements > v v[[1]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]

[R] Avoiding FOR loops

2008-01-06 Thread dxc13
useR's, I would like to know if there is a way to avoid using FOR loops to perform the below calculation. Consider the following data: > x [,1] [,2] [,3] [1,]4 111 [2,]192 [3,]733 [4,]364 [5,]685 > xk Var1 Var2 Var3 1 -0.2

Re: [R] expand.grid function

2007-12-23 Thread dxc13
Yes, that works perfectly. Thank you for your help! Derek Charilaos Skiadas-3 wrote: > > Hi Derek, > On Dec 23, 2007, at 10:59 PM, dxc13 wrote: > >> >> useR's, >> >> I have used expand.grid() several times and like the results it >> gives m

[R] expand.grid function

2007-12-23 Thread dxc13
useR's, I have used expand.grid() several times and like the results it gives me. I am now trying something with it that I have not been able to get to work. For any n column matrix I would like to run this function on those n columns and store the results. For example, if my matrix has 1 colum

[R] alternate storage options

2007-12-20 Thread dxc13
useR's. I am working with an algorithm in which I will need to create combinations of all the points I have in a matrix. When I have 2 variables, I simply use expand.grid() to do this. Sometimes I am faced with 3 or more variables and if I run expand.grid(), R cannot process it due to the huge

Re: [R] plot3d, wireframe, persp help

2007-12-20 Thread dxc13
When using the wireframe function you need to create a 2D grid for your two X variables. Try the "expand.grid" function on your data, then run the wireframe on that result Brad B-2 wrote: > > Hello, > I am trying to get a surface plot of a data set that looks like the > following, > 1 2

[R] creating a database

2007-12-17 Thread dxc13
useR's, I am writing a program in which the input can be multidimensional. As of now, to hold the input, I have created an n by m matrix where n is the number of observations and m is the number of variables. The data that I could potentially use can contain well over 20,000 observations. Ca

[R] how to compare 2 numeric vectors

2007-09-17 Thread dxc13
tions satisfy this, then return '0' I would like to store the results as an object. If anyone has any ideas, I would greatly appreciate it. Thanks! dxc13 -- View this message in context: http://www.nabble.com/how-to-compare-2-numeric-vectors-tf4469582.html#a12743842 Sent from the