Displaying 20 results from an estimated 109 matches for "20,10".
Did you mean:
20,12
2010 Nov 30
1
Zooming in to a ggplot (a sort of ylim, but ylim won't do)
...eed(1234)
# I am only trying to chop-off anything below zero (this for the example
only)
trunc_rnorm <- function(n, mean = 0, sd = 1, lb = 0)
{
lb <- pnorm(lb, mean, sd)
qnorm(runif(n, lb, 1), mean, sd)
}
# generate my data, this is not important
rsp<-trunc_rnorm(160,mean=c(
rep(20,10),rep(25,10),rep(40,10),rep(45,10),
rep(20,10),rep(27,10),rep(42,10),rep(45,10),
rep(20,10),rep(30,10),rep(44,10),rep(45,10),
rep(20,10),rep(30,10),rep(44,10),rep(45,10)),
sd=c(rep(c(60,2,2,3),each=10,len=160)),
lb=c(rep(c(0,0,0,0),each=10,len=160)))
d<-rep(c(rep(1,10),rep(2,10),rep(3,10),...
2019 Feb 19
4
code for sum function
...+ xi
s
}
kahanSum <- function (x)
{
s <- 0.0
c <- 0.0 # running compensation for lost low-order bits
for(xi in x) {
y <- xi - c
t <- s + y # low-order bits of y may be lost here
c <- (t - s) - y
s <- t
}
s
}
> rSum <- vapply(c(1:20,10^(2:7)), function(n) sum(rep(1/7,n)), 0)
> rNaiveSum <- vapply(c(1:20,10^(2:7)), function(n) naiveSum(rep(1/7,n)), 0)
> rKahanSum <- vapply(c(1:20,10^(2:7)), function(n) kahanSum(rep(1/7,n)), 0)
>
> table(rSum == rNaiveSum)
FALSE TRUE
21 5
> table(rSum == rKahanSum)...
2011 Apr 02
2
Matrix manipulation
Hi all!
I have a vector, let's say for example int <- sample(1:20,10);
for now:
now I have a matrix...
M = m x n
where the first column is a "feature" column and most likely shares at least
one of the int (interesting) numbers.
I want to extract the rows where int[] = M[,1]
I thought:
rownames(int)<-int;
rownames(M)<-M[,1];
M[rownames(int),] w...
2004 Dec 01
2
barplot() using beside=TRUE and the density argument
Hi
I am using barplot() to draw some barplots, with a matrix as the data so
that multiple bars are drawn for each data point. I want to use the
argument "beside=TRUE" to juxtapose the bars instead of stacking them.
If I execute:
barplot(data,names.arg=names,density=c(20,10),beside=FALSE)
I get the expected behaviour i.e. the bottom part of the column is
shaded 20 lines per inch, the top part 10 lines per inch. However, if I
try:
barplot(data,names.arg=names,density=c(20,10),beside=TRUE)
I don't get what *I* would expect (which admittedly might be the wrong...
2012 Feb 26
1
Matrix problem to extract animal associations
...(not in below code!)
11 ID11 9
12 ID12 9
I've been trying to figure this out but have drawn a blank. My example code can be found below.
Very best wishes,
Ross
Dr Ross Dwyer
Postdoctoral Research Fellow
University of Queensland
> ###
> require(stats)
> x <- sample(1:20,10)
> y <- sample(1:20,10)
> IDs <- sapply(1:10,function(i) paste("ID",i,sep=""))
> (DFid <- data.frame(x,y))
x y
1 7 20
2 5 3
3 12 5
4 3 12
5 18 19
6 2 1
7 19 15
8 20 11
9 13 14
10 1 2
>
>
> (DMdist <- dist(DFid, method = &qu...
2015 Mar 19
2
Familia *pply
...ausar problemas, envío de nuevo el código sin formatos.
La idea básica es para un set de números de columnas (desordenados) y un
set de numeros de fila el loop lo que hace es ir a la fila y columna
correspondiente de data, tomar el valor y luego hacer la media sobre esos.
data=matrix(rnorm(100*20),20,100)
col=sample(1:100,100)
t1=Sys.time()
medias=replicate(1000,{
sel=sample(1:20,10)
pareja=sample(sel,100,replace = T)
ta=Sys.time()
recep=NULL
for(i in 1:100){
n=col[i]
m=pareja[i]
c=data[m,n]
recep=c(recep,c)
}
tb=Sys.time()
media=mean(recep)
t...
2015 Mar 19
3
Familia *pply
...de la familia *pply en todo lo que puedo, pero todavía no es
algo que me surja tan rápidamente o naturalmente al momento de los loops
como usar for().
Conozco las ventajas de usar estas funciones y por eso mi intento de
hacerme de ellas.
Por ejemplo en este problema:
data=matrix(rnorm(100*20),20,100)
col=sample(1:100,100)
t1=Sys.time()
medias=replicate(1000,{
sel=sample(1:20,10)
pareja=sample(sel,100,replace = T)
ta=Sys.time()
*recep=NULL**
** for(i in 1:100){**
** n=col[i]**
** m=pareja[i]**
** c=data[m,n]**
** re...
2011 Jan 28
6
User error in calling predict/model.frame
.... By debugging predict, I
can see that the error occurs in a call to model.frame. By debugging
model frame I can see the error occurs with this command: variables
<- eval(predvars, data, env); it seems likely that the error is
because predvars looks like this:
list(scale(xxA, center = 10.2058714830537, scale = 0.984627257169526),
scale(xxB, center = 20.4491690881149, scale = 1.13765718273923))
An example case:
dat <- data.frame(xxA = rnorm(20,10), xxB = rnorm(10,20))
dat$out <- with(dat,xxA+xxB+xxA*xxB+rnorm(20,20))
xVar <- "scale(xxA)"
traceVa...
2019 Feb 20
0
code for sum function
Dear Will,
This is exactly what I find.
My point is thus that the sum function in R is not a naive sum nor a
Kahansum (in all cases), but what algorithm is it using then?
Cheers, Rampal
On Tue, Feb 19, 2019, 19:08 William Dunlap <wdunlap at tibco.com wrote:
> The algorithm does make a differece. You can use Kahan's summation
> algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm) to
> reduce the error compared to the naive summation algorithm. E.g., in R
> code:
&...
2015 Mar 21
2
Familia *pply
...que aplicar,
> en este caso "mapply()", mejore los tiempos frente a la solución
> basada en un bucle.
>
> #-------------------------
> t1 <- Sys.time()
>
> *myfun <- function(x,y) { data[x,y] }*
>
> medias <- replicate(1000,{
> sel <- sample(1:20,10)
> pareja <- sample(sel,100,replace = T)
> ta <- Sys.time()
> *#cambio
> resnew <- mapply(myfun, pareja, col)
> #cambio *
> tb <- Sys.time()
> media <- mean(resnew)
> tt <- tb-ta
> c(media,tt)
> })
>
> t2 <- Sys.time()
>...
2019 Feb 19
0
code for sum function
...f interest:
https://stackoverflow.com/questions/38589705/difference-between-rs-sum-and-armadillos-accu/
which points out that sum() isn't doing anything fancy *except* using
extended-precision registers when available. (Using Kahan's algorithm
does come at a computational cost ...)
On 2019-02-19 2:08 p.m., William Dunlap via R-devel wrote:
> The algorithm does make a differece. You can use Kahan's summation
> algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm) to
> reduce the error compared to the naive summation algorithm. E.g., in R
> code:
>...
2019 Feb 20
0
code for sum function
Someone said it used a possibly platform-dependent
higher-than-double-precision type.
By the way, in my example involving rep(1/3, n) I neglected to include the
most precise
way to calculate the sum: n%/%3 + (n%%3)/3.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Wed, Feb 20, 2019 at 2:45 PM Rampal Etienne <rampaletienne at gmail.com>
wrote:
> Dear Will,
>
> This is exactly what I find.
> My point is thus that the sum function in R is not a naive sum nor a
> Kahansum (in all cases), but what algorithm is it using then?
>
> Cheers, Rampal
>...
2018 Jan 09
1
[PATCH] vhost: Remove the unused variable.
..._WORK_QUEUED, &work->flags);
work->fn = fn;
- init_waitqueue_head(&work->done);
}
EXPORT_SYMBOL_GPL(vhost_work_init);
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 79c6e7a60a5e..749fe13e061c 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -20,10 +20,6 @@ typedef void (*vhost_work_fn_t)(struct vhost_work *work);
struct vhost_work {
struct llist_node node;
vhost_work_fn_t fn;
- wait_queue_head_t done;
- int flushing;
- unsigned queue_seq;
- unsigned done_seq;
unsigned long flags;
};
--
2.13.6
2012 Sep 25
1
Bug or misunderstanding of par(pin)?
...idth=1 inch, height=
0.87 inches).
I tried to use "pin" to fix the plotting region to a specific size, but
without success.
The following example will visualize the problem:
par(mfrow=c(3,4),pin=c(1,0.87),mai=c(0.04,0.04,0.04,0.04),
omi=c(0.2,0.32,0.32,2.16))
plot(1:10,1:10)
plot(10:20,10:20)
plot(20:30,20:30)
plot(30:40,30:40)
plot(2:11,2:11)
plot(11:21,11:21)
plot(21:31,21:31)
plot(31:41,31:41)
plot(3:12,3:12)
plot(12:22,12:22)
plot(22:32,22:32)
plot(32:42,32:42)
--> You can see that the single plots are higher than wide and not
reflecting the size pin=c(1,0.87...
2019 Feb 14
5
code for sum function
Hello,
I am trying to write FORTRAN code to do the same as some R code I have.
I get (small) differences when using the sum function in R. I know there
are numerical routines to improve precision, but I have not been able to
figure out what algorithm R is using. Does anyone know this? Or where
can I find the code for the sum function?
Regards,
Rampal Etienne
2014 Aug 26
1
Call for testing: OpenSSH 6.7
Good news/Bad News
The test race in RHEL 3.4 seems to be gone ... but another ec.h failure ...
Using http://www.mindrot.org/openssh_snap/openssh-SNAP-20140827.tar.gz
OS Build_Target CC
OpenSSL BUILD TEST
============== =========================== ================
============= ====== =================
*RHEL 3.4 i386-redhat-linux gcc 3.2.3-47
1.0.1i**a OK*1 all tests passed*
*AIX 5300...
2004 Dec 30
2
[PATCH] /proc/sys/kernel/bootloader_type
This patch exports to userspace the boot loader ID which has been
exported by (b)zImage boot loaders since boot protocol version 2.
Tested on i386 and x86-64; as far as I know those are the only
architectures which use zImage/bzImage format.
-hpa
Signed-Off-By: H. Peter Anvin <hpa at zytor.com>
2012 Apr 06
2
[PATCH] virt-sysprep:add logging feature
...t; glob
+ ) files;
[]
let cron_spool_op = {
diff --git a/sysprep/sysprep_operation_dhcp_client_state.ml b/sysprep/sysprep_operation_dhcp_client_state.ml
index e3e87cb..17bb65b 100644
--- a/sysprep/sysprep_operation_dhcp_client_state.ml
+++ b/sysprep/sysprep_operation_dhcp_client_state.ml
@@ -20,11 +20,16 @@ open Sysprep_operation
module G = Guestfs
-let dhcp_client_state_perform g root =
+let dhcp_client_state_perform g root show_log =
let typ = g#inspect_get_type root in
if typ = "linux" then (
List.iter (
- fun glob -> Array.iter g#rm_rf (g#glob_expand...
2006 Oct 17
0
[PATCH] Fixes for linking on Solaris
# HG changeset patch
# User john.levon@sun.com
# Date 1161090130 25200
# Node ID afeef751f9dafa771726bcfb00b29a10b0baeabd
# Parent 7147e57f18552bbb8d25155cc1c635315283ee31
On Solaris, GCC is configured to use Sun''s LD. Fix the build to use the correct
flags, and link against libsocket where necessary.
Signed-off-by: John Levon <john.levon@sun.com>
d...
2013 Jun 01
1
[PATCH] Add missing config.h includes
...g.h"
+#endif
+
#include "FLAC++/encoder.h"
#include "FLAC++/metadata.h"
#include "FLAC/assert.h"
diff --git a/src/plugin_xmms/charset.c b/src/plugin_xmms/charset.c
index 2c5167f..6d86848 100644
--- a/src/plugin_xmms/charset.c
+++ b/src/plugin_xmms/charset.c
@@ -20,6 +20,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "plugin.h"
#include <stdlib.h>
diff --git a/src/plugin_xmms/configure.c b/src/plugin_xmms/configure.c
index 6b83435..3dfddc4...