[R] problem with the image command

2013-04-09 Thread cassie jones
Hello R-users, I am trying to do an image plot where I have been given latitudes, longitudes and the values at the corresponding locations. A sample of the data is given as follows: values=c(0,1,0,0,0,0,2,2,0,0) lat=c(29.6660,29.6756,29.3492,29.2654,29.2827,29.4070,35.3510,35.6590,35.7587,38.2

Re: [R] problem with the image command

2013-04-09 Thread cassie jones
t;, yaxs = "i", xlab, ylab, > breaks, oldstyle = FALSE, useRaster, ...) > > Regards, > Pascal > > > > On 04/10/2013 10:07 AM, cassie jones wrote: > >> Hello R-users, >> >> I am trying to do an image plot where I have been given latitudes

[R] simulation from truncated skew normal

2013-06-11 Thread cassie jones
Hello R-users, I am trying to simulate from truncated skew normal distribution. I know there are ways to simulate from skewed normal distribution such as rsn(sn) or rsnorm(VGAM), but I could not find any command to simulate from a truncated skew-normal distribution. Does anyone know how to do that

[R] problem with input of integrate function

2013-06-16 Thread cassie jones
Dear R-users, I am trying to integrate a function using integrate command in R. The function is as follows, integrand function(x,a) { exp(-0.5*a*(1+x^2))/(1+x^2) } Now while I want to integrate it using the command integrate, I get the following error, integrate(integrand(x,2),0,inf) Error

Re: [R] problem with input of integrate function

2013-06-16 Thread cassie jones
Hi David, Thank you so much. -Cassie On Sun, Jun 16, 2013 at 9:19 PM, David Winsemius wrote: > > On Jun 16, 2013, at 7:15 PM, David Winsemius wrote: > > > > > On Jun 16, 2013, at 6:46 PM, cassie jones wrote: > > > >> Dear R-users, > >> > >&g

[R] Fwd: problem with kmeans

2014-04-28 Thread cassie jones
Dear R-users, I am trying to run kmeans on a set comprising of 100 observations. But R somehow can not figure out the true underlying groups, although other software such as Jmp, MINITAB are producing the desired result. Following is a brief example of what I am doing. library(stringdist) test=c

[R] executing loop in circular way

2010-09-09 Thread cassie jones
Dear all, I am writing a program using for loop. The loop contains i which runs from 1:n. There is a feature I need to include here. That is, when i=n, i+1 would be 1, not n+1. Basically the loop should run in a circular fashion. That also means, if i=1, i-1=n. Can anyone help me with this? How c

[R] plotting convex hull for 3D

2010-09-19 Thread cassie jones
Dear all, I have a 3 dimensional data and I need to plot a convex hull to it. I have done it for 2 dimensional case using chull command in R. But I think it does not work for more than 2 dimension. Can anyone help me with this? Is there anyway to plot the convex hull for more than 2 D case? Thank

[R] executing loop

2010-09-29 Thread cassie jones
Dear All, I am trying to define a loop for a m*n matrix, where i=1:n and j=1:m. Unlike the usual for loop, i should go in the following way: For j=1, i=1,2,3,n For j=2, i=n,n-1,n-2,..,1 For j=3, i=1,2,3,.n etc. which means i should go in either increasing or decreasing order alternat

[R] simulation from pareto distn

2010-11-09 Thread cassie jones
Dear all, I am trying to simulate from truncated Pareto distribution. I know there is a package called PtProcess for Pareto distribution...but it is not for truncated one. Can anyone please help me with this? Thanks in advance. Cassie [[alternative HTML version deleted]] __

[R] replace a row in a matrix

2010-11-14 Thread cassie jones
Dear all, I created a n*2 matrix and I want to replace the ith row with a vector. Can anyone suggest me what is the simple way to do it? Sorry for bothering you with such simple question. I appreciate any hints or advice. Thanks in advance. Cassie [[alternative HTML version deleted]]

[R] simulation from truncated poisson

2011-05-16 Thread cassie jones
Dear all, I need to simulate values from a Poisson distribution which is truncated at certain value 'a'. Can anyone tell me if there is in-built package in R which can simulate from a truncated Poisson? If not, what should be the steps to write a function which would do that? Thanks in advance.

Re: [R] simulation from truncated poisson

2011-05-16 Thread cassie jones
uniform between that value and 1, then feed that > uniform into the qpois function. > > > > *From:* cassie jones [mailto:cassiejone...@gmail.com] > *Sent:* Monday, May 16, 2011 7:46 PM > *To:* Greg Snow > *Cc:* r-help@r-project.org > *Subject:* Re: [R] simulation from tr

