If this code is slow it is not because you are using loops, but because you are
dynamically building your vectors and lists and their size needs to change with
each iteration causing significant unnecessary computational overhead. If you
simply do something like
d <- numeric(m-1)
for (i in
> On 25 Oct 2015, at 11:42, Maram SAlem wrote:
>
> Hi All,
>
> I wonder if I can avoid the for() loop in any of the following loops.These
> loops are a part of a larger code which I'm trying to accelerate.
>
> n=6
> m=4
> x<-c(0,1,1)
>
> 1st loop
>
> for (i in
Hi All,
I wonder if I can avoid the for() loop in any of the following loops.These
loops are a part of a larger code which I'm trying to accelerate.
n=6
m=4
x<-c(0,1,1)
1st loop
for (i in 1:m-1)
{
d[i]<- n- (sum(x[(1):(i)])) - i
}
e<- n*(prod(d))
2nd loop
LD<-list()
for (i
Thanks a lot Boris and Berend.
I'll consider the brackets ((m-1) in every loop). In addition, I'll read
more on profiling my code. In fact,I'm using the apply () in another part
of my code.
Thanks again for helping.
Maram Salem
On 25 October 2015 at 14:26, Berend Hasselman
Sorry - I just noticed you actually have an error in your code: you had
parentheses everywhere they were not needed and I overlooked you had not put
them where they actually are needed. It has to be for (i in 1:(m-1)) ..., not
as you wrote. I'm sure you'll understand the difference.
d <-
Dear Ujjwal
Two problems
1 - you posted in HTML so your post is unreadable
2 - your attached graphic was not in one of the formats which R-help
accepts and so was stripped
On 25/10/2015 11:04, Ujjwal Kumar wrote:
HI friends
I am struggling in plotting bar graph with this data sets in R.
Yay Chuck! Boo Bert.
-- Bert
Bert Gunter
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
-- Clifford Stoll
On Sat, Oct 24, 2015 at 9:05 PM, Charles C. Berry wrote:
> On Sat, 24 Oct 2015, Bert Gunter wrote:
>
>> Rolf's
HI friends
I am struggling in plotting bar graph with this data sets in R. although I
can plot it in Microsoft excel( attached graphics). I need help in coding
it for R.(SE=standar error)
> >data
> habitat
> proportion_use
> proportion_use_SE
> selectivity_index
> selectivity_index_SE
> grassland
Yes. Too cute, maybe?
-- Bert
Bert Gunter
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
-- Clifford Stoll
On Sat, Oct 24, 2015 at 9:57 PM, Rolf Turner wrote:
> On 25/10/15 17:14, John Sorkin wrote:
>>
>> Bert
Ming is right. I can't imagine other discipline's standards are substantially
different from ours, but e.g. the ACS style manual is very explicit to require
...
"Label each axis with the parameter or variable being measured and the units
of measure in parentheses."
The _units_ are not
It may be useful for you to estimate the time complexity of your function: try
it with smaller input that takes short and noticeable time, see whether the
time increases linearly, quadratically, or exponentially with the number of
elements you process, then extrapolate to your full data set.
I would guess that you ran R as administrator at some point and now you have a
permissions problem on your user library. I can't say I know how to fix it,
though using administrator mode to fix the permissions is probably hard while
using administrator mode to delete the R directory and
Hi Oscar,
I would be overjoyed if someone has translated the SPSS or SAS code
provided by Andrew Hayes:
http://www.afhayes.com/spss-sas-and-mplus-macros-and-code.html
scroll down to KALPHA and go for it. If you succeed, let:
Matthias Gamer
the maintainer of the irr
Dear all,
As to stating units in graphs: IMHO it should be as follows:
If an axis reads 0 ... 10 ... 20 ... etc and the unit is pounds (lb), the
legend should read "weight/lb" (pronounced "weight in pound").
The logic is: 10 lb/lb = 10. In orther words, dividing a dimensioned number by
the
I get the following error:
Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:\Users\Administrator\My Documents/R/win-library/3.2": Access is
denied
This may be the first time that I have tried to upgrade R since I upgraded my
Windows installation (on
As answered here: http://stackoverflow.com/a/1444/1457051
palette(c("red", "blue", "orange"))
par(lty=3)
plot(fit,ylim=c(0,1),xlim=c(0,2000))
though, as indicated in that post, you'll need to customize the
survrec:::plot.survfitr function to do more detailed customization.
On
Hi Polina and Jim,
Have you been able to implement the correct bootstrapping of Krippendorff's
alpha?
Kind Regards,
Oscar
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
Hi to all.
I've been trying to calculate weight-for-age z-scores with the y2z
command (AGD package).
However, I keep getting strange results.
My hypothesis is that missings are the problem.
My dataframe looks like this:
data <- structure(list(sex = structure(c(3L, 3L, 3L, 2L, 3L), .Label =
Dear all,
I am new to R and I am using the package 'survrec'. I would like to modify
the colors and lines in graphs with multiple groups. The package includes
this example:
data(colon)
fit<-survfitr(Survr(hc,time,event)~as.factor(dukes),data=colon,type="pena")
Using the arguments "col" or "lty"
It looks like the y2z() function strips NA's so that the vector lengths do not
match any longer. The simplest workaround is to remove the NA's. You could do
that by using data2 <- na.omit(data) to strip the observations with NA if they
will not be used in the rest of the analysis.
If you want
Hi All,
I'm using a function, say func, and I want to apply it to all the rows of a
certain matrix. The problem is that my code kept on running for more than
two days without giving any output. I've made some modifications.But is
there a way to know the time needed to execute my code and reach an
Hi,
thanks to Duncan and Jeroen to quick replies. I was actually my thinking
error :) I suppoed 'fromJSON' to cope with a multi-line file or a list,
but this seems not to be the case. So I first read the file with
'readLines' into a list and processed all items with 'fromJSON' within a
> On 25 Oct 2015, at 14:37 , Bert Gunter wrote:
>
> Yes. Too cute, maybe?
>
...as in "charming" or...
Oh.
;-)
pd
> -- Bert
> Bert Gunter
>
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> -- Clifford Stoll
23 matches
Mail list logo