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
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
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,
>
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
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
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
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
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
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()
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
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
, 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://
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
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
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
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
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,
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
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,
>
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
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
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
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
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
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
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
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]
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: "
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
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
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] [
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
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
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
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
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
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
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
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
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
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
.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 &
(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
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
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
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?
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
47 matches
Mail list logo