gmane.comp.lang.r.general
http://blog.gmane.org/gmane.comp.lang.r.general
hourly11901-01-01T00:00+00:00Gmanehttp://gmane.org/img/gmane-25t.png
http://gmane.org
Covariance between two dichotomous variables
http://comments.gmane.org/gmane.comp.lang.r.general/313070
<pre>Hi,
I am trying to test a mediation hypothesis using coefficients from logistic
regression analyses (x, m, and y are all dichotomous). I am running a test
of significance using MacKinnon and Dwyer's adaptation of Sobel's test
(i.e., correcting for different scales of coefficients in cases of a
dichotomous outcome).
In order to make this correction I need to compute the covariance between x
and m. I have searched various R packages and the R-help page archive and
cannot find a way to do this in R.
Does anyone know how to compute the covariance between two dichotomous
variables in R? It seems like there should be a very simple answer to this
question, but I cannot find it.
Thanks in advance!
Heather
</pre>Heather Kettrey2014-09-03T04:29:33Simulating from a Weibull distribution
http://comments.gmane.org/gmane.comp.lang.r.general/313065
<pre>Hi,
I wish to simulate some data from a Weibull distribution. The rweibull function in R uses the parameterisation
'with shape parameter a and scale parameter b has density given by f(x) = (a/b) (x/b)^(a-1) exp(- (x/b)^a)'.
However, it would be much more useful for me to simulate data using a different parameterisation of the
Weibull, with shape a1 and scale b1, namely f(x) = a1*b1*x^(a1-1)exp(-b1*x^a1).
However I'm not sure how to do this, as I have only ever used the random generators that come pre-programmed in R.
Is there a package or example someone can point me to that demonstrates how to simulate data from any given distribution?
Cheers,
Lucy
[[alternative HTML version deleted]]
</pre>Lucy Leigh2014-09-03T01:52:09Overwriting a procedure
http://comments.gmane.org/gmane.comp.lang.r.general/313056
<pre>Is there a way to over-write a procedure (subroutine)?
I include a default procedure fixx in a list of procedures which are
compiled into a package. By default, the procedure deliver the data matrix x.
fixx <- function(x){
result <- list(x=x)
return(result)
}
In some applications, I have transformations (such as squared terms)
in some column(s) in x. So I include the following procedure in the
mail (calling) program, hoping to over-write the default procedure
under the same name in the package (which is the way other languages
works, e.g., Gauss):
fixx <- function(x){
x[,6]<-x[,5]^2/10
result <- list(x=x)
return(result)
}
This does not seem to work. The procedure in the main (calling)
program seems to get ignored. Any idea? Thanks.
</pre>Steven Yen2014-09-02T18:45:49frequencies of a discrete numeric variable, including zeros
http://comments.gmane.org/gmane.comp.lang.r.general/313045
<pre>The data vector, art, given below using dput(), gives a set of discrete
numeric values for 915 observations,
in the range of 0:19. I want to make some plots of the frequency
distribution, but the standard
tools (hist, barplot, table) don't give me what I want to make a custom
plot due to 0 frequencies
for some of the 0:19 counts.
table() excludes the values of art that occur with zero frequency, and
these are excluded in
barplot()
> table(art)
art
0 1 2 3 4 5 6 7 8 9 10 11 12 16 19
275 246 178 84 67 27 17 12 1 2 1 1 2 1 1
> barplot(table(art))
A direct calculation, using colSums of outer() gives me the values I
want, but this seems unnecessarily
complicated for this simple task.
> (art.freq <- colSums(outer(art, 0:19, `==`)))
[1] 275 246 178 84 67 27 17 12 1 2 1 1 2 0 0 0
1 0 0 1
> barplot(art.freq, names.arg=0:19)
Moreover, I was surprised by the result of hist() on this data, because
the 0 & 1 counts from
the abov</pre>Michael Friendly2014-09-02T17:29:07shiny datatables column filtering plugin
http://comments.gmane.org/gmane.comp.lang.r.general/313044
<pre>Greetings,
I am currently exploring some capabilities of the 'Shiny' package. I am
currently working with the most recent version of 'shiny' from the rstudio
github repository (version - 0.10.1.9006) in order to use the most up to
date datatables plugin. Using the ggplot2 diamonds dataset, I can easily
set columns as unsearchable (commented out below) and I could also subset
out all the 'Ideal' diamonds for example, however I cannot filter out
multiple conditions such as 'Ideal' and 'Fair' diamonds together. From my
searching, this multiple filtering can be done with checkboxes from the
column using the jquery column filtering plugin (
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/checkbox.html).
Despite this, I cannot get this plugin to work with my shiny app. Any
insight would be appreciated.
library(shiny)
library(ggplot2)
runApp(
list(ui = basicPage(
h1('Diamonds DataTable with TableTools'),
# added column filter plugin
singleton(tags$head(tags$script(src='https://c</pre>Charles Determan Jr2014-09-02T16:59:24Making a table
http://comments.gmane.org/gmane.comp.lang.r.general/313040
<pre>Dear All,
I want to make a table in the attached document.
The attached documents are dataset in csv format and the type of the table
I want to produce.
I made the following approach but it is not giving me what I want.
## read data
library(reshape2)
motorcycle=read.csv("/home/fredo/Desktop/Table2.csv")
#head(motorcycle)
#summary(motorcycle)
motorcycle2<-acast(motorcycle,
General.attribute~Basic.attribute,value.var=" Type.of.motorcycle")
It gives me this output:
braking stability bumpy bends clutch
operation feel at control fuel economy gearbox operation
Kawasaki G(0.5), E(0.5) A(0.5), G(0.5) A(0.8)
P(1.0) A(1.0) A(0.5), G(0.5)
overall performance <NA> <NA> <NA> <NA>
<NA> <NA> <NA>
headlights horn Manoeuvrability mirrors
quality of finish quietness responsiveness seat comfort
G(1.0) A(1.0) A(1.0) A(0.5), G(0</pre>Frederic Ntirenganya2014-09-02T08:34:51extract GO results in xml format
http://comments.gmane.org/gmane.comp.lang.r.general/313035
<pre>from a list of GO term enrichment results in xml format, what is the best way to extract term and p-value columns? Which function is the best to use? I used xmlToDataFrame but got
Error in `[<-.data.frame`(`*tmp*`, i, names(nodes[[i]]), value = c("5", :
duplicate subscripts for columns
Look forward to your reply,
Carol
[[alternative HTML version deleted]]
</pre>carol white2014-09-02T15:13:05Is there an ID3 implementation in R?
http://comments.gmane.org/gmane.comp.lang.r.general/313034
<pre>Dear R help mailing list,
I am looking for an ID3 implementation in R. I know that there are many
other decision tree algorithms already implemented (via rpart, tree, caret,
C50, etc., etc.), but for research purposes I would like to reproduce the
result of running ID3.
I was not able to find such an implementation when searching in any of the
following:
http://rseek.org/
http://finzi.psych.upenn.edu/search.html
http://cran.r-project.org/web/views/MachineLearning.html
Any suggestions?
Thanks,
Tal
----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili< at >gmail.com |
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------
[[alternative HTML version deleted]]
</pre>Tal Galili2014-09-02T15:01:54Bayesian multivariate linear regression
http://comments.gmane.org/gmane.comp.lang.r.general/313031
<pre>Dear all,
I'm looking for a package that allows me to run a Bayesian multivariate
linear regression and extract predicted values. In essence I'm looking for
the equivalent of lm and lm.predict in a Bayesian framework.
I have found several libraries that allow to run Bayesian multivariate
linear regression (e.g., bayesm), but those do not seem to have a
prediction function. And the ones with prediction (e.g., MCMCPack) do not
support multiple dependent variables.
If you have any pointers, please let me know.
Best wishes,
Michael
Michael Haenlein
ESCP Europe
Paris, France
[[alternative HTML version deleted]]
</pre>Michael Haenlein2014-09-02T13:54:31Detect expired RSQLiteConnection?
http://comments.gmane.org/gmane.comp.lang.r.general/313029
<pre>Is there a test for an expired RSQLiteConnection? For example, if I run
library(RSQLite)
f <- tempfile()
con <- dbConnect(SQLite(), f)
dbDisconnect(con)
con
then I get
<Expired SQLiteConnection: DBI CON (11737, 2)>
and most operations using it give errors. (In my case I have a
persistent connection object, but if I save the workspace and then
reload it, I get the expired connection.) I'd like to detect this case.
Do I need to use try(), or parse the result of printing it?
Duncan Murdoch
</pre>Duncan Murdoch2014-09-02T12:32:58Match beginning and end of string (grepl)
http://comments.gmane.org/gmane.comp.lang.r.general/313028
<pre>Hi,
I'd like to match the beginning and the end of a string. E.g. I want to
extract all strings from a vector that beginn with "12" and end with
"Apples":
a <- "2 green Apples"
b <- "12 green Apples"
c <- "12 Apples and 2 green Bananas"
d <- "12 yellow Bananas"
fruitlist <- c(a,b,c,d)
# This is how to extract all that beginn with 12
grepl("^12",fruitlist)
But how can I get only those that also end with "Apples". So basically
just item b "12 green Apples" should remain.
Is there any clear description and examples of regular expressions
and how to use them? I find the manual ?grepl very difficult to read.
Thanks,
Johannes
[[alternative HTML version deleted]]
</pre>Johannes Radinger2014-09-02T12:12:19RGEOS ERROR
http://comments.gmane.org/gmane.comp.lang.r.general/313021
<pre>working configuration:
R-3.1.1
WIN-64
goal: want to perfrom ploygon clipping, giving bounding box values of my
study area and extract the area from world map.
I followed:
Error :
In RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly,
"rgeos_intersection") :
spgeom1 and spgeom2 have different proj4 strings
Any help or assistance would be highly obliged
[[alternative HTML version deleted]]
</pre>Girija Kalyani2014-09-02T05:37:08Is it possible to have different animations saved together with the saveSWF command?
http://comments.gmane.org/gmane.comp.lang.r.general/313020
<pre>The way I have programed my code the same animation runs and then starts
over again with Adobe Flash. Each time the animation ends and starts is it
possible to have a different animation start each time? Thanks in advance
for any guidance.
[[alternative HTML version deleted]]
</pre>Cheryl Johnson2014-09-02T05:11:24depth of labels of axis
http://comments.gmane.org/gmane.comp.lang.r.general/313014
<pre>Hi there,
With the following code,
plot(1:5, xaxt = "n")
axis(1, at = 1:5, labels = c(expression(E[g]), "E", expression(E[j]),
"E", expression(E[t])))
you may notice that the "E" within labels of axis(1) are not at the same
depth. So the vision of axis(1) labels is something like wave.
Is there a possible way to typeset the labels so that they are have the
same depth?
Any suggestions will be really appreciated. Thanks in advance.
Best regards,
Jinsong
</pre>Jinsong Zhao2014-09-01T23:40:49URLdecode problems
http://comments.gmane.org/gmane.comp.lang.r.general/313007
<pre>Hey all,
So, I'm attempting to decode some (and I don't know why anyone did this)
URl-encoded user agents. Running URLdecode over them generates the error:
"Error in rawToChar(out) : embedded nul in string"
Okay, so there's an embedded nul - fair enough. Presumably decoding the URL
is exposing it in a format R doesn't like. Except when I try to dig down
and work out what an encoded nul looks like, in order to simply remove them
with something like gsub(), I end up with several different strings, all of
which apparently resolve to an embedded nul:
Error in rawToChar(out) : embedded nul in string: '0; < at >\0L'
In addition: Warning message:
In URLdecode("0;%20< at >%gIL") :
out-of-range values treated as 0 in coercion to raw
Error in rawToChar(out) : embedded nul in string: ' \0e'
In addition: Warning message:
In URLdecode("%20%use") :
out-of-range values treated as 0 in coercion to raw
I'm a relative newb to encodings, so maybe the fault is simply in my
understanding of how this should work, but - why are bot</pre>Oliver Keyes2014-09-01T16:02:33Plot Lines instead of colour bands in R
http://comments.gmane.org/gmane.comp.lang.r.general/313006
<pre>Hi,
I have a plotting issue which I am trying to resolve in R. Please load my attached sample data (I used dput(lapply(sim.summary,head,1)) but the data are too large) to R, install "Rglimclim" package and run this code which shows an example plot I would like to change. My main function, "myplot" is found in the attached R object:
#------------------------------------------------------------------------------------------------------------------------------
require(Rglimclim) #http://www.ucl.ac.uk/~ucakarc/work/rain_glm.html
myplot(sim.summary,plot.titles="",which.stats="Mean",quantiles=c(0,0.025,0.5,0.975,1),
imputation=obs.summary,which.sites=NULL,which.timescales="daily",colours.sim=c("magenta","darkorchid1","deeppink3","yellow"),
cex.lab=1.4,cex.axis=1.5,ylabs="Precipitation (mm)")
mtext(text=expression(paste(italic(Mean[C]))),font=3, side=3, line=1, cex=1.3, col="black")
#-------------------------------------------------------------------------------------------------------------------------------
</pre>Zilefac Elvis2014-09-01T19:29:54Adjusted R2 for Multivariate Regression Trees (MRT) (ignore the previous message)
http://comments.gmane.org/gmane.comp.lang.r.general/313005
<pre>Dear fellows,
I am using MVPARTwrap package to built a MRT of 25 pollen samples collected
from 5 different ecosystems, on my analysis I will include adjusted R2.
Based on MVPARTwrap package I want to get adjusted R2 for my MRT for this,
I am using the code below.
#step 1 - Building MRT.
Pre_euro.mvpart <- mvpart(data.matrix(mydata.2) ~ .,5Ecosystems,
margin=0.02, cp=0, xv="pick", xval=nrow(mydata.1), xvmult=100, which=4)
MRT.mite.tree<-MRT(Pre_euro.mvpart, 10, LABELS=LABELS)
#step 2- Adjusted R2
R2aGDF(MRT.mite.tree, T=40, tau_const=0.6, 5Ecosystems)
However, if run adjusted R2 code (step 2) 100 times, I will get 100
different results. Which one is correct?
Does anyone can help me? Any help is very welcome.
Cheers.
Jackson Rodrigues
[[alternative HTML version deleted]]
</pre>Jackson Rodrigues2014-09-01T20:08:27Adjusted R2 for Multivariate Regression Trees (MRT)
http://comments.gmane.org/gmane.comp.lang.r.general/313004
<pre>Dear fellows,
I am using MVPARTwrap package to built a MRT of 25 pollen samples collected
from 5 different ecosystems, on my analysis I will include adjusted R2.
Based on MVPARTwrap package I want to get adjusted R2 for my MRT for this,
I am using the code below.
#step 1 - Building MRT.
Pre_euro.mvpart <- mvpart(data.matrix(mydata.2) ~ .,5Ecosystems,
margin=0.02, cp=0, xv="pick", xval=nrow(mydata.1), xvmult=100, which=4)
#step 2- Adjusted R2
R2aGDF(MRT.mite.tree, T=40, tau_const=0.6, 5Ecosystems)
However, if run adjusted R2 code (step 2) 100 times, I will get 100
different results. Which one is correct?
Does anyone can help me? Any help is very welcome.
Cheers.
Jackson Rodrigues
[[alternative HTML version deleted]]
</pre>Jackson Rodrigues2014-09-01T19:52:01simulation data with mixed variables
http://comments.gmane.org/gmane.comp.lang.r.general/312996
<pre>dear all members
i am trying to simulate data with mixed ordered categorical and
dichotomous variables with 200 observation and 10 var. 5 ordered
categorical and 5 dichotomous and i want to put a high correlation between
variables so i must find correlation between dichotomous and the
correlation between ordered categorical and correlation between mixed
ordered categorical and dichotomous data. i know all types of corr. except
correlation between mixed. i hope anyone help me to solve this problem.
Many thanks in advance
Thanoon
[[alternative HTML version deleted]]
</pre>thanoon younis2014-09-01T15:29:33SpectrumBackground
http://comments.gmane.org/gmane.comp.lang.r.general/312995
<pre>Hello there ...
Using package Peaks to run the function SNIP on a csv
file with 19 spectrum.
While trying to run:
### doing SNIP for every spectra
require(Peaks)
for (i in 1:NROW(Q))
{
Q.t[i,]<-Q[i,]-SpectrumBackground(as.numeric(as.vector(Q[i,])))
print(i)
}
Got the following error:
Error in .Call("R_SpectrumBackground",
as.vector(y), as.integer(iterations),
:
"R_SpectrumBackground"
not available for .Call() for package "Peaks"
Any suggestions on how to correct this ?
Thanks for the help,
Edmir
Fiber&Polymer Science, NCSU
[[alternative HTML version deleted]]
</pre>Edmir Silva2014-09-01T14:25:17Correlation Matrix with a Covariate
http://comments.gmane.org/gmane.comp.lang.r.general/312994
<pre>R Help -
I'm trying to run a correlation matrix with a covariate of "age" and will
at some point will also want to covary other variables concurrently.
I'm using the "psych" package and have tried other methods such as writing
a loop to extract semi-partial correlations, but it does not seem to be
working. How can I accomplish this?
library(psych)
Error in solve.default(x.matrix, xy.matrix) :
Lapack routine dgesv: system is exactly singular: U[54,54] = 0
structure(list(cope8_StriatumMask_7_betas_mean = c(11.47, -0.6002,
-11.59, -52.51, 36.63, -36.99, -26.89, 21.68, 3.776, 19.35, -56.44,
-11.41, -1.825, 5.327, -2.886, 11.91, 43.99, 42.17, 21.19, -1.14,
-9.156, -3.53, -12.79, 33.88, -35.92, 7.613, -61.59, -6.754,
2.672, -25.09, 19.87, -21.09, -37.97, -11.07, -7.276, 21.94,
-18.94, -16.83, 19.96, 7.533, -44.57, -23.17, 22.54),
cope7_StriatumMask_7_betas_mean = c(-11.47,
0.6002, 11.59, 52.51, -36.63, 36.99, 26.89, -21.68, -3.776, -19.35,
56.44, 11.41, 1.825, -5.327, 2.886, -11.91, -43.99, -42.17, -21.19,
1</pre>Patzelt, Edward2014-09-01T12:47:18Search EngineSearch the mailing list at Gmanequery
http://search.gmane.org/?group=$group=gmane.comp.lang.r.general