search for: rep

Displaying 20 results from an estimated 2981 matches for "rep".

Did you mean: re
2010 Nov 30
1
Zooming in to a ggplot (a sort of ylim, but ylim won't do)
...et.seed(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,1...
2010 Aug 01
3
remove extreme values or winsorize – loop - dataframe
Hi everyone! #I need a loop or a function that creates a X2 variable that is X1 without the extreme values (or X1 winsorized) by industry and year. #My reproducible example: firm<-sort(rep(1:1000,10),decreasing=F) year<-rep(1998:2007,1000) industry<-rep(c(rep(1,10),rep(2,10),rep(3,10),rep(4,10),rep(5,10),rep(6,10),rep(7,10),rep(8,10),rep(9,10), rep(10,10)),1000) X1<-rnorm(10000) data<-data.frame(firm, industry,year,X1) data The way I?m...
2013 Feb 06
1
Adding Latex to text
Hi, I'd like to add "alpha" in latex code to my image. Any suggestions? library(UsingR) BagA = c(rep(10,6),rep(20,5), rep(30,4),rep(40,3),rep(50,2),60,70) BagA BagB = c(10, 20,rep(30,2),rep(40,3),rep(50,4),rep(60,5),rep(70,6)) BagB par(mfrow = c(2, 1)) DOTplot(BagA) abline(v=60,lwd=2,lty=2,col="red") text(65,3, "alpha-->", col=2) abline(v=50, lwd=2, lty=2, col="blue&qu...
2011 Apr 15
1
no solution yet, please help: extract p-value from mixed model in kinship package
...t of it. I need to extract is as I need to analyse large number of > variables (> 10000). > > Please help me: > > require(kinship) > > #Generating random example data > > #********************pedigree data***************************** id <- 1:100 dadid <- c(rep(0, 5), rep(1, 5), rep(3, 5), rep(5, 5), rep(7, 10), rep(9, 10), rep(11, 10), rep(13, 10), rep(15, 10), rep(17, 10), rep(19, 10), rep(21, 10)) momid <- c(rep(0, 5), rep(2, 5), rep(4, 5), rep(6, 5), rep(8, 10), rep(10, 10), rep(12, 10), rep(14, 10), rep(16, 10), rep(18, 10), rep(20, 10), rep(22,...
2009 Nov 02
5
Optimizar código
...s seguidos. Se me ocurrió hacerlo con un loop for. Pero tarda demasiado. También intente usar which para que seleccione solo los 1 para empezar a sumar pero no hay gran diferencia. A alguien se le ocurre alguna solución para hacerlo más rápido? Acá está el código con los datos de prueba: test<-rep(c(rep(0,5),rep(1,601),rep(0,100),rep(1,100),rep(0,3),rep(1,200),rep(0,300),rep(1,1000)),100) loop<-numeric() for (i in 1:length(test)) { loop[i]<-sum(test[i:(i+600)]) } loop2<-numeric() for (i in which(test==1)) { loop2[i]<-sum(test[i:(i+600)]) } Muchas gracias a todos l...
2016 Oct 28
2
Encontrar la primera columna no NA
...nto el problema como las soluciones propuestas, un saludo! Adolfo. library(microbenchmark) library(data.table) library(dplyr) library(tidyr) set.seed(123456) numero <- 1e5 N <- 1e1 tabla <- microbenchmark( JVG ={ dat <- data.table( Uno = sample( c(runif(numero) , rep(NA , numero /2e0 )) , size = numero ) , dos = sample( c(runif(numero) , rep(NA , numero /1e1 )) , size = numero ) , tres = sample( c(runif(numero) , rep(NA , numero /2e1 )) , size = numero ) , cuatro = sample( c(runif(numero) , rep(NA...
2005 Aug 08
3
use different symbols for frequency in a plot
suppose I have the following data x<-c(rep(.1,5),rep(.2,6),rep(.4,10),rep(.5,20)) y<-c(rep(.5,3),rep(.6,8),rep(1.2,8),rep(2.5,18),rep(3,4)) If I plot(x,y) in R, I will only get seven distinct points. What I want to do is to use different symbols to show the frequency at each point. e.g. if the frequncey is between 1 and 5, then I plot...
2011 Feb 07
3
Giving vector of colors to line in plots
...;. The sample code I'm using is below. Any help would be greatly appreciated. Also, please CC me, as I only get daily summaries of the mailing list. Thanks, Brian ## Changing plot attributes through the plot set.seed(33) x <- rpois(7,lambda=7) y <- rpois(7,lambda=5) cols.x <- c(rep("black",2),rep("red",3),rep("black",2)) cols.y <- c(rep("blue",3),rep("yellow",2),rep("blue",2)) points.x <- c(rep("x",2),rep("O",3),rep("x",2)) points.y <- c(rep(8,3),rep(17,2),rep(8,2)) plot(x,col...
2010 Jan 14
1
Error: object of type 'closure' is not subsettable
Hi everyone, Would somebody please explain (or point me to a reference that explains) the following error: "Error: object of type 'closure' is not subsettable" I was trying to use rep() to replicate a function: > example_function <- function() { return(TRUE) } > rep(example_function, 3) Error: object of type 'closure' is not subsettable But I just cannot understand this error. I can combine functions using "c" without any problems: > c(examp...
2006 Oct 05
2
xyplot
Hi, for the data below: time<-c(rep(1:10,5)) y<-time+rnorm(50,5,2) subject<-c(rep('a',10),rep('b',10),rep('c',10),rep('d',10),rep('e',10)) group<-c(rep('A',30),rep('B',20)) df<-data.frame(subject,group,time,y) I'd like to produce a plot with a single pannel with...
2019 Apr 23
0
[nbdkit PATCH 7/7] nbd: Implement structured replies
Time to enhance the nbd plugin to request structured replies from the server. For now, deal only with structured reads. The server can now return sparse reads, even though we need nbdkit version 3 before we can in turn return sparse reads back to the client. In general, we have to assume the server is malicious, and so we must sanity check that it sends...
2007 Nov 16
2
expand.grid overflows?
>cbn<-as.matrix(expand.grid( rep( list(0:1), 50))) Error in rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) : invalid 'times' value In addition: Warning message: In rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) : NAs introduced by coercion But I'm only interested in cbn matrix rows where:...
2014 Apr 11
6
crear variable en base a nombre de columnas que tienen un 1
Buenos días. Hoy ando un poco (o bastante) espeso y no doy con la tecla de una cosa que seguro que es muy simple.. Pongo un ejemplo. var1 <- c(rep(0,3),rep(1,2)) var2 <- c(rep(1,2),0,0,1) var3 <- c(rep(1,2),rep(0,3)) var4 <- c(rep(1,2),rep(0,3)) datos <- data.frame(fila=1:5,var1, var2, var3, var4) datos datos fila var1 var2 var3 var4 1 1 0 1 1 1 2 2 0 1 1 1 3 3 0 0 0 0 4 4 1...
2011 Oct 06
1
Wilcox Test / Mann Whitney U Test
Hello List, I'm trying to prepare some lecture notes on non parametric methods, and I can't manually reproduce the results of the wilcox.test function for ordinal data. The data I'm using are from David Howell's website, available here http://www.uvm.edu/~dhowell/StatPages/More_Stuff/Ordinal...
2008 May 11
1
positioning of color key in levelplot
...g around with the arguments "x", "y", and "corner"in the colorkey list, but it doesn't seem to change anything. I've also tried putting the colorkey on the left side instead, but then the secondary y axis labels are cut-off. Thanks for any help! group1 <- c(rep("A1", 40), rep("A2", 40)) group2 <-rep(c(rep("C1", 5), rep("C2", 5), rep("C3", 5), rep("C4", 5), rep("C5", 5), rep("C6", 5), rep("C7", 5), rep("C8", 5)),2) num <- rnorm(80) group3 <- rep(seq...
2018 May 05
1
error in chol.default((value + t(value))/2) : , the leading minor of order 1 is not positive definite
...the four parameters according to the three groups - add random effects pr each rat - add residual random effect #Parameter values taken from Sapirstein AJP 181:330-6, 1955 set.seed(1234) Time <- seq(1,60,by=1) A <- 275; B <-? 140;? g1 <- 0.1105; g2 <- .0161 N <- 30 AA <- rep(A,30)+rnorm(30,0,30);BB <- rep(B,30)+rnorm(30,0,15) ; gg1 <- rep(g1,30)+rnorm(30,0,0.01); gg2 <- rep(g2,30)+rnorm(30,0,0.001) TRT <- gl(3,10*60) levels(TRT) <- c("CTRL","DIAB","HYPER") AA1 <- AA + c(rep(0,10),rep(10,10),rep(-10,10)) BB1 <- BB + c(...
2010 Dec 30
1
Different results in glm() probit model using vector vs. two-column matrix response
...ctly, a multiple of the other. I need the deviance, df, and weights for another formula, which is why I'm focused on these. My code is below. Thank you in advance for any assistance! Shelly **** # 10 record set-up group <- gl(2, 5, 10, labels=c("U","M")) dose <- rep(c(7, 8, 9, 10, 11), 2) ldose <- log10(dose) n <- c(8,8,8,8,8,8,8,8,8,8) r <- c(0,1,3,8,8,0,0,0,4,5) p <- r/n d <- data.frame(group, dose, ldose, n, r, p) SF <- cbind(success=d$r, failure=d$n - d$r) #80 record set-up dose2<-c(7,8,9,10,11) doserep<-sort(...
2009 May 27
2
boxplot
Hi gues,   Is there any function in R for boxplot with different time points? t1 <- c(rep(1,20),rep(2,20)) t2 <- c(rep(1,10),rep(2,10),rep(1,10),rep(2,10)) x <- rnorm(40,5,1) dat <- data.frame(t1,t2,x) boxplot(x~t1,t2) Many thanks, Amor [[alternative HTML version deleted]]
2011 Apr 14
0
extract p-value from mixed model in kinship package
...fit mixed model with kinship matrix. The package looks like lme4, but I could find a way to extract p-value out of it. I need to extract is as I need to analyse large number of variables (> 10000). Please help me: require(kinship) Generating random example data id <- 1:100 dadid <- c(rep(0, 5), rep(1, 5), rep(3, 5), rep(5, 5), rep(7, 10), rep(9, 10), rep(11, 10), rep(13, 10), rep(15, 10), rep(17, 10), rep(19, 10), rep(21, 10)) momid <- c(rep(0, 5), rep(2, 5), rep(4, 5), rep(6, 5), rep(8, 10), rep(10, 10), rep(12, 10), rep(14, 10), rep(16, 10), rep(18, 10), rep(20, 10), rep(22,...
2019 Apr 23
1
Re: [nbdkit PATCH 7/7] nbd: Implement structured replies
On 4/22/19 7:50 PM, Eric Blake wrote: > Time to enhance the nbd plugin to request structured replies from the > server. For now, deal only with structured reads. The server can now > return sparse reads, even though we need nbdkit version 3 before we > can in turn return sparse reads back to the client. > > In general, we have to assume the server is malicious, and so we must &...