Displaying 20 results from an estimated 1100 matches similar to: "more efficient way to parallel"
2014 Jul 21
2
Inserción de condicionales en pequeño código
Buenas tardes,
He construido la función “myfun” al objeto de considerar aquellas
persones que a partir de una determinada fecha de Apertura tienen como mínimo 65 años. Se tiene su fecha de
nacimiento, su fecha de inicio en la institución y su fecha de salida de la
misma. Doy vueltas al script y no acabo se saber cómo poder aplicar de un modo
eficiente las instrucciones “if” ó bien “ifelse”, y me
2006 Aug 24
1
Using a 'for' loop : there should be a better way in R
I need to apply a yearly inflation factor to some
wages and supply some simple sums by work category. I
have gone at it with a brute force "for" loop approach
which seems okay as it is a small dataset. It looks
a bit inelegant and given all the warnings in the
Intro to R, etc, about using loops I wondered if
anyone could suggest something a bit simpler or more
efficent?
Example:
2003 Dec 04
4
bug in as.POSIXct ?
I think that there is a bug in the as.POSIXct function on Windows.
Here is what I get on Win2000, Pentium III machine in R 1.8.1.
> dd1 <- ISOdatetime(2003, 10, 26, 0, 59, 59)
> dd2 <- ISOdatetime(2003, 10, 26, 1, 0, 0)
> dd2 - dd1
Time difference of 1.000278 hours
Now, the 26th of October was the day that change to the standard time
occurred, so I suspect that this has
2008 Mar 24
1
Great difference for piecewise linear function between R and SAS
Dear Rusers,
I am now using R and SAS to fit the piecewise linear functions, and what
surprised me is that they have a great differrent result. See below.
#R code--Knots for distance are 16.13 and 24, respectively, and Knots for y
are -0.4357 and -0.3202
m.glm<-glm(mark~x+poly(elevation,2)+bs(distance,degree=1,knots=c(16.13,24))
+bs(y,degree=1,knots=c(-0.4357,-0.3202
2008 Apr 14
3
Doing the right amount of copy for large data frames.
Hi there,
Problem ::
When one tries to change one or some of the columns of a data.frame, R makes
a copy of the whole data.frame using the '*tmp*' mechanism (this does not
happen for components of a list, tracemem( ) on R-2.6.2 says so).
Suggested solution ::
Store the columns of the data.frame as a list inside of an environment slot
of an S4 class, and define the '[',
2010 Aug 16
1
data frame handling
Dear all,
I have an xts object , t.xts with 4 columns: "v1" "DD1" "v2" "DD2" and
created a data frame :
t <- as.data.frame(t.xts)
I would like to extract data and create a new data frame for when the values
in column DD1 falls between 0 and 30 and extract the corresponding v1 value.
How can I do this?
Thanks.
--
View this message in context:
2018 Oct 05
2
Seg fault stats::runmed
Dear all,
I just found this issue:
dd1 = c(rep(NaN,82), rep(-1, 144), rep(1, 74))
xx = runmed(dd1, 21)
-> R crashes reproducibly in R 3.4.3, R3.4.4 (Ubuntu 14.04/Ubuntu 16.04)
With GDB:
Program received signal SIGSEGV, Segmentation fault.
swap (l=53, r=86, window=window at entry=0xc59308,
outlist=outlist at entry=0x12ea2e8, nrlist=nrlist at entry=0x114fdd8,
print_level=print_level at
2007 Apr 19
1
Character coerced to factor and I cannot get it back
Something probably obivous but I don't see it. I
needed to find the first 1 or two digits of some 5 and
6 digit numbers since they identified research sites
while the rest of the number was the plot id.
I converted the numbers to characters, got the first 1
or 2 characters as appropriate and went to add the
new vector to the data.frame. For some reason R is
insisting on turning the
2008 Nov 13
0
sem and "simple variables"
salutations!
i am doing some longitudinal modeling with sem and thought calculating some
"simple variables" would make my model more readable. this is the smallest
subset of my model that illustrates the resulting problem.
i have 2 observed exogenous variables (c1, d2) and 4 observed endogenous
variables (dc1, dd1, dc2, dd2). c1 is the observed state at time 1, dc1 is
the change in c
2009 May 31
1
Error:non-numeric argument in my function
Hello!
I have a function:
zywnoscCalosc<- function( jedzenie, n1, n2, n3, n4, d1, d2, d3, d4 ) {
ndf <- data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4)
ddf <- data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4)
for (i in 1:length(n1)){
wekt_n = ndf[i,]
wekt_n_ok = wekt_n[!is.na(wekt_n)]
dl_n = length(wekt_n_ok)
wynik = (1*wekt_n_ok)/(1*dl_n)
}
}
and I get an error like this:
Error in 1 * wekt_n_ok :
2009 Jun 02
2
What do you think about my function?
Hello,
I want to know what do you think about my function. I know that it isn't
briliant :/ but what do you think? What I should do that my function will be
better? (now is very slow and not ideal, sometimes I also get a mistake!)
########## My function #############################################
dzieci<-transform(dzieci, zywnosc=0)
zywnoscCalosc<- function( jedzenie, sklep, n1, n2,
2012 Jul 07
11
Splitting a character vector.
I am lousy at simple regex and I have not found a solution to a simple problem.
I have a vector with some character values that I want to split.
Sample data
dd1 <- c( "XXY (mat harry)","XXY (jim bob)", "CAMP (joe blow)", "ALP (max jack)")
Desired result
dd2 <- data.frame( xx = c("XXY", "XXY", "CAMP",
2007 Apr 19
0
Fwd: RE: Character coerced to factor and I cannot get it back
--- John Kane <jrkrideau at yahoo.ca> wrote:
> Date: Thu, 19 Apr 2007 15:50:36 -0400 (EDT)
> From: John Kane <jrkrideau at yahoo.ca>
> Subject: RE: [R] Character coerced to factor and I
> cannot get it back
> To: Jorge Cornejo-Donoso <jorgecornejo at uach.cl>
>
>
> --- Jorge Cornejo-Donoso <jorgecornejo at uach.cl>
> wrote:
>
> >
2011 Aug 23
0
Matrix:::qr.qy and signature(qr = "sparseQR", y = "dgCMatrix")
> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Matrix_0.999375-50 lattice_0.19-30
loaded via a namespace (and not attached):
[1] grid_2.13.1
2007 Apr 20
0
Fwd: Re: Character coerced to factor and I cannot get it back
--- John Kane <jrkrideau at yahoo.ca> wrote:
> Date: Fri, 20 Apr 2007 10:47:45 -0400 (EDT)
> From: John Kane <jrkrideau at yahoo.ca>
> Subject: Re: [R] Character coerced to factor and I
> cannot get it back
> To: jim holtman <jholtman at gmail.com>
>
> Thanks Jim,
>
> I can live with it as a factor or I will do as you
> suggest. What is bothering
2009 May 20
2
How to load data from Statistics Canada
We would like to load data from Statistics Canada
(http://www.statcan.gc.ca/) using R,
for example, Employment and unemployment rates.
It seems to me that the tables are displayed in HTML.
I was wondering if you know how to load these tables. Thanks,
-james
2006 Mar 11
2
weird! QDA does not depend on priors?
Hi all,
If I run LDA on the same data (2-class classification) with default(no
priors specified in the lda function) vs. "prior=c(0.5, 0.5)", the results
are different.
The (0.5, 0.5) priors give better 1-classify-to-1 rate, and the proportional
priors(default, no priors specified in the lda function) give better
0-classify-to-0 rate, for both training and testing data sets.
However,
2007 Mar 27
3
Unexpected result of as.character() and unlist() applied to a data frame
Hi,
> dd <- data.frame(A=c("b","c","a"), B=3:1)
> dd
A B
1 b 3
2 c 2
3 a 1
> unlist(dd)
A1 A2 A3 B1 B2 B3
2 3 1 3 2 1
Someone else might get something different. It all depends on the
values of its 'stringsAsFactors' option:
> dd2 <- data.frame(A=c("b","c","a"), B=3:1, stringsAsFactors=FALSE)
> dd2
2013 Jan 18
1
Object created within a function disappears after the function is run
Dear R-helpers,
I have run the code below which I expected to make an object called dd1,
but that object does not exist.
So, in summary, my problem is that my function is meant to make an object
(dd1), and it does indeed make that object (I know that the last line of
the function prints it out) but then, after the function has run, the
object has disappeared.
It's late on a Friday so I may
2011 Apr 26
1
Barplot for degree distribution
In barplot for degree distribution x-axis is not seen.
See the example below
> g = barabasi.game(500, 0.4)
> dd1 = degree.distribution(g)
> plot(dd1, xlab="degree", ylab = "frequency")
whereas barplot doesnot have any x-axis
> barplot(dd1, xlab = "degree", ylab = "frequency")
Please see the figures attached.