Re: [R] simulation from truncated poisson

2011-05-16 Thread cassie jones
--Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of cassie jones > Sent: Monday, May 16, 2011 5:28 PM > To: r-help@r-project.org > Subject: [R] simulation from truncated poisson > > Dear all, > > I need to simul

[R] how to overlay a map of US on image plot

2011-02-13 Thread cassie jones
Dear all, I have a data set which has latitude, longitude (not in increasing order) and observed precipitation corresponding to those locations. I am using image.plot command for that. But I want to overlay a map of US on that plot. I know we can use map('usa') to draw it, but I dont know how can

[R] help needed with histogram plotting

2011-03-06 Thread cassie jones
Dear all, I am trying to plot 3 histograms on the same graph using the following command. hist(x,xlim=c(0,100)) hist(y,add=TRUE) hist(z,add=TRUE) The xlim of y is c(20,21) and that of z is c(99,99.5) , whereas the variable x has xlim at c(0.5,2). Apparently, the graph end of displaying a line on

[R] defining an array with one of the elements being a vector

2011-03-08 Thread cassie jones
Dear all, I am trying to define an array as follows: a=array(NA,c(m,2,N,G)), Even though the numbers N and G are fixed, m is a vector. So, I can't define 'a' as above. For eg, N=3 G=6, but m=c(2,7,5) and length(m)=N. Can anyone suggest me how can I define 'a' when m is a vector? Thanks i

[R] Simulation from discrete uniform

2011-04-07 Thread cassie jones
Dear all, I am trying to simulate from discrete uniform distribution. But I could not find any in-built code in R. Could anyone help me please? Thanks in advance for the time and help. Cassie [[alternative HTML version deleted]] __ R-help

[R] spectral analysis

2011-08-23 Thread cassie jones
Hi all, I am trying to do spectral analysis of a time series data. But I am not sure how to do it. Can anyone tell me if there are any package I can use to do the analysis using fast fourier transform? Thanks in advance. Cassie [[alternative HTML version deleted]]

Re: [R] spectral analysis

2011-08-23 Thread cassie jones
Is there anything in R similar to spectogram command in matlab? On Tue, Aug 23, 2011 at 10:20 AM, Petr PIKAL wrote: > Hi > > > > Hi all, > > > > I am trying to do spectral analysis of a time series data. But I am not > sure > > how to do it. Can anyone tell me if there are any package I can use

[R] issue with strptime

2011-06-17 Thread cassie jones
Hi everyone, I have bunch of date and time observations in the format %Y-%m-%d %I %M %S %p. I used strptime() to read this format. But the problem is some of the times are in the format of %I %M %p, so for those times, strptime is giving me NA values. For example, strptime(paste("2009-04-08","1

[R] replacing duplicate rows

2011-07-21 Thread cassie jones
Hi all, I have a matrix which looks like the following, x=matrix(c(1,2,3,4,3,5,4,6,4,9),5,2,byrow=T) Now, I want to replace the 2nd columns of those 4 rows which have duplicate entries in the 1st column. For example, x[2,1]=x[3,1]=3 and I want to replace x[3,2] by x[2,2]. Similarly, I want to re

[R] how to convert seconds to 12 hour time format

2012-04-09 Thread cassie jones
Hello everyone, I am wondering if there is any routine in R which can convert time given in 'seconds' unit to the 12 hour time format. For example, suppose the data set looks like x=c(36885,84000,20) #x in seconds I want to get the output as [1] " 11:14:45 AM" [2] " 11:20:00 PM" [3] "12:20:00

Re: [R] how to convert seconds to 12 hour time format

2012-04-09 Thread cassie jones
%M:%S %p") > > > On Mon, Apr 9, 2012 at 9:38 PM, cassie jones > wrote: > > > > Hello everyone, > > > > I am wondering if there is any routine in R which can convert time given > in > > 'seconds' unit to the 12 hour time format. For exampl

[R] problem with break command

2012-04-26 Thread cassie jones
Hello R-users, I am having a problem with the 'break' command in R. I am wondering if anyone can help me out with this. My program is similar to the following. a=rep(NA,5) a[1]=0 for(i in 2:5) { a[i]=a[i-1]+runif(1,0,3) if(a[i]>5) { i=2 break } } What exactly I am

Re: [R] problem with break command

2012-04-26 Thread cassie jones
Thanks Berend, you are right. The break command would not work here. But the while loop is taking time to generate the desired. On Thu, Apr 26, 2012 at 2:39 PM, Berend Hasselman wrote: > > On 26-04-2012, at 21:30, cassie jones wrote: > > > Hello R-users, > > > > I a