Re: [R] distance by sea

2014-06-08 Thread jwd
On Thu, 5 Jun 2014 14:58:11 +0200 Giulia Fassio giuliafas...@gmail.com wrote: Hello, someone know if it is possible to use R to calculate distance by sea between two geographic coordinates? I have many points in the sea and I want to create a matrix using R of the length of trajectories

Re: [R] distance by sea

2014-06-08 Thread Yvan Richard
Tell me if I'm wrong, but I am guessing that you are trying to calculate the minimum distance between two points, given the presence of barriers between them. For this problem, I have been using cost distances. By giving a raster representing the cost of crossing one cell of the landscape, the

Re: [R] Standard Deviation in R

2014-06-08 Thread arun
Hi, Please check this link: http://stats.stackexchange.com/questions/25956/what-formula-is-used-for-standard-deviation-in-r A.K. It is my understanding that the R function SD finds the standard deviation of a random variable or a list. Please consider the following list: { 1, 2, 3 }. I claim

Re: [R] rake() error message

2014-06-08 Thread Anthony Damico
could you provide a reproducible example ?dput is your friend http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example On Sat, Jun 7, 2014 at 11:22 AM, Michael Willmorth mwillmo...@clearwater-research.com wrote: I'm teaching myself how to use rake() in the R

Re: [R] error in R program

2014-06-08 Thread Charles Determan Jr
Firstly, you both need to subscribe to the mailing list. Please go to https://stat.ethz.ch/mailman/listinfo/r-help and subscribe. In this way you will also get emails from people asking questions and may benefit or even contribute help to another. There are several other specialty help lists

Re: [R] Help with R package

2014-06-08 Thread Uwe Ligges
On 07.06.2014 23:34, Milan Bimali wrote: Dear R Community, I am in process of developing an R package which in turn depends on a package that is not available in CRAN but has to be downloaded from a web source (as follows). Could someone guide me on how to include the package listed in

Re: [R] Identifying one or more TRUE in the middle of an array

2014-06-08 Thread William Revelle
Yet another way which returns the row and column of the items you want rc - which(t(x[,-c(1,ncol(x))]),arr.ind=TRUE) #this identifies the rows and columns but is one column off rc[,1] - rc[,1] +1 #this adjusts the columns colnames(rc) - c(col,row) rc #show them Bill On Jun 6, 2014, at

[R] optFederov question

2014-06-08 Thread Andras Farkas
Dear All, seeking input (or assurance) that I am using the optFederov in AlgDesign apropriatelly... I have: require(AlgDesign) c -seq(1,64,by=0.1) econ=9.16 ic=4.796 hill=1.217 x=5.618 eff -econ-(ic*(c^hill/(x^hill+c^hill))) cand.list -data.frame(c=c,eff=eff,econ=econ,ic=ic,hill=hill,x=x)

[R] How to use fixed parameter in mle2() function from bbmle package?

2014-06-08 Thread Marc Girondot
Dear list-members, I discover recently bbmle package from an answer in r-list. It makes some analyses more easily to solve. However I have one problem using fixed parameter of mle2 and one question about parametrization of mle2. I send the question directly to the maintainer of the package but

Re: [R] plot in package psych with function error.bars.by

2014-06-08 Thread Tham Tran
Dear William, Thanks to your answer, i no longer waste time trying to get a solution for this question. I'm waiting your next release. Tham -- View this message in context: http://r.789695.n4.nabble.com/plot-in-package-psych-with-function-error-bars-by-tp4691632p4691877.html Sent from the

Re: [R] Interval for rnorm command?

2014-06-08 Thread zagreus
Thanks so much! The 'truncnorm' package did the trick for me! Such variables are uncommon in my field (psychology), so this is the first time I stumbled across this kind of distribution. -- View this message in context:

Re: [R] Interval for rnorm command?

2014-06-08 Thread arun
Hi, You may try: fun1 - function(len, low, high, mean, sd) {     x - rnorm(len * 2, mean, sd)     x - x[x high x low]     x[1:len] } ##slow fun2 - function(len, low, high, mean, sd) {     i - 1     while (i len) {     x - rnorm(1, mean, sd)     if (x high x low) {     i -

Re: [R] algo trading mcx india

2014-06-08 Thread arun
Hi VP, Not sure what you wanted.  Perhaps: library(XML) URL - http://money.securebank.in/index.php?option=com_dashboardview=historyItemid=56startdate=01/01/2013enddate=6/9/2014exchange=MCXsid=1;  doc - htmlParse(URL)  tableNodes - getNodeSet(doc, //table)  dat1 - readHTMLTable(tableNodes[[4]],

Re: [R] Use of library(X) in the code of library X.

2014-06-08 Thread Bart Kastermans
Thanks Max and Duncan for the replies. To Max in particular I would say that ready code written in possibly non-optimal style (though I did not read enough of caret to have an opinion on that code in particular) would be good practice too. When I was a professor and I got complaints about other

[R] Error in x@coords[i, , drop = FALSE] : subscript out of bounds

