gmane.comp.lang.r.general
http://blog.gmane.org/gmane.comp.lang.r.general
hourly119010101T00:00+00:00Gmanehttp://gmane.org/img/gmane25t.png
http://gmane.org
devtools: install_git hangs on Windows
http://comments.gmane.org/gmane.comp.lang.r.general/318178
<pre>Hi,
I am trying to setup R on a Windows 7 64b machine, but despite I have
followed the instructions for Windows (installing Rtools, building the package
etc), whenever I try to use install_git and install_url, RStudio (and R) hangs.
I have identified the issues being with:
system("git clone .......")
It creates a local repository, but then the download hangs.
(the same issues apply if I use shell or system2)
git works fine in both the cmd and gitbash shells, but whenever git
clone is called from within R, the command hangs while downloading.
Does any of you have the same issue? Has any of you been able to solve it?
Thanks in advance for the help,
Best wishes,
Luca
</pre>Luca Cerone20150303T21:30:04sampling dataframe based upon number of record occurrences
http://comments.gmane.org/gmane.comp.lang.r.general/318177
<pre>Hello everyone,
I'm having trouble performing a task that is probably very simple, but
can't seem to figure out how to get my code to work. What I want to do is
use the sample function to pick records within in a dataframe, but only if
a column attribute value is repeated more than 3 times. So if you look at
the data below I have created a unique attribute value that corresponds to
every site by year combination (i.e. IDxYear). So you can see that for the
site called "AAirport" it was sampled 6 times in 2006, "ABank Corral
East" was sampled twice in 2008. So what I want to do is randomly select 3
records for "AAirport" in 2006 for the existing 6 records, but for "ABark
Corral East" in 2008 I just want to leave these records as they currently
are.
I've used the following code to try and accomplish this, but like I said I
can't get it to work so I'm clearly doing something wrong. If you could
check out the code and provide any suggestions that would be great. It
should be noted that there are 5589 uniqu</pre>Curtis Burkhalter20150303T21:22:33bigglm connected to a database
http://comments.gmane.org/gmane.comp.lang.r.general/318176
<pre>I can get bigglm working with the following code.
ModelFit < bigglm(SMM ~
I(1.88 * exp(.192 * LoanAge))+
ns(Incentive, df = 5)+
Purpose +
Occupancy +
TPO +
Servicer,
data = sqlQuery(Train.Data, ModelData),
family = binomial(link = "logit"),
chuncksize = 10000,
maxit = 100)
However, I would like to order the factors so I wrote the following code to make data. However, it is not working. I have read through the manual as well as some examples provided and I am not having much success with the revised code below. I think I need to make data and provide ordering of the factors in the make data but so far this scheme has not worked. I think I am missing somethin any insights are appreciated.
Best Re</pre>Glenn Schultz20150303T20:02:29Rcpp module / class access  answer
http://comments.gmane.org/gmane.comp.lang.r.general/318175
<pre>Hi all,
I am trying to answer my own question (although it probably does not end
up in the thread because I am not a subscribed and thus have to send a
new mail).
The way I finally got the code working was:
In NAMESPACE, comment out the following lines
# importFrom(Rcpp, loadModule)
# importFrom(Rcpp, evalCpp)
In zzz.R:
# loadModule("mod_yada",TRUE);
.pkgNamespace < environment()
.onLoad < function(libname, pkgname) {
assign("mod_yada",
Module("mod_yada",PACKAGE="testPackage",mustStart=TRUE),
envir=.pkgNamespace);
}
The object generation then works as expected in the S4 class code.
Not sure whether this is the best way to achieve this, though.
Pascal
</pre>Pascal A. Niklaus20150303T15:35:47Mining nonenglish text
http://comments.gmane.org/gmane.comp.lang.r.general/318174
<pre>I am new to R programming and trying to mine this pdf file
http://164.100.180.82/Rollpdf/AC276/S24A276P001.pdf. This pdf file is in
nonEnglish language and I'm not able to figure out how to proceed. And,
I'm not even sure how to extract information from a PDF file, so please
help!
[[alternative HTML version deleted]]
</pre>saikiran putta20150303T17:08:50help with plotting error bars on xyplot!
http://comments.gmane.org/gmane.comp.lang.r.general/318173
<pre>Dear R helpers,
I am trying to create a xyplot similar to this one:
https://stat.ethz.ch/pipermail/rhelp/2008June/164968.html
I can plot the data correctly when I only have one Y. However, I need to add another Y (Y2) to the plot and each Y must have their own error bars and also different symbols. You will see that in this plot symbol changes based on X and not Y. The symbols should change by Y category, for example in the example below, the symbols with the errors bars sould be one symbol while the symbols without errors bars should have a different symbol and also should have error bars. Any help will be much appreciated.
Hr = c(0,1,2,3,4,5,0,1,2,3,4,5)
DRUG = rep(c("D", "P"), each=6)
Y = c(1,2,2,2,2,1,3, 4, 4,4, 4, 3)
Y2 = c(2,3,3,3,3,2,4, 5, 5,5, 5, 4)
data = data.frame(Hr, DRUG, Y, Y2)
data$lower1 = data$Y  .5
data$upper1 = data$Y + .5
data$lower2 = data$Y2  .5
data$upper2 = data$Y2 + .5
prepanel.ci < function(x, y, ly, uy, subscripts, ...) {
x < as.numeric(x)
ly < as.numeric(ly</pre>Paulo Pagliari20150303T18:07:44Sorting list elements according to their mean value
http://comments.gmane.org/gmane.comp.lang.r.general/318171
<pre>Hello Rhelpers,
I have a list of 999 dataframes and I would like to sort the list by the
mean value of one of the columns in the data frames.
Here is a small, selfcontained example:
#begin example
iterations<999
d<list() #resampled data
f<list() #fitted values
r<list() #residuals
l<list()
for (i in 1:iterations){
iboot<sample(1:nrow(cars),replace=TRUE)
bootdata<cars[iboot,]
d[[i]]<bootdata
f[[i]]<fitted(lm(bootdata$dist~bootdata$speed))
r[[i]]<resid(lm(bootdata$dist~bootdata$speed))
t<data.frame(d[i],f[i],r[i]);names(t)<c("speed","dist","fitted","resid")
l[[i]]<t
} #end loop
#end example
Now, I would like to sort the 999 elements in this list by the mean value
of the column named "fitted".
In other words, the list element with the smallest mean value of "fitted"
would be the new first list element, the list element with the second
smallest mean value of "fitted" would be second new list element, etc....up
to the list element with the largest mean value of "fitted".
Th</pre>mtb954< at >gmail.com20150303T19:01:142D Timeseries trace plot
http://comments.gmane.org/gmane.comp.lang.r.general/318167
<pre>Hi,
I've got a 2D timeseries of handwriting samples,
x y time
1 1073 1058 769.05
2 1072 1085 769.07
3 1066 1117 769.08
4 1052 1152 769.10
5 1030 1196 769.12
6 1009 1242 769.13
7 994 1286 769.14
upto 500
I was just wondering how to plot this as an animation, so that the points
join up as they are rendered in time. Basically showing how the person who
generated the data writes.
The time index is not regular and if possible I'd like to avoid padding the
data with duplicate entries if this is avoidable. For example adding a
duplicate of the first row, for a 'padded' time 769.06.
Thanks alot for your help :)

View this message in context: http://r.789695.n4.nabble.com/2DTimeseriestraceplottp4704127.html
Sent from the R help mailing list archive at Nabble.com.
</pre>AjayT20150303T14:59:25Rcpp module / class access
http://comments.gmane.org/gmane.comp.lang.r.general/318163
<pre>Dear all,
I am struggling accessing a class created in an Rcpp module.
The structure of the package is essentially the one created using:
Rcpp.package.skeleton(name="testPackage",module=TRUE)
Now, after loadiong the package with library(testPackage), I can create
instances of the "World" class as follows:
library(testPackage)
mod_yada<Rcpp::Module("yada",PACKAGE="testPackage",mustStart=TRUE)
w < new(mod_yada$World);
So far so good.
However, I fail defining a S4 wrapper class within the same package. As
part of that, I would like to define a generator function that returns
an instance of mod_yada$World, as in the code above:
However, "yada$World" is not accessible.
I then tried inserting the following line in the respective R file
(although I thought this was already taken care by the
"loadModule("yada", TRUE)" that was places in zzz.R by the skeleton
generator:
mod_yada<Rcpp::Module("yada",PACKAGE="testPackage",mustStart=TRUE)
But again, this fails with:
Failed to initialize module p</pre>Pascal A. Niklaus20150303T10:45:38Reglamento IMSS Construcción y SATIC’s. 11 marzo2015
http://comments.gmane.org/gmane.comp.lang.r.general/318162
<pre></pre>Pilar Serrano20150303T06:01:15Frontier efficient using black litterman model In R
http://comments.gmane.org/gmane.comp.lang.r.general/318161
<pre>Hi
I'm working on getting frontier efficient plot using Black Litterman model.
I have used Blcop package and its function
optimalPortfolio.optim()
using this i have got optimal risk and return with weights
If i want to get 10 portfolio risk and return with corresponding weights,,,
how to do it>?
can anyone help me....
my code goes like this
posterior < posteriorEst(views, tau = 0.025, meanret, covar)
cons < c("minW[1:numtk] = rep(0, times = numtk)", "maxW[1:numtk] =
rep(0.50, times = numtk)","minsumW[1:numtk] = 0","maxsumW[1:numtk] = 1")
#"listF = list(lowerExtension, upperExtension)")
res1<optimalPortfolios.fPort(posterior,
spec=portfolioSpec(),constraints=cons,optimizer =
"minriskPortfolio",numSimulations = 10)
Thanks
MUKESH
[[alternative HTML version deleted]]
</pre>mukesh surywanshi20150303T06:34:17check a list that a sublist exists
http://comments.gmane.org/gmane.comp.lang.r.general/318155
<pre>Hi all,I have a list that has the following fields.
$`80`
[1] "Error in if (fitcass1[[2]] == \"Error\") { : \n Fehlender Wert, wo TRUE/FALSE nötig ist\n"
attr(,"class")
[1] "tryerror"
attr(,"condition")
<simpleError in if (fitcass1[[2]] == "Error") { print(sprintf("error at fitting gamma distribution with %s periods. Mean %f %f Sd %f %f", flag, mean1, mean2, sd1, sd2))} else { return(fitcass1)}: Fehlender Wert, wo TRUE/FALSE nötig ist>
$`81`
[1] 0
$`9`
[1] 0
$`79`
$parameters
pi mu sigma
1 0.9996796725 1.654832 127.6542
2 0.0003203275 17183.001125 302.8063
$se
pi.se mu.se sigma.se
1 2.113882e05 0.1439152 14.22274
2 2.113882e05 38.3582148 NaN
$distribution
[1] "gamma"
and so one. The content of each first level sublist are never the same. I want for each firstlevel sublist my list has to check fast that the current element , lets say the 79th has the $parameters.then I w</pre>Alaios via Rhelp20150303T10:03:11vectorize data string analysis
http://comments.gmane.org/gmane.comp.lang.r.general/318151
<pre>Hello All,
I have to admit that I am not that good when it comes to vectorizing a function. I need some insight. Is the below a case where vectorization can be accomplished to improve speed?
Below the function a sample data  as you can see it is not delimited. However, the record length is 220 characters. So I wrote the following code to delimit the data set "/r". The function works and I have a dataset that can then be inserted into a MySql data table. However, the actual data set is 518,000 records so the number of characters is 518000 * 220. It takes R hours to parse this using the function I have written. Can this be vectorized or is this a loop deal?
Best Regards,
Glenn
#' FNMA Factor
#'
#' This function parses the FNMA factor file for load into
#' into a database table the FNMA factor file is nondelimited
#' < at >param filepath A character vector specifying a data director
#' < at >param lenght of the line A numeric value equal to the length of a line
#' < at >export
F</pre>Glenn Schultz20150303T03:01:02Looping and break
http://comments.gmane.org/gmane.comp.lang.r.general/318144
<pre>Hello,
I apologies for bringing up next and break in loops given that there is so
much on the net about it, but I've tried numerous examples found using
Google and just can't seem to get this to work.
This is a simple version of what I am doing with matrices but it shows the
issue. I need to have the loop indexed as n to perform a calculation on the
variable total. But if "total" is greater than 8, it goes to the next loop
indexed "a". For example, it does condition a = 1 for n = 1 to 50 but
within n if total is greater than 8 it goes to the next condition of a which
would be a = 2, and so on.
for (a in 1:3){
if (a == 1) { b < c(1:5) }
if (a == 2) { b < c(1:5) }
if (a == 3) { b < c(1:5) }
for (n in 1:50){
if (n > 15) next
total < 2*b
if (total > 8) next
}
}
Any help would be greatly appreciated.
Thanks,
Scott

View this message in context: http://r.789695.n4.nabble.com/Loopingandbreaktp4704093.html
Sent from the R help mailing list archive at </pre>Scott Colwell20150303T00:11:21R Help
http://comments.gmane.org/gmane.comp.lang.r.general/318140
<pre>Dear Sir,
I start using (R) 3 months ago, and I am still learning, I have a project and I am using R in this project, my friend helped me to build a code for this project and it's working perfect, but I need to make a small change in, it looks very simple but for me it's very complicated. I insert the code and I hope if you can help me this problem. I highlighted what exactly I need to change. This project is calculating the market and industry weighted returns for each based on the date levels.
sync = read.csv("country14.csv",header=T)
id.country = 14
sync = sync[sync$country!="country" & sync$country==id.country,c(2,5)]
sync$price=as.numeric(as.character(sync$price))
sync$mv=as.numeric(as.character(sync$mv))
attach(sync)
#### Calculate returns and add to the dataset
n.comp = nlevels(as.factor(as.character(sync$company_name)))
comp.names = levels(as.factor(as.character(sync$company_name)))
data = vector("list",n.comp)
for(i in 1:n.comp){
temp = sync[sync$company_name==comp.names[i],]
data[[i]] = c</pre>Rami Alzebdieh20150302T09:38:07How to decide " weight" in WLS model in R ?
http://comments.gmane.org/gmane.comp.lang.r.general/318139
<pre>Hi,
I would like to know how to decide the "weight" in a WLS model in R?
For example, In the" pipeline " data from faraway, I try to fit a
regression model Lab ~ Field (nonconstant variance). I wish to use weights
to account for the nonconstant variance. So how to decide the weight in
the WLS model?
For the "pipeline" data, they split the range of Field into 12 groups of
size 9. within each group, and they compute the variance of Lab as "varlab"
and the mean of Field as "meanfield". In addition, they suppose that the
variance in the response is linked to the predictor in the following way:
var(Lab)=a*(Field^b).
So we could get a estimate of a and b by regress log(varlab) on
log(meanfield). But how to determine weights in a WLS fit of Lab on Field
in R?
I guess that it may require the function of 'VarConstPower' in R in the
example above. So could you please explain how to use 'VarConstPower' in R?
I will appreciate it if you could please answer the two questions above.
Thanks!
Angela

[[alternati</pre>Yan Wu20150302T20:13:53rms package: error with Glm
http://comments.gmane.org/gmane.comp.lang.r.general/318138
<pre>Dear Rhelp,
I'm getting an error with Glm (from the rms package) when the
equivalent model using glm does not give an error. This is using rms
4.30 in R 3.1.1.
An example is shown below. I have set the seed value, but the error is
not specific to this seed value.
Thanks for any help anyone can give.
Mark Seeto
#############################################################################
library(rms)
set.seed(1)
n < 100 # sample size
beta0 < 3.7
beta1 < 1.5
beta2 < 0.9
beta3 < 0.5
rate.x1 < 2
mean.x2 < 1
sd.x2 < 2
nu < 1.3
d < data.frame(x1 = rexp(n, rate = rate.x1),
x2 = rnorm(n, mean.x2, sd.x2))
d$y < rgamma(n, shape = nu,
rate = nu/exp(beta0 + beta1*d$x1 + beta2*d$x2 + beta3*d$x2^2))
glm(y ~ x1 + x2 + I(x2^2), family = Gamma(link=log), data=d) # No error
Glm(y ~ x1 + pol(x2, 2), family = Gamma(link=log), data=d) # Error shown below
## Error in glm.fit(x = X[, "Intercept", drop = FALSE], y = Y, weights
= weights, :
## NA/NaN/Inf in 'x'
## In ad</pre>Mark Seeto20150302T20:49:51table
http://comments.gmane.org/gmane.comp.lang.r.general/318137
<pre>Hello List,
I am trying to obtain a table containing absolute and relative
frequencies but it must be done by strata. Each strata have to contain
totals and subtotals being the sum of the subtotals equal to the total
in upper strata in same column. As this could be some vague I am
including an example of such table:
data<data.frame(Provincial=rep(c("Prov1","Prov2","Prov1","Prov3"),10),
Municipios=rep(c("Mun1","Mun2","Mun3","Mun4"),10),unit=rep(c("unit1","unit2","unit3","unit4"),10))
Variable N%
Province (i)
Municipalities (j)
Health units (k)
&#8721;i, &#8721;j, &#8721;k
And so on i = 1 to 16
&#8721;i, &#8721;j, &#8721;k
If you could help me to obtain a function to get such table I would
appreciate very much.
Best and thank you .
maicel monzon MD. MSc.


Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional </pre>maicel< at >infomed.sld.cu20150302T20:31:50Installed R to Windows, but having trouble with read.csv
http://comments.gmane.org/gmane.comp.lang.r.general/318135
<pre>I copied the file into the bin folder of R ...
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'PerfResultsCSv.csv': No such file or directory
I also installed and load RWeka package, but canot open.
It seems like I am having some issue of directories...
I am new to R, any help appreciated.
Thanks,
Alice
[[alternative HTML version deleted]]
</pre>Mello Cavallo, Alice20150302T16:53:22R crashes when I run rgeos::gDistance
http://comments.gmane.org/gmane.comp.lang.r.general/318134
<pre>Hi,
This is my first post to Rhelp. I'm having trouble getting rgeos to work.
Info on the server and packages I'm using:
$ *uname a*
Linux someserver.somewhere.com 2.6.32431.11.2.el6.x86_64 #1 SMP Tue Mar
25 19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ *R version*
R version 3.0.2 (20130925)  "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64redhatlinuxgnu (64bit)
$ *lsb_release a*
LSB Version:
:base4.0amd64:base4.0noarch:core4.0amd64:core4.0noarch:graphics4.0amd64:graphics4.0noarch:printing4.0amd64:printing4.0noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
$ *rpm qa  grep geos*
geosdevel3.4.21.rhel6.x86_64
geos3.4.21.rhel6.x86_64
$ *rpm qa  grep gdal*
gdal1.9.26.rhel6.x86_64
gdallibs1.9.26.rhel6.x86_64
gdaldevel1.9.26.rhel6.x86_64
gdaljava1.9.26.rhel6.x86_64
$ *R q*
rgeos version: 0.38, (SVN revision 460)
GEOS runtime version: 3.4.2CAPI1.8.2 r</pre>Adrian Torchiana20150302T15:49:14numbering consecutive rows based on length criteria
http://comments.gmane.org/gmane.comp.lang.r.general/318129
<pre>Using this dataset:
dat < read.table(textConnection("day noRes.Q wRes.Q
1 237074.41 215409.41
2 2336240.20 164835.16
3 84855.42 357062.72
4 76993.48 386326.78
5 73489.47 307144.09
6 70246.96 75885.75
7 69630.09 74054.33
8 66714.78 70071.80
9 122296.90 66579.08
10 63502.71 65811.37
11 63401.84 64795.12
12 63387.84 64401.14
13 63186.10 64163.95
14 63160.74 63468.25
15 60471.15 60719.15
16 58235.63 57655.14
17 58089.73 58061.34
18 57846.39 57357.89
19 57839.42 56495.69
20 57740.06 56219.97
21 58068.57 55810.91
22 58358.34 56437.81
23 76284.90 73722.92
24 105138.31 100729.00
25 147203.03 178079.38
26 109996.02 111113.95
27 91424.20 87391.56
28 89065.91 87196.69
29 86628.74 84809.07
30 79357.60 77555.62"),header=T)
I'm attempting to generate a column that continuously numbers consecutive
rows where wRes.Q is greater than noRes.Q. To that end, I've come up with
the following:
dat$flg < dat$wRes.Q>dat$noRes.Q
dat$cnt < </pre>Morway, Eric20150302T17:43:55Search EngineSearch the mailing list at Gmanequery
http://search.gmane.org/?group=$group=gmane.comp.lang.r.general