Displaying 20 results from an estimated 3089 matches for "1,2".
2006 Feb 08
0
insert value according to indice
...ly those individuals with the specified value for that proportion.
Below is an example of the code that I am using. I have also attached the data file that I am using to create this dataframe.
#Read in Data
age.int <- read.csv('C:/intage.csv',header = TRUE)
asubs112 <- subset(age.int, rs1042364 != "(2,2)")
ages112 <- sort(unique(na.omit(asubs112$first_drink)))
for ( i in ages112) {
indce <- which(na.omit(asubs112$first_drink == i))
prop <- length(indce)/nrow(asubs112)
asubs112[indce,5] <- prop
asubs112[...
2001 Nov 13
1
Small change to "cut.default"
Hi everyone,
Can I suggest the following cosmetic change to cut.default (R-1.3.1), to
adjust the labels in the case that include.lowest = TRUE:
arrow:dma0jcr% diff -u cut.R my.cut.R
--- cut.R Tue Nov 13 12:28:35 2001
+++ my.cut.R Tue Nov 13 12:35:16 2001
@@ -25,6 +25,11 @@
ch.br[-nb], ",", ch.br[-1],
if(...
2006 May 15
1
Memory allocation fails in R 2.2.1 and R 2.3.0 on SGI Irix, while plenty of memory available (PR#8861)
Dear R developers,
We have a big SGI Origin computation server with 32 cpu's and 64 Gb of
RAM. In R 2.0.0 we could run large jobs, allocating 8 Gb of RAM was not
a problem, for example by running:
> v1 <- seq(1,2^29)
> v2 <- seq(1,2^29)
> v3 <- seq(1,2^29)
> v4 <- seq(1,2^29)
This yields an R process, consuming about 8 Gb of RAM:
PID PGRP USERNAME PRI SIZE RES STATE TIME WCPU% CPU% COMMAND
177484 177484 mirjam 20 8225M 8217M sleep 1:18...
2006 Feb 08
1
adding variable into dataframe by indice
...roportion.
Below is an example of the code that I am using. The data is made up for the dataframe. Should give you an idea, but the original has 'NA' in many rows. The original data is what is reported in the output below.
#Read in Data
age.int <- data.frame(IND_ID = seq(1, 140, 10), rs1042364 = sample( c("(1,1)","(1,2)","(2,2)"),14,replace = T),
first_drink = sample(5:17,14,replace = T))
asubs112 <- subset(age.int, rs1042364 != "(2,2)")
ages112 <- sort(unique(na.omit(asubs112$first_drink)))...
2009 Jul 30
4
truncating values into separate categories
Hi all,
Simple question which i thought i had the answer but it isnt so simple for
some reason. I am sure someone can easily help. I would like to categorize
the values in NP into 1 of the five values in "Per", with the last
category("4") representing values >=4(hence 4:max(NP)). The problem is that
R is reading max(NP) as multiple values instead of range so the lengths of
the labels and the breaks are not matching. Suggestions?
Per <- c("NA&q...
2009 Oct 02
3
help with regexp mass substitution
Hello *
i have to rename a lot of variables, and, given that they have regular name constructs, I would like to use regexps.
Here's a dump of my head(names(df))
varnames <- c("id.quest", "txt.1.3", "col1.1.3", "col2.1.3", "col3.1.3",
"col4.1.3", "col5.1.3", "txt.2.3", "col1.2.3", "col2.2.3", "col3.2.3",
"col4.2.3", "col5.2.3", "txt.3.3", "col1.3.3", &quo...
2006 May 15
0
Memory allocation fails in R 2.2.1 and R 2.3.0 on SGI Irix, (PR#8862)
On Mon, 15 May 2006, m.vroonhoven at erasmusmc.nl wrote:
> Dear R developers,
>
> We have a big SGI Origin computation server with 32 cpu's and 64 Gb of
> RAM. In R 2.0.0 we could run large jobs, allocating 8 Gb of RAM was not
> a problem, for example by running:
> > v1 <- seq(1...
2011 Nov 16
2
Error in random walk Metroplis-hasting
Hi R community,
I have some data set and construct the likelihood as follows
likelihood <- function(alpha,beta){
lh<-1
d<-0
p<-0
k<-NULL
data<-read.table("epidemic.txt",header = TRUE)
attach(data, warn.conflicts = F)
k <-which(inftime==1)
d <- (sqrt((x-x[k])^2+(y-y[k])^2))^(-beta)
p<-1 - exp(-alpha*d)
for(i in 1:100){
if(i!=k){
i...
2010 Nov 15
3
indexing lists
Hi List,
I'm trying to work out how to use which(), or another function, to find the
top-level index of a list item based on a condition. An example will clarify
my question.
a <- list(c(1,2),c(3,4))
a
[[1]]
[1] 1 2
[[2]]
[1] 3 4
I want to find the top level index of c(1,2), which should return 1 since;
a[[1]]
[1] 1 2
I can't seem to work out the syntax. I've tried;
which(a == c(1,2))
and an error about coercing to double is returned. I can find the index of
elements of...
2007 May 02
4
Terse Mocks
Hello,
I recently made a feature request with a patch for terser mocks.
http://rubyforge.org/tracker/index.php?func=detail&aid=10412&group_id=1917&atid=7480
Here are some examples with their current equivalents:
the_mock.expects.foo(1,2) {|a, b| :bar}
the_mock.expects.foo(1,2).returns(:bar)
the_mock.expects(:foo).with(1,2) {|a, b| :bar}
the_mock.expects(:foo).with(1,2).returns(:bar)
The patch is pretty simple too....
2007 Mar 08
2
Named backreferences in replacement patterns
Hi
I have a problem with substitutions involving named backreferences. I
have a vector American.dates:
> American.dates
[1] "5/15/1976" "2.15.1970" "1.9.2006"
which I want to change into British.dates:
> British.dates
[1] "15/5/1976" "15/2/1970" "9/1/2006"
I know I can do it like this:
British.dates<-sub("(\\d{1,2})\\D(\\d{1,2})\\D", "...
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...
2009 Dec 02
2
scatter3d with groups
...lass 'A' should be colourised red and data points in class
'B' should be colourised 'blue'. No matter what I try, the data points
are always blue.
I attached a (very) minimal example to reproduce my problem.
Thanks,
Philippe
library("Rcmdr")
scatter3d(x=c(1,2), y=c(1,2), z=c(1,2),
groups=as.factor(c(1,2)),
point.col=c('red','blue'), surface=F)
2012 Jul 02
4
how to do a graph with tree different colors??
hi
i try to do a graph of a time series which shows in red the values > -0.05,
in blue the values >0.05 and in white the values between -0.05 and 0.05
for un exemple :http://www.appinsys.com/globalwarming/enso.htm
thanks !!!!!
denisse
--
View this message in context: http://r.789695.n4.nabble.com/how-to-do-a-graph-with-tree-different-colors-tp4635206.html
Sent from the R help mailing
2014 Apr 11
2
crear variable en base a nombre de columnas que tienen un 1
Carlos, en principio si sería algo así, sólo que en vez de quedarme con
todas las columnas var1 a var4 tuviera sólo 3, ya que en mis datos no
hay ningún caso que tenga el valor 1 en más de 3 variables..
Había llegado a una solución (mucho menos elegante que usando reshape),
que implicaba un for sobre las filas.
Jorge, creo que tu solución me vale.
Muchas gracias a los dos..
Saludos
E...
2009 May 18
8
Simple plotting errors
Dear R Users,
I have 12 data frames, each of 12 rows and 2 columns.
e.g. FeketeJAN
MEAN SUM_
AMAZON 144.4997874 68348.4
NILE 5.4701955 1394.9
CONGO 71.3670036 21196.0
MISSISSIPPI 18.9273250 6511.0
AMUR 1.8426874 466.2
PARANA 58.3835497 13486.6
YENISEI...
2018 Jul 03
0
Inconsistencies when extracting with non-integer numeric indices near zero
Dear R-devel,
When I was playing around with different kind of indices when subsetting I noticed some unexpected behaviours when using non-integer numeric indices, especially near zero.
From the docs: ?Numeric values are coerced to integer as by as.integer<http://127.0.0.1:14277/help/library/base/help/as.integer> (and hence truncated towards zero).?
But some behaviour differs from that, and the behaviour also differs between [ and [[ :
c(1,2)[as.integer(.5)] --> numeric(0) # As expected
c(1,2)[.5] --> num...
2006 Apr 28
4
par(mfror=c(1,2))
dear list,
i have a problem using the par function.
in one graphic device i want to have two plots so i tried to use
par(mfror=c(1,2)).
of course it worked out, but the height now is twice the length of the width
for each single plot.
what i actually wanted is something like par(mfrow=c(2,2)) where only the
top (or bottom)
two plots are drawn with entire length proportions of 1 to 2 ( height 1,
width 2)
i want to create a pdf...
2013 Feb 18
3
Cortar una cadena por un caracter solo cuando no forma parte de una subcadena entrecomillada
Hola, ¿qué tal?
Tengo el siguiente problema. Me llegan (simplificando) cadenas del tipo
1,2,"algo"; 3,"cosa"; 4,2,3,7;
y tengo que partirlas por el caracter ";" para meterlas en una lista.
Lo hago con strsplit y no tengo problemas...
... hasta que recibo cadenas como
1,2,"algo;todo"; 3,"cosa"; 4,2,3,7;
en las que existen puntos y com...
2011 May 27
2
help with barplot
...3 columns. The first column represents an
"incident" type
The second column represents a "month"
The third column represents a "time"
Code for a sample data.frame
incidents <- rep(c('a','b','d','e'), each =25)
months <- rep(c(1,2), each =10)
times <-rnorm(100)
# make my sample data
DF <-
data.frame(Incidents=as.factor(incidents),Months=as.factor(months),Time=times)
# now calculate a mean for the "by" groups of incident type and month
pivot <-
aggregate(DF$Time,by=list(Incidents=DF$In...