2014-06-08 Thread lijiaming
Hi All, I try to empoly Monte Carlo to find out the distribution of my data. The code is following library(sp) library(rgdal) library(raster) x-readOGR(., finance) #get one spatial file N.list-list() for(i in 1:1000){ Sample.x-sample(1:7059,600) #the shp file includes 7059 points£¬and I

Re: [R] rake() error message

2014-06-08 Thread Michael Willmorth
Here is some code with a subset of 50 cases that produces a similar set of errors to what I got with the full data set (31,690 cases): ## # Load survey package # library(survey) ## # Create raking margins ## pop.m01 - data.frame(m01=1:14, Freq=c(1013620,

[R] Split a string vector with '[ ]'

2014-06-08 Thread Alexsandro Cândido de Oliveira Silva
Hi, I have a string something like that: nw.str - [D][A|D][T|A:D][C|T] And I need to split it in this way: [D] [A|D] [T|A:D] [C|T] Thanks!! Regards. Alexsandro Cândido __ R-help@r-project.org mailing list

Re: [R] Split a string vector with '[ ]'

2014-06-08 Thread jim holtman
try this: nw.str - [D][A|D][T|A:D][C|T] x - strsplit(nw.str, ]) paste0(x[[1]], ']') [1] [D] [A|D] [T|A:D] [C|T] Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Jun 8, 2014 at 4:30 PM,

Re: [R] Split a string vector with '[ ]'

2014-06-08 Thread Duncan Murdoch
On 08/06/2014, 4:30 PM, Alexsandro Cândido de Oliveira Silva wrote: Hi, I have a string something like that: nw.str - [D][A|D][T|A:D][C|T] And I need to split it in this way: [D] [A|D] [T|A:D] [C|T] You could probably use lookahead and lookbehind Perl regular expressions, but this

Re: [R] Split a string vector with '[ ]'

2014-06-08 Thread David Winsemius
On Jun 8, 2014, at 1:46 PM, Duncan Murdoch wrote: On 08/06/2014, 4:30 PM, Alexsandro Cândido de Oliveira Silva wrote: Hi, I have a string something like that: nw.str - [D][A|D][T|A:D][C|T] And I need to split it in this way: [D] [A|D] [T|A:D] [C|T] You could probably use

[R] ltm package: how to calculate ability

2014-06-08 Thread Tony Garcia
Hello everybody. I am using ltm package, an following this sequence: library(ltm)fit3 - ltm(LSAT ~ z1)factor.scores(fit2, resp.patterns = rbind(c(0,1,1,0,0), c(0,1,0,1,0))) And I obtain the following result: Call:rasch(data = LSAT) Scoring Method: Empirical Bayes Factor-Scores for specified

Re: [R] Error in x@coords[i, , drop = FALSE] : subscript out of bounds

2014-06-08 Thread Michael Sumner
Compare 7059 with nrow(x). Looks like they do not match, it is best not to hardcode such things. Cheers, Mike On 9 Jun 2014 05:40, lijiaming lijiamingfore...@gmail.com wrote: Hi All, I try to empoly Monte Carlo to find out the distribution of my data. The code is following library(sp)

[R] NA/NaN values in bnlearn package R

2014-06-08 Thread Alexsandro Cândido de Oliveira Silva
Hello, I am using the bnlearn package in R to handle large amounts of data in Bayesian networks. The variables are discrete and have more than 3 million observations. With bn.fit function I could easily get the conditional probability distribution. However, some variables have unobserved

Re: [R] Split a string vector with '[ ]'

2014-06-08 Thread arun
Hi, If you have library(qdap) installed: library(qdap) as.vector(bracketXtract(nw.str,square,with=T)) #[1] [D] [A|D]   [T|A:D] [C|T]  A.K. On Sunday, June 8, 2014 4:31 PM, Alexsandro Cândido de Oliveira Silva a...@dpi.inpe.br wrote: Hi, I have a string something like that: nw.str -

Re: [R] Standard Deviation in R

2014-06-08 Thread Greg Snow
Which formula for standard deviation are you using? If you know the population mean then you should divide by n (3 in this case), but if you don't know the population mean and use the mean calculated from the sample then it is more usual to use n-1 as the denominator (this makes the variance an

[R] Map insets and par(usr) values

2014-06-08 Thread Carly Muletz
This is in reference to the post here by Ray Brownrigg: http://r.789695.n4.nabble.com/inset-one-map-on-top-of-another-map-td3848752.html using this code with the maps package: map(state, region= ohio, xlim=c(-85, -80), ylim=c(38, 42)) par(usr=c(-216, -66, 24, 144)) # you should be able to

Re: [R] rake() error message

2014-06-08 Thread Anthony Damico
(1) you hit a memory error, because you are including too many variable levels. even if you narrowed your 16 variables down to these four, the `rake` function would need room for matricies containing as much data as a 6-million record table: nrow( expand.grid( data473t[ , c( 'm11' , 'm12c' ,

Re: [R] NA/NaN values in bnlearn package R

2014-06-08 Thread David Winsemius
On Jun 8, 2014, at 6:27 PM, Alexsandro Cândido de Oliveira Silva wrote: Hello, I am using the bnlearn package in R to handle large amounts of data in Bayesian networks. The variables are discrete and have more than 3 million observations. With bn.fit function I could easily get the