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
please ignore previous e-mail re zeros in alternate rows & alternate elements in matrix
http://comments.gmane.org/gmane.comp.lang.r.general/320827
<pre>Sorry - I have solved my problem already - please don't post the request
for advice on how to generate a matrix with zeros in alternate rows &
alternate elements in the supra-diagonal
Cheers
Michelle
</pre>Michelle Morters2015-05-30T19:07:52puzzling behaviour of identical function
http://comments.gmane.org/gmane.comp.lang.r.general/320825
<pre>I am puzzled by the following seemingly contradictory calls to the function
identical. Below is a minimal example, that reproduces them:
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.9.5 (Mavericks)
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets grid methods
[8] base
loaded via a namespace (and not attached):
[1] compiler_3.2.0 tools_3.2.0 memoise_0.2.1 digest_0.6.8
[1] "if (identical(function(x)1,function(x)1)) cat(\"Identical!\\n\")
else cat(\"Not Identical!\\n\")"
Identical!
Not Identical!
Can anyone explain why I get a false value from the command line but true if I
use sys.source?
</pre>Munawar Cheema2015-05-30T14:35:50metagen - plotStudySizes: order by year and not alphabetical
http://comments.gmane.org/gmane.comp.lang.r.general/320815
<pre>HI everybody.
I'm using the package 'metagen' to plot sample size in meta-analysis.
The plot function of the package reorders the studies by alphabetcial order.
However, I would like to have the studies listed by year.
How can I force the plotting function to order the study by the variable
'year' rather than by the first initial of the variable 'reference'?
Thank you in advance,
Antonello
Here my sample code:
### the data
df <- structure(list(reference = structure(c(3L, 6L, 9L, 2L, 8L, 5L,
7L, 10L, 4L, 1L), .Label = c("Bellani et al. 2012 ",
"Bocco et al. 2004 ", "Costa 1998 ",
"Dalla Volta et al. 2011 ", "Manzanere et al. 2006 ",
"McEnty et al. 2001 ", "Ossian et al. 2006 ",
"Simone et al. 2004 ", "Tanter et al. 2002 ",
"Zimmian et al. 2006 "), class = "factor"), size = c(20,
288, 70, 138, 475, 191, 918, 80, 508, 205), year = c(1998, 2001,
2002, 2004, 2004, 2006, 2006, 2006, 2011, 2012</pre>Antonello Preti2015-05-30T12:01:28lapply function
http://comments.gmane.org/gmane.comp.lang.r.general/320813
<pre>Hi R Gurus,
I am writing a simple function that take a numeric vector column from a
data frame and scales the vector column with certain criteria. I would
then pass this function to a list of dataframes by lappy.
Question is how do I write a function that works on a numeric vector. My
function as is, seems to work on the first element of the vector.
I.E.
scale
function(x,mn,max){
if (x==min(x)) 0
if (x==max(x)) 10
else x=max-min/10
}
where x is the numeric column of the dataframe.
Thank you.
[[alternative HTML version deleted]]
</pre>Sohail Khan2015-05-30T11:40:07Arrays of variable dimensionality
http://comments.gmane.org/gmane.comp.lang.r.general/320809
<pre>Hello folks
Supposing I have a multidimensional array in an R prog, say a 4D array.
I want the coordinate quantities to be read off from a vector. The values
in the vector (vec) are generated by a function.
This is easy if the number of dimensions is fixed for both the array and
the number of elements in the vector (say 4):
X<-array[vec[1],vec[2],vec[3],vec[4]]
But if the number of dimensions of the array is not fixed and can change
during the course of the prog I am stuck as to how to do this, as I don’t
know a way of feeding a vector or list of unspecified beforehand length
into the coordinates for an array
I can’t find anything useful about this on the net
Does anyone have any ideas?
Thanks, Nick
[[alternative HTML version deleted]]
______________________________________________
R-help< at >r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, min</pre>WRAY NICHOLAS2015-05-30T10:29:09Toronto CRAN mirror 403 error?
http://comments.gmane.org/gmane.comp.lang.r.general/320803
<pre>I've been getting a 403 when I try pulling from the Toronto CRAN mirror
today.
http://cran.utstat.utoronto.ca/
Is there a contact list for mirror managers?
</pre>Mark Drummond2015-05-30T02:12:56vectorized code
http://comments.gmane.org/gmane.comp.lang.r.general/320798
<pre>HI
I was working on online example, where virus is spread through a graph. The
example is sufficient for small graph i.e. small number of edges and nodes.
But I tried it on very large graph i.e. 10000 nodes and 20000 edges, but
the below function is not sufficient for large graph because its slow.
My question is how can the below function be converted to Vectorized code
can be optimized for large graphs?
spreadVirus <- function(G,Vinitial,Activation_probability){
# Precompute all outgoing graph adjacencies
G$AdjList = get.adjlist(G,mode="out")
# Initialize various graph attributes
V(G)$color = "blue"
E(G)$color = "black"
V(G)[Vinitial]$color <- "yellow"
# List to store the incremental graphs (for plotting later)
Glist <- list(G)
count <- 1
# Spread the infection
active <- Vinitial
while(length(active)>0){
new_infected <- NULL
E(G)$color = "black"
for(v in active){
# spread through the daily contacts of vertex v
daily_contacts <- G$AdjList[[v]]
E(G)[v %->% daily</pre>zeynab jibril2015-05-29T14:49:28about transforming a data.frame
http://comments.gmane.org/gmane.comp.lang.r.general/320777
<pre>Dear all,
I would appreciate a suggestion on the following : I am working with a
data.frame (below) :
EXP CT row_names col_names
1 test -5 B4:B5:B6 B1:B2:B3
2 test -2 B7:B8:B9 B1:B2:B3
3 test -2 D4:D5:D6 H4:H5:H6
4 test -2 D10:D11:D12 F10:F11:F12
5 test -2 D10:D11:D12 H1:H2:H3
6 test -2 E10:E11:E12 G7:G8:G9
7 test -4 A1:A2:A3 D1:D2:D3
8 test -4 B10:B11:B12 B1:B2:B3
what would be the easiest way to consider UNIQUE elements in the ROW_NAMES
or the UNIQUE elements in the COL_NAMES and :
print how many times these UNIQUE ELEMENTS associate with the numbers -5,
-2, or -4 (these numbers are on the column names CT) ..
thanks,
bogdan
[[alternative HTML version deleted]]
</pre>Bogdan Tanasa2015-05-29T20:19:25Automatically updating a plot from a regularly updated data file
http://comments.gmane.org/gmane.comp.lang.r.general/320776
<pre>Hi all,
I have a question about using R in a way that may not be correct but I
thought I would ask anyway.
I have an instrument that outputs a text file with comma separated data. A
new line is added to the file each time the instrument takes a new reading.
Is there any way to configure R such that a script to generate a plot from
said text file is re-run each time the file is modified (i.e. a new line is
added). So basically update an exported plot each time a new line of data
is collected.
Is this type of thing possible in R? If not can anyone recommend some
Windows (or Linux if need be) tools that could help me accomplish this
preferably still utilizing R's plotting capabilites? I know that there are
other tools that can do this all but nothing makes figures as nicely as R.
I suppose more generally this is a question about way to automate processes
with R to take advantage of R's functionality.
Thanks in advance.
Sam
[[alternative HTML version deleted]]
</pre>Sam Albers2015-05-29T19:51:40Result differences in 32-bit vs. 64-bit point.in.polygon?
http://comments.gmane.org/gmane.comp.lang.r.general/320774
<pre>Is anyone aware of point.in.polygon giving different results for 32-bit vs. 64-bit R? Our OS is 64-bit Windows 7 Enterprise. I'm working with someone else's extensive R program and the final results are close but not exactly matching. We're thinking it might be something with the point.in.polygon function (one of many possibilities, including leaps).
Thanks much,
Shelly Lensing
Biostatistics / University of Arkansas for Medical Sciences
4301 W. Markham St. #781 / Little Rock, AR 72205
V: 501.686.8203 / F: 501-526-6729 / COPH 3236
----------------------------------------------------------------------
Confidentiality Notice: This e-mail message, including a...{{dropped:10}}
</pre>Lensing, Shelly Y2015-05-29T18:36:19Converting unique strings to unique numbers
http://comments.gmane.org/gmane.comp.lang.r.general/320764
<pre>I have a pedigree file as so:
X0001 BYX859 0 0 2 1 BYX859
X0001 BYX894 0 0 1 1 BYX894
X0001 BYX862 BYX894 BYX859 2 2 BYX862
X0001 BYX863 BYX894 BYX859 2 2 BYX863
X0001 BYX864 BYX894 BYX859 2 2 BYX864
X0001 BYX865 BYX894 BYX859 2 2 BYX865
And I was hoping to change all unique string values to numbers.
That is:
BYX859 = 1
BYX894 = 2
BYX862 = 3
BYX863 = 4
BYX864 = 5
BYX865 = 6
But only in columns 2 - 4. Essentially I would like the data to look like this:
X0001 1 0 0 2 1 BYX859
X0001 2 0 0 1 1 BYX894
X0001 3 2 1 2 2 BYX862
X0001 4 2 1 2 2 BYX863
X0001 5 2 1 2 2 BYX864
X0001 6 2 1 2 2 BYX865
Is this possible with factors?
Thanks!
K.
</pre>Kate Ignatius2015-05-29T16:58:22alternatives to KS test applicable to K-samples
http://comments.gmane.org/gmane.comp.lang.r.general/320762
<pre>Good morning, All
I have a stat question not specifically related to the the programming language.
To compare distributional consistency / discrepancy between two
samples, we usually use kolmogorov-smirnov test, which is implemented
in R with ks.test() or in SAS with "pro npar1way edf".
I am wondering if there is any alternative to KS test that could be
generalized to K-samples.
Thanks and have a nice weekend.
wensui
</pre>Wensui Liu2015-05-29T16:31:43Problems with nls
http://comments.gmane.org/gmane.comp.lang.r.general/320758
<pre>Can some help me with a question on this bass model, please
As I read some articles on this topic, I understand that
1. the bass formula is
N(t) = pm + (q-p) N(t-1) - (q/m) (N(t-1))^2
2. which is a difference equation with the solution
N(t) = m (1 − exp(−(p+q)t)) / (1 + (q/p)exp(−(p+q)t))
3. So, using a linear regression would give us some some initial
estimations for the parameters m, p, q
4. we then can put the initial estimations into a NLS to get the better
estimations
Am I right?
Now the question is,
why is that I see people use cumulative data and try to fit it into a pdf as
M * ( ((P+Q)^2 / P) * exp(-(P+Q) * T79) ) / (1+(Q/P)*exp(-(P+Q)*T79))^2,
why not using the cumulative data and fit directly the N(t)
[[alternative HTML version deleted]]
______________________________________________
R-help< at >r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide comme</pre>Abolfazl Saghafi2015-05-29T13:44:54An Odd Request
http://comments.gmane.org/gmane.comp.lang.r.general/320756
<pre>Hello R-Users
I apologize in advance if my post is inappropriate. I read the entire
posting guide and found nothing to say so, but you never know. I am seeking
a knowledgable R-user that might be interested (for whatever reason) in
helping out on what I hope would be considered a worthy project.
I am a research scientist, albeit one with little programming ability. I
recently started a website which allows patients of different sorts to
suggest research studies. Everything is completely free and anonymous. When
several members express interest in a particular idea I attempt to build it
so they can actually run through the study. Clearly there are limits but we
currently we have 4 communities, chronic fatigue syndrome, fibromyalgia,
multiple sclerosis and pernicious anaemia and there are several active
studies in which people are submitting data every day. It's quite exciting
and I think it has great potential to help people, particularly with
disorders that have defied explanation.
I'm currently using goo</pre>Josh Grant2015-05-29T12:48:18Help on R Functionality & Histogram
http://comments.gmane.org/gmane.comp.lang.r.general/320753
<pre>Hello Experts,
I have couple of questions on the analysis I am creating.
1) How does R adopt to changes. The case I have here is that the excel I
have started initially had to be modified because the data I had was on
hourly basis ranging from 0 to 23 hours. After Changes 0 was modified to 24
in hours. Now do I need to recall this excel again in R using read.csv
syntax or is there another way to do so i.e. a kind of reload option
2) I am creating a histogram. I need on x axis 24 hours to be displayed
separately as 0,1,2, and thereon. However it only shows till 20 which makes
the look awkward. Also all l need to resize the labels and if possible
inside the bars. It used the below code, axis fonts have changed but labels
give an error with this code
Code:- hist(aaa$Hours,main="Hourly Weight",xlab = "Time",breaks = 25,col =
"yellow",ylim = c(0,9000),
labels=TRUE, cex.axis=0.6,cex.label=0.6)
Kindly advice on the both the questions. Thanks.
--
View this message in context: http://r.789695.n4.nabble</pre>Shivi822015-05-29T11:54:59How to make new predictions from a GAM with a spline forced through the origin
http://comments.gmane.org/gmane.comp.lang.r.general/320752
<pre>Hi,
I’m followed an example to fit a GAM with a spline forced through a point, i.e. (0,0). This works fine from one of Simon’s examples however when it comes to making a prediction from a new set of x values I’m a bit stumped.
In the example below a smooth term is constructed and the basis and penalties at x=0 are removed then the gam is fitted to a spline basis matrix X using spline penalties.
Can someone suggest a way that I can make predictions at new x values based on the gam b below.
Here is Simon Wood's example:
library(mgcv)
set.seed(0)
n <- 100
x <- runif(n)*4-1;x <- sort(x);
f <- exp(4*x)/(1+exp(4*x));y <- f+rnorm(100)*0.1;plot(x,y)
dat <- data.frame(x=x,y=y)
## Create a spline basis and penalty, making sure there is a knot
## at the constraint point, (0 here, but could be anywhere)
knots <- data.frame(x=seq(-1,3,length=9)) ## create knots
## set up smoother...
sm <- smoothCon(s(x,k=9,bs="cr"),dat,knots=knots)[[1]]
## 3rd parameter is value of spline at knot l</pre>Gavan McGrath2015-05-29T12:12:30Help on R Functionality & Histogram
http://comments.gmane.org/gmane.comp.lang.r.general/320751
<pre>Hello Experts,
I have couple of questions on the analysis I am creating.
1) How does R adopt to changes. The case I have here is that the excel I
have started initially had to be modified because the data I had was on
hourly basis ranging from 0 to 23 hours. After Changes 0 was modified to 24
in hours. Now do I need to recall this excel again in R using read.csv
syntax or is there another way to do so i.e. a kind of reload option
2) I am creating a histogram. I need on x axis 24 hours to be displayed
separately as 0,1,2, and thereon. However it only shows till 20 which makes
the look awkward. Also all l need to resize the labels and if possible
inside the bars. It used the below code, axis fonts have changed but labels
give an error with this code
Code:- hist(aaa$Hours,main="Hourly Weight",xlab = "Time",breaks = 25,col =
"yellow",ylim = c(0,9000),
labels=TRUE, cex.axis=0.6,cex.label=0.6)
Kindly advice on the both the questions. Thanks.
Histogram.png <http://r.789695.n4.nabble.com/file/n4707886/Hist</pre>Shivi822015-05-29T11:53:17Error in CSV file
http://comments.gmane.org/gmane.comp.lang.r.general/320745
<pre>Hello All,
This is an easy fix but I am not able to find the root cause of the error. I
am trying to upload a csv file but it is throwing an error.
Have done a lot of research on google and some tutorial but cant find a
solution hence please advice:-
Syntax is :- aaa<-read.csv(file ="VehicleData.csv",Header=TRUE)
Error:- Error in read.table(file = file, header = header, sep = sep, quote =
quote, :
unused argument (Header = TRUE)
Snapshot of the file:-
WeightHoursPROCESSMonthWeekdayDay
6828 13 INBOUNDMar Fri13
2504 16 INBOUNDMar Fri27
20 16 INBOUNDMar Fri27
10262 16 INBOUNDMar Fri27
2500 17 INBOUNDMar Fri13
Kindly help.
--
View this message in context: http://r.789695.n4.nabble.com/Error-in-CSV-file-tp4707879.html
Sent from the R help mailing list archive at Nabble.com.
</pre>Shivi822015-05-29T08:41:29analysis of variance test
http://comments.gmane.org/gmane.comp.lang.r.general/320741
<pre>
Let's say I have 12 observation of 5 variables and my first variable is categorical (with 4 different levels). I am trying to find out statistical significance difference between these categorical levels for each variable, but my function is not working! Please note that my data "x" are in data.frame format.
Any suggestion would be helpful.Many thanks.
function(x)
{
x1 <- numeric
x2 <- numeric
for(i in 2:length(x)) {
x1[i] <- summary(aov(x[, i] ~ factor(x[, 1])))
x2[i] <- x1[i]$Pr[1] #Pr is the probability values
if(x2[i] < 0.06)
x2[i] <- 1
else x2[i] <- 0
}
x2
}
[[alternative HTML version deleted]]
______________________________________________
R-help< at >r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, re</pre>Nezahat HUnter2015-05-28T21:16:27Why I am not able to load library(R.matlab)? Other packages arefine.
http://comments.gmane.org/gmane.comp.lang.r.general/320735
<pre>Dear R list,
I am trying to do use the R.matlab library, I did the following, but it
does not work.
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck
= vI[[j]]) :
there is no package called ‘R.methodsS3’
Error: package or namespace load failed for ‘R.matlab’
This is my session info.
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
My R is up-to-date, R 3.2.0. Why is this happening? Is it because I
installed the new R version, instead of updating it? Maybe things are in a
different directory?
Thanks so much,
Mike
[[alternative HTML version deleted]]
______________________________________________
R-help< at >r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting gu</pre>C W2015-05-28T18:47:25Using names in function with ellipsis (non standard evaluation?)
http://comments.gmane.org/gmane.comp.lang.r.general/320732
<pre>Hi everybody,
this is probably a silly question, but I can't find a way to recognize
the names that are passed
to variables in ellipsis.
For example, say I have a "core" function that receives some extra
parameters through ...
e.g.
f <- function(...) {
params <- c(...)
#dothehardworkhere using "names(params)"
}
and then I want to create a function g where some of the parameters
are set like:
g <- function(x,y) f(x,y)
I figure I probably have to use to substitute in f, but it is not
clear to me how.
Definitely what I need to achieve is that when I call:
g(1,2) then in f params is the vector c(x=1,y=2);
similarly I want to be able to call g(y=2, x=1)
and have params = c(x=1,y=2) in f.
Can you please help me understanding how to do this?
Thanks a lot for your help!
Cheers,
Luca
</pre>Luca Cerone2015-05-28T17:40:39Search EngineSearch the mailing list at Gmanequery
http://search.gmane.org/?group=$group=gmane.comp.lang.r.general