[R] readLines errors

2011-12-24 Thread rusers.sh
Hi All, I met a problem using readLines function to return the data from Google maps. readLines(url( http://ditu.google.cn/maps/geo?q=+qianshuichong,+guichi+anhui,+CNoutput=csvkey=ABQIq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg;), n=1, warn=FALSE) [1]

Re: [R] readLines errors

2011-12-24 Thread rusers.sh
as a default explorer? Or how can i find the possible solution for IE to return the same result as Google Chrome . Confusing. 2011/12/24 David Winsemius dwinsem...@comcast.net On Dec 24, 2011, at 4:12 AM, rusers.sh wrote: Hi All, I met a problem using readLines function to return the data from

Re: [R] readLines errors

2011-12-24 Thread rusers.sh
suggestions or help? ÔÚ 2011Äê12ÔÂ24ÈÕ ÏÂÎç5:12£¬rusers.sh rusers...@gmail.comдµÀ£º Hi All, I met a problem using readLines function to return the data from Google maps. readLines(url( http://ditu.google.cn/maps/geo?q=+qianshuichong,+guichi+anhui,+CNoutput=csvkey=ABQIq8Fnd_oUka

[R] obtain coordinates in google earth

2011-12-20 Thread rusers.sh
Hi all, Anybody has ever used R to automatically search the coordinates in GE? I searched the website, but cannot find some useful information. My addresses are not very regular, so the methods that require the strict address formats may be not good. Say my address is kingston ontario

Re: [R] use same breaks and colors, but the displayed scale are different-image.plot()

2010-09-16 Thread rusers.sh
Thanks guys. I forgot to use the argument zlim. It's solved. 2010/9/16 Jim Lemon j...@bitwrit.com.au On 09/16/2010 12:05 PM, rusers.sh wrote: Hi all, I want to put several figures in a one figure for easy comparison, so i need to use the same methods to plot these figures. The following

[R] use same breaks and colors, but the displayed scale are different-image.plot()

2010-09-15 Thread rusers.sh
Hi all, I want to put several figures in a one figure for easy comparison, so i need to use the same methods to plot these figures. The following is an example. I also list my method, but it does not work. #Example data x- 1:10; y- 1:10; z- outer( x,y,+);z2- outer( x,y,-) #Quick view them

[R] cannot allocate vector of size 381.5 Mb

2010-08-30 Thread rusers.sh
Hi, I read some posts from the mailing list on the same problem, but it seems that i still cannot solve this problem. I only want to generate some simulated data. #Generate 2500 observations-it works without errors coords-as.matrix(expand.grid(seq(0,100,length.out=50),

Re: [R] generate random numbers from a multivariate distribution with specified correlation matrix

2010-08-24 Thread rusers.sh
Great. It is more clearer for me. Thanks all. 2010/8/24 Michael Dewey m...@aghmed.fsnet.co.uk At 02:40 24/08/2010, rusers.sh wrote: Hi all, rmvnorm()can be used to generate the random numbers from a multivariate normal distribution with specified means and covariance matrix, but i want

Re: [R] generate random numbers from a multivariate distribution with specified correlation matrix

2010-08-24 Thread rusers.sh
BTW, can you recommend a book on statistical simulations? I want to know more on how to generate random numbers from distributions, how to generate the theoretical models,... Thanks a lot. 2010/8/24 Michael Dewey m...@aghmed.fsnet.co.uk At 02:40 24/08/2010, rusers.sh wrote: Hi all, rmvnorm

[R] generate random numbers from a multivariate distribution with specified correlation matrix

2010-08-23 Thread rusers.sh
Hi all, rmvnorm()can be used to generate the random numbers from a multivariate normal distribution with specified means and covariance matrix, but i want to specify the correlation matrix instead of covariance matrix for the multivariate normal distribution. Does anybody know how to generate

Re: [R] generate random numbers from a multivariate distribution with specified correlation matrix

2010-08-23 Thread rusers.sh
be similar as that. It will be better to only need us to specify the correlation matrix, mean values and possible variances. One of my aim is to simulate random fields. Thanks. 2010/8/23 Ben Bolker bbol...@gmail.com rusers.sh rusers.sh at gmail.com writes: rmvnorm()can be used to generate

Re: [R] problem of R CMD check

2010-04-22 Thread rusers.sh
or may not be related to your code. Just ram the examples through a debugger. Have fun, Dennis On Wed, Apr 21, 2010 at 8:22 PM, rusers.sh rusers...@gmail.com wrote: Hi Dennis, I mean the V2.10.1. :-) 2010/4/21 Dennis Murphy djmu...@gmail.com Hi Jane, The new version of R is coming out

[R] problem of R CMD check

2010-04-21 Thread rusers.sh
Hi all, Today, i just installed the newest R version 2.10.1 and other necessary tools for building R package under windows,e.g. Rtools, perl. All are the newest version. After the correct configuration under windows, i use it to re-check my old package. I found the following prolem when

[R] Use a variable of a list in a loop

2010-04-07 Thread rusers.sh
Hi all, My problem may be related with the list manipulations. See below. #example data a-list() a[[1]]-data.frame(matrix(c(1:4),ncol=2)); a[[2]]-data.frame(matrix(c(5:8),ncol=2)) I can use a[[1]]$X1,a[[1]]$X2,a[[2]]$X1,a[[2]]$X2 to use the corresponding variables. But what i need to do is

Re: [R] Use a variable of a list in a loop

2010-04-07 Thread rusers.sh
Cool. Using [[var]] instead of $var to extract the expected variable is really what i want. Thanks. Guys. 2010/4/7 Steve Lianoglou mailinglist.honey...@gmail.com Hi, On Wed, Apr 7, 2010 at 6:27 PM, rusers.sh rusers...@gmail.com wrote: Hi all, My problem may be related with the list

[R] selected observations based several variables

2010-04-07 Thread rusers.sh
Hi, My problem maybe a little bit complicated, so forgive me if the following words are too much. #date set a0-matrix(c(1.1,1.3,1.1,1.3,1.3, 2.0,1.8,2.0,1.8,1.8, 12/01/2008,05/20/2007,12/06/2008,05/10/2007,05/06/2007, N,N,A,C,A, 1,2,3,4,5),ncol=5,byrow=FALSE) a0-data.frame(a0);

[R] Error--memory could not be read

2010-03-14 Thread rusers.sh
Hi, I wrote my own function to finish my work. One strange thing happened. If i set the number of simulations to be 10, it goes correctly. But if i set the number of simulations into 100, then errors appeared. Error information: The instruction at 0x6abf12cf referenced memory at 0x0286fff8. The

[R] split function

2010-02-26 Thread rusers.sh
Hi, I am using split function and wonder how to add the factor to the splitted results. #Example n - 3; nn - 10 g - factor(round(n * stats::runif(n * nn))) #factor x - rnorm(n * nn) + sqrt(as.numeric(g))#value xg - split(x, g) xg $`0` [1] 0.82513702 -0.03911584 2.32955347 0.36745335

Re: [R] split function

2010-02-26 Thread rusers.sh
above. That is, 7 for level 0, 9 for level 1, et al. Thanks. 2010/2/26 Henrique Dallazuanna www...@gmail.com Try this: split(data.frame(x, g), g) On Fri, Feb 26, 2010 at 3:55 PM, rusers.sh rusers...@gmail.com wrote: Hi, I am using split function and wonder how to add the factor

Re: [R] split function

2010-02-26 Thread rusers.sh
Thanks. I think i mistake the sampling() with split(). 2010/2/26 David Winsemius dwinsem...@comcast.net On Feb 26, 2010, at 2:40 PM, rusers.sh wrote: Your method seems to only re-express the data data.frame(x, g) using another format. In all fairness to the first respondent to your

[R] Change an array into a dataset of four variables, dim1, dim2, dim3 and its elements

2010-01-20 Thread rusers.sh
Hi, See my example below. a-array(1:12,c(2,3,2)) a , , 1 [,1] [,2] [,3] [1,]135 [2,]246 , , 2 [,1] [,2] [,3] [1,]79 11 [2,]8 10 12 I want to get a result something like dim1 dim2 dim3 elements 111 121 1

[R] forgot the function to divide a dataset into equal parts

2010-01-19 Thread rusers.sh
Hi, I just cannot remember the R function to divide a dataset into equal parts. And i searched the divide dataset into equal parts in R site, but cannot find it. Anybody can tell me that function. I am just blocked by it. Thanks a lot. -- - Jane Chang Queen's

Re: [R] forgot the function to divide a dataset into equal parts

2010-01-19 Thread rusers.sh
Yes. I am looking for them. Thanks. 2010/1/19 jim holtman jholt...@gmail.com ?cut ?split On Tue, Jan 19, 2010 at 3:18 PM, rusers.sh rusers...@gmail.com wrote: Hi, I just cannot remember the R function to divide a dataset into equal parts. And i searched the divide dataset into equal

[R] could we use : to represent multiple matrice in a list or sequential chracter names

2010-01-19 Thread rusers.sh
Hi, I know we can use 1:10 to represent the 1,2,3,...,10 numbers, but the following conditions are except. Anybody knows how to represent the following two cases with similar usage of : or others? Usually, i will get several hundred names for them, such as a1,a2,... or f[[1]],f[[2]],...

[R] get the ranks for arrays

2010-01-18 Thread rusers.sh
Hello, 'rank' function seems to be only for vectors, but i need to get the ranks for 3-dimensional arrays. See problems below. #Example Data a1-array(1:12,c(2,3,2)); a2-array(2,c(2,3,2)); a3-array(0,c(2,3,2)) a1 , , 1 [,1] [,2] [,3] [1,]135 [2,]246 , , 2

[R] problem of data manipulation

2010-01-18 Thread rusers.sh
Hello, See my problem below. a-data.frame(c(s,c,c,n,n,n),c(rep(1,3),rep(2,3)),c(rep(2,3),rep(1,3)),c(01/01/1999,10/02/2000,13/02/2000,11/02/2000,15/02/2000,23/02/2000)) colnames(a)-c(var1,var2,var3,var4) a var1 var2 var3 var4 1s1201/01/1999 2c1210/02/2000

Re: [R] problem of data manipulation

2010-01-18 Thread rusers.sh
Thank you so much. I got it. 2010/1/18 William Dunlap wdun...@tibco.com -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Monday, January 18, 2010 12:32 PM To: William Dunlap; 'rusers.sh'; r-help@r-project.org Subject: RE: [R] problem of data

Re: [R] problem of data manipulation

2010-01-18 Thread rusers.sh
...@tibco.com -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Monday, January 18, 2010 12:32 PM To: William Dunlap; 'rusers.sh'; r-help@r-project.org Subject: RE: [R] problem of data manipulation Absolutely... so long as you assume the dates are in order

[R] change codes into loops

2010-01-18 Thread rusers.sh
Hi, See example. for (i in 1:2) { for (j in 1:3) { b_1[i,j]-rank(c(a1[i,j],a2[i,j],a3[i,j]))[1] b_2[i,j]-rank(c(a1[i,j],a2[i,j],a3[i,j]))[2] b_3[i,j]-rank(c(a1[i,j],a2[i,j],a3[i,j]))[3] } } The inner codes is really repeated, so i want to change the inner codes into loops.

Re: [R] change codes into loops

2010-01-18 Thread rusers.sh
Winsemius dwinsem...@comcast.net On Jan 18, 2010, at 7:19 PM, rusers.sh wrote: Hi, See example. for (i in 1:2) { for (j in 1:3) { b_1[i,j]-rank(c(a1[i,j],a2[i,j],a3[i,j]))[1] b_2[i,j]-rank(c(a1[i,j],a2[i,j],a3[i,j]))[2] b_3[i,j]-rank(c(a1[i,j],a2[i,j],a3[i,j]))[3

[R] %d/%m/%Y can not be displayed in a .rd file

2010-01-07 Thread rusers.sh
Hi all, I found the date format (e.g.%d/%m/%Y) in the .rd file cannot be displayed after building the package. See below, ###.rd file \examples{ a-10/20/1999 DateConversion(a,DateIn=%m/%d/%Y,DateOut=%d/%m/%Y) } The result is Examples: a-10-20-1999 DateConversion(a,DateIn=

Re: [R] %d/%m/%Y can not be displayed in a .rd file

2010-01-07 Thread rusers.sh
Solved. Thanks a lot. 2010/1/7 Duncan Murdoch murd...@stats.uwo.ca On 07/01/2010 2:09 PM, rusers.sh wrote: Hi all, I found the date format (e.g.%d/%m/%Y) in the .rd file cannot be displayed after building the package. See below, ###.rd file \examples{ a-10/20/1999 DateConversion

[R] Anybody can suggest a better method to build a package while ignoring some functions

2010-01-05 Thread rusers.sh
Hi, Say i have three functions in a new package, a,b and c. I only want the one function a to be exported for use. b and c are not very stable. If i specify to export all the three functions in the NAMESPACE file (export(a,b,c)), no errors appeared after checking the package. And i am sure

[R] Error on checking a package with some functions ignored

2010-01-04 Thread rusers.sh
Hi, Say i have three functions in a new package, a,b and c. I only want the one function a to be exported for use. b and c are not very stable. If i specify to export all the three functions in the NAMESPACE file (export(a,b,c)), no errors appeared after checking the package. But if i only

[R] checking package errors-'require' calls not declared and no visible global function definition

2009-12-24 Thread rusers.sh
Hi, I got two errors after i checking my package. The errors are as follows, Error1: * checking for unstated dependencies in R code ... WARNING 'library' or 'require' calls not declared from: boot np Error2: * checking R code for possible problems ... NOTE myfunction: no visible global

Re: [R] checking package errors-'require' calls not declared and no visible global function definition

2009-12-24 Thread rusers.sh
and the second is a note. You did not get any errors. On Thu, Dec 24, 2009 at 9:40 PM, rusers.sh rusers...@gmail.com wrote: Hi, I got two errors after i checking my package. The errors are as follows, Error1: * checking for unstated dependencies in R code ... WARNING 'library' or 'require

Re: [R] insert a dot to the numbers

2009-12-21 Thread rusers.sh
Thanks a lot. 2009/12/20 Henrique Dallazuanna www...@gmail.com Try this also: sapply(s, function(x)format(x, big.interval = nchar(x) - 3, big.mark = .)) On Sun, Dec 20, 2009 at 7:50 PM, rusers.sh rusers...@gmail.com wrote: Hi, Anybody can give me some hints on the following problem

[R] insert a dot to the numbers

2009-12-20 Thread rusers.sh
Hi, Anybody can give me some hints on the following problem? s-c(110,112321) I want to insert a dot . after the third number and get the following results. 110. 112.321 Thanks a lot. -- - Jane Chang Queen's [[alternative HTML version deleted]]

Re: [R] Error for making packages under windows XP-Error in library.dynam(lib, package, package.lib)

2009-12-17 Thread rusers.sh
Dear Duncan, I just followed an example to try making a package. The problem is really on the useDynLib. It works after i delete it. Thanks a lot. 2009/12/17 Duncan Murdoch murd...@stats.uwo.ca rusers.sh wrote: Hi, I have installed the necessary tools for making a R package under windows

[R] Error for making packages under windows XP-Error in library.dynam(lib, package, package.lib)

2009-12-16 Thread rusers.sh
Hi, I have installed the necessary tools for making a R package under windows and am sure these tool have been correctly configured. I am very new to try writing a package, so the error may be very obvious for you. Forgive me if it is too easy. My package name is *stam*, and i put it under the

[R] Confused on using expand.grid(), array(), image() and npudens(np) in my case

2009-12-13 Thread rusers.sh
Hi all, I want to use the npudens() function in the np package (multivariate kernel density estimation), but was confused by the several functions in the following codes,expand.grid(),array(),image() and npudensbw(). This confusion will only be generated in =3 dimensions. I marked the four

Re: [R] Why cannot get the expected values in my function

2009-12-09 Thread rusers.sh
Thanks very very much. It is really not easy to change from one language to another. :) 2009/12/9 Gavin Simpson gavin.simp...@ucl.ac.uk On Tue, 2009-12-08 at 23:22 -0500, David Winsemius wrote: On Dec 8, 2009, at 11:07 PM, rusers.sh wrote: Hi, In the following function, i hope

[R] Why cannot get the expected values in my function

2009-12-08 Thread rusers.sh
Hi, In the following function, i hope to save my simulated data into the result dataset, but why the final result dataset seems not to be generated. #Function simdata-function (nsim) { result-matrix(NA,nrow=nsim,ncol=2) colnames(result)-c(x,y) for (i in 1:nsim) { set.seed(i) result[i,]-

Re: [R] why the same values cannot be judged to be the same in R

2009-11-13 Thread rusers.sh
at the 'recycling' of arguments and then you may understand what is happening: data2[(data2$x1 %in% data_1$x1) (data2$y1 %in% data_1$y1) (data2$tag == 0),] areaid x1 y1 tag 2 1 1.53 2.34 0 4 1 1.52 2.35 0 On Thu, Nov 12, 2009 at 10:04 PM, rusers.sh rusers...@gmail.com wrote

[R] why the same values cannot be judged to be the same in R

2009-11-12 Thread rusers.sh
Hi Rusers, I found sometimes that the same values cannot be judged to be the same in R. Anybody knows the probelm? I think i ignored some minor detail. Thanks. Here is the example.

Re: [R] Outputing multilple subsets

2009-11-09 Thread rusers.sh
. - Jane Chang Queen's 2009/11/9 Johann Hibschman joha...@gmail.com On Nov 8, 2009, at 7:23 PM, rusers.sh wrote: for (i in num) { c_num-c[c$b==num,] write.csv(c_num,file=c:/c_num.csv) } Warning messages: 1: In c$b == num : longer object length is not a multiple of shorter object

Re: [R] Outputing multilple subsets

2009-11-09 Thread rusers.sh
Thanks for your ideas. They are really helpful for me to think about my question. Cheers, 2009/11/9 David Winsemius dwinsem...@comcast.net On Nov 9, 2009, at 8:45 AM, rusers.sh wrote: Hi Johann, Excellent. That is what i really want. A little problem is why the c.n does not exist. Should

[R] how to stop a loop in a sampling

2009-11-09 Thread rusers.sh
Hi, When i tried to merge two datasets (multiple to multiple merge), i met a problem on how to stop a possible loop in the sampling arguments. ###My codes are as follows.###

[R] Outputing multilple subsets

2009-11-08 Thread rusers.sh
Hi Rusers, I hope to divide the original dataset into several subsets and output these multilple datasets. But errors appeared in my loops. See example. ## a-c(1:10) b-c(rep(1,3),rep(2,3),rep(3,4)) c-data.frame(a,b) #c is the example data num-c(unique(b)) # I hope to get the subsets

[R] probem on merge data

2009-11-05 Thread rusers.sh
Hi there, data1-matrix(data=c(1,1.2,1.3,3/23/2004,1,1.5,2.3,3/22/2004,2,0.2,3.3,4/23/2004,3,1.5,1.3,5/22/2004),nrow=4,ncol=4,byrow=TRUE) data1-data.frame(data1) names(data1)-c(areaid,x,y,date) data1 areaid x y date 1 1 1.2 1.3 3/23/2004 2 1 1.5 2.3 3/22/2004 3 2 0.2 3.3