search for: rep

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

Did you mean: ref
2008 Mar 19
1
betabinomial model
...ives warnings as well as error and if i use NLMINB then convergence is false. Can someone save my soul..... pl!!!!!!!!z below is my program script .............. #ovarian cancer data and parity among 769 probands and their mothers #cancer in proband y1<-c(1,1,1,1,1,1,1,rep(1,29),rep(1,36),rep(1,41),r! ep(1,85),rep(1,105),rep(1,84), 1,rep(0,22),rep(0,33),rep(0,38),rep(0,50),rep(0,103),rep(0,135)) #cancer in mother y2<-c(1,1,1,1,1,1,1,rep(0,29),rep(0,36),rep(0,41),rep(0,85),rep(0,105),rep(0 ,84), 1,rep(0,22),rep(0,33),rep(0,38),rep(0,50),rep(0,...
2004 Mar 29
4
strange thing with sd
Dear R people I came across a strange thing: sd(rep(0.01, 15)) #0 sd(rep(0.001, 15)) #4.489023e-19 sd(rep(0.00001, 15)) #0 sd(rep(0.00000001,15)) #1.712427e-24 sd(rep(0.01, 13)) #1.805557e-18 sd(rep(0.001, 13)) #4.513894e-19 sd(rep(0.00001, 13)) #0 sd(rep(0.00000001,13)) #0 sd(rep(5.01, 15)) #0 sd(rep(5.001, 15))...
2007 Aug 30
2
Assigning line colors in xyplot
...uot; or "B" (grouping variable "f"): set.seed(1) tmp <- data.frame( y=c(rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2),rnorm(10,0,1),rnorm(10,4,2)), x=1:10, f=c(rep("A",10),rep("B",10),rep("A",10),rep("B",10),rep("A",10),rep("B",10),rep("A",10),rep("B",10),rep("A",10),rep("B",10),rep("A",10),rep("B",10)), g=c(rep("3",10),rep(...
2005 Dec 06
2
Constructing a transition matrix
Hi, I would like to construct a transition matrix from a data frame with annual transitions of marked plants. plant<-c(1:6) class<-c("seed","seed", "seed", "veg", "rep", "rep") fate<-c("dead", "veg","veg","rep", "rep", "veg") trans<-data.frame(plant, class, fate) plant class fate 1 1 seed dead 2 2 seed veg 3 3 seed veg 4 4 veg rep 5 5 rep rep 6...
2007 Sep 15
0
Question about VarSelRF
...at = 100, vars.drop.frac = 0.2) error in randomForest.default(x = xdata, y = Class, ntree = ntree, mtry = mtry, : length of response must be the same as predictors My code is: library(varSelRF) exprSet <- as.matrix(read.table('varSelRF_x.txt',header = FALSE)) cl <- factor(c(rep("C", 2), rep("D", 2), rep("B", 1), rep("A", 1), rep("D", 1), rep("B", 1), rep("C", 2), rep("B", 1), rep("D", 1), rep("A", 1), rep("D", 2), rep("B", 1),rep("A", 1),rep(&q...
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 Apr 25
3
Noobie question on aggregate tapply and by
I have a 43MB dataframe ( 5 variables) and I'm trying to summarize subsets of the data. I've RTFM ( not very clear) and looked at a variety of samples but cant seem to figure out how to make these functions work. A sample of what I want to do would be this: ids<-seq(1,50) years<-c(rep(5,10),rep(6,10),rep(7,10),rep(8,20)) data<-c(rep(23.2,7),rep(14.2,17),rep(29.2,6),rep(13.4,10),rep(16.3,5), NA, rep(40,4)) data2<-c(rep(22.2,5),rep(13.2,8),NA, rep(29.8,16),rep(12.4,10),rep(16.3,5), rep(38,5)) DF<-data.frame(ids,years,data,data2) That will give you a dataframe that is a...
2010 Jul 03
2
logistic regression - glm() - example in Dalgaard's book ISwR
...# by means of 'reconstructed' variables ## variables with names beginning with 'r' are ## 'reconstructed' from data in data.frame d. ## The objective is to reconstruct the original ## data from which the table on Dalgaard's page 229 ## has been produced rsmoking <- c(rep('No',d[1,4]),rep('Yes',d[2,4]), rep('No',d[3,4]),rep('Yes',d[4,4]), rep('No',d[5,4]),rep('Yes',d[6,4]), rep('No',d[7,4]),rep('Yes',d[8,4])) rsmoking <- factor(rsmoking) length(rsmoking)...
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...
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,...
2005 Aug 31
3
generic function argument list problem
Hi it says in R-exts that A method must have all the arguments of the generic, including ... if the generic does. A method must have arguments in exactly the same order as the generic. A method should use the same defaults as the generic. So, how come the arguments for rep() are (x, times, ...) and the arguments for rep.default() are (x, times, length.out, each, ...) ? Shouldn't these be the same? I am writing a rep() method for objects with class "octonion", and my function rep.octonion() has argument list (x, times, length.out, each, ...) ju...
2008 Jun 17
2
R error using Survr function with gcmrec
...#39;m receiving an error after using the Survr function that all data must have a censoring time even after using the gcmrec function: newdata<-addCenTime(olddata). My program is below. I'd greatly appreciate any help! id<-c(seq(1,288,by=1),seq(1,79,by=1),seq(1,11,by=1)) x<-c(rep(0,5),rep(1,6),rep(0,45),rep(1,23),rep(0,124),rep(1,85), +rep(0,4),rep(1,1),rep(0,1),rep(1,5),rep(0,31),rep(1,14),rep(0,5), +rep(1,18),rep(0,8),rep(1,3)) myrates<-((1-x)*0.0639 + (x)*0.0320) y<-c(rexp(378,rate=myrates)) cen<-c(rexp(378,0.0385)) time<-pmin(y,cen) event<-as.numeric(...
2013 Feb 19
3
creating a new variable.
hello, all. in my previous research, i have always used existing data. i am trying something new as an exploratory exercise and have never create my own variable form scratch. essentially, i am creating a variable for party affiliation. here is an example. var =party. levels= democrat, republican, other. respondents will indicate which category they fall under. for the sake of ease, i will use small data as an example. i was thinking the levels would need to be created first- dem <- c(1,1,1,1,0,0,0,0) rep <- c(1,1,1,0,0,0,0,0) other <- c(1,0,0,0,0,0,0,0) then, i could...
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...
2006 Feb 01
1
glm-logistic on discrete-time methods with individual and aggregated data
Dear R-Users, without going into details I tried to prepare a simple example to show you where I would need help. In particular I prepare two examples-template for a study I'm conduction on discrete-time methods for survival analysis. Each of this example has two datasets which are basically equal, with the exception that in the former one has indivi...
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...
2000 Mar 01
2
Help please..
...-world, I am facing a peculiar problem and hope someone out there can comment on it. In goodness-of-fit tests for evaluation of distributions, there are three well-known methods: 1. Chi-square 2. Anderson-Darling 3. Kolmogorov-Sminrov I am trying to use the second test. Many researchers have reported results using this test. I wrote programs in C and now in R to do this. I run into serious problems. I am enclosing the R program and the outputs I get. My comments are embedded in the program text itself. Can anyone help me out please ?? I am aware that this test fails in real life cases whe...
2011 Nov 08
3
ggplot2 reorder factors for faceting
...s heatmap I have faceted my data by 'infection' of which I have four. These four infections break down into two types and I would like to reorder the 'infection' column of my data to reflect this. Toy example below: library(ggplot2) # test data for ggplot reordering genes <- (rep (c(rep('a',4), rep('b',4), rep('c',4), rep('d',4), rep('e',4), rep('f',4)) ,4)) fcData <- rnorm(96) times <- rep(rep(c(2,6,24,48),6),4) infection <- c(rep('InfA', 24), rep('InfB', 24), rep('InfC', 24), rep('InfD...
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 , numero /1...
2007 Oct 22
1
plot3d with more than 8 colors
Hello R user and helper! I would like to get a 3d plot with coloured points. I did that: colors<-c(rep("2",7), rep("3",12), rep("4", 24), rep("5", 13), rep ("6", 8), rep("7", 51), rep("8", 1), rep("9", 15), rep("10", 53), rep ("11",3), rep("12",3), rep("13", 8), rep("14&quot...