Displaying 16 results from an estimated 16 matches for "dat0".
Did you mean:
dat
2011 Mar 30
6
Quick recode of -999 to NA in R
Hi,
I am trying to write a loop to recode my data from -999 to NA in R. What's
the most efficient way to do this? Below is what I'm presently doing, which
is inefficient. Thanks,
Chris
dat0 <- read.table("time1.dat")
colnames(dat0) <- c("e1dq", "e1arcp", "e1dev", "s1prcp", "s1nrcp", "s1ints",
"a1gpar", "a1pias", "a1devt")
dat0[dat0$e1dq==-999.00000000,"e1dq"] <- NA...
2006 Sep 22
2
Merge problem
Hello all,
I have read as many merge issues as I possibly could tonight and
although I presume this is a small error, I have not found the
solution to my problem.
I'm trying to merge two data sets: dat0 and TransTable. As you can
see below, dat0 has 8000 rows, whereas TransTable has 47296 rows. I
would expect when I merge the two data sets, with all.x=F, and
all.y=F, that the intersection would yield 8000 rows, considering
dat0 is a subset of TransTable.
However, I get a neat little sur...
2006 Oct 18
1
MARS help?
...tally miss the obvious places for the knots in the apparent
first order spline model, and I wonder if someone can suggest a better
way to do this. The following example consists of a slight downward
trend followed by a jump up after t1=4, following by a more marked
downward trend after t1=5:
Dat0 <- cbind(t1=1:10,
x=c(1, 0, 0, 90, 99, 95, 90, 87, 80, 77))
library(mda)
fit0 <- mars(Dat0[, 1, drop=FALSE], Dat0[, 2],
penalty=.001)
plot(Dat0, type="l")
lines(Dat0[, 1], fit0$fitted.values,
lty=2, col="red")
Are there 'mars' options I...
2013 Feb 23
5
Selecting First Incidence from Longitudinal Data
I have a longitudinal competing risk data of the form:
ID COMPL SEX HEREDITY
1 0 1 2
1 0 1 2
1 3 1 2
2 0 0 1
2 1 0 1
2 2 0 1
2 2 0 1
3 0 0 1
3 0 0 1
3 0 0 1
3 0 0 1
3 2 0 1
4 0 1 2
4 0 1
2012 Dec 24
1
How to do it through 1 step?
...dd 2 variables,and call the new data set dat1:
var1:f = a/median(a)
var2:x_new = x*f
My solution:
dat1<-transform(dat,f = a/median(a),x_new = x*f)
But gets error reply which says that "f" is not exits since dat has no variables called "f".
So I have to do through 2 steps:
dat0<-transform(dat,f=a/median(a))
dat1<-transform(dat0,x_new=x*f)
How to do it through 1 step?
Many thanks!
[[alternative HTML version deleted]]
2010 Oct 01
1
add a new column to data frame
Hi, I am wondering if anyone can propose a simple/best way to do the following:
Let's say I have a data frame
dat <-
cbind(expand.grid(mode=c('right','left'),time=0:3,id=c('p1','p2','p3')),y=c(3,5,rep(4,6),6,2,rep(3,6),4,4,rep(2,6)))
dat
mode time id y
1 right 0 p1 3
2 left 0 p1 5
3 right 1 p1 4
4 left 1 p1 4
5 right 2
2002 Feb 20
3
Pointer to covariates?
In the first line, use the dist function, found in library mva,
to get the distance between each pair of rows. From this
calculate an incidence matrix for which element i,j is true if
row i in dat equals row j in dat (and false elsewhere).
In the second line, for each row calculate the indices of
the matching rows and take the minimum of those as the key.
incid <-
2011 Jun 23
2
Merging multiple data sets
Hi,
I am trying to merge data similar to the example data below
> dat0
id var1 var2 var3
2 1 0 1
3 1 0 1
4 0 1 1
5 0 1 1
> dat1
id var4 var5 var6
2 1 0 1
3 1 0 1
6 0 1 1
7 0 1...
2003 Feb 27
1
NA in dummy regression coefficients
Hi
I'm doing a regression analysis with dummy variables and I'm getting NA
for some coefficients. I've inspected residuals, leverage effects and
Cook's distance and it seems ok.
Can someone explains what can cause this problem ?
Thanks
EJ
2006 Aug 23
0
Random structure of nested design in lme
...o a great extend.
However, one of my response variables is survival of my plants, which is a binary variable (alive = 1; dead = 0). To analyze this case, I added family = "binomial" to the command line:
fit.lme4 <- lmer(binary.response~soiltype*habitat+(1|destination)+(1|origin), Dat0, family = "binomial")
> anova(fit.lme4)
Analysis of Variance Table
Df Sum Sq Mean Sq Denom F value Pr(>F)
soiltype 1 0.029 0.029 32.000 0.0238 0.8784
habitat 1 0.029 0.029 32.000 0.0238 0.8784
soiltype:habitat 1 0.062 0.062 32...
2016 Oct 27
4
Encontrar la primera columna no NA
...1:.N]
dat2=melt(dat,id.vars="jugador")
setkey(dat2,jugador)
dat2[,index:=min(which(!is.na(value))),by=jugador]
dat3 <- dat2[,list(First_month_Olivier
=variable[index[1]],Value_First_month_Olivier =value[index[1]]),by=jugador]
setkey(x = dat, jugador)
dat0 <- merge( x = dat, y = dat3, all.x = TRUE, all.y = FALSE)
},
times = N, unit = "s")
tabla %>% print
beepr::beep(3)
# Unit: seconds
# expr min lq mean median uq max
neval
# JVG 0.6479002 0.7518933 0.8673007 0.8216553 0.9137195...
2016 Oct 28
2
Encontrar la primera columna no NA
...,id.vars="jugador")
setkey(dat2,jugador)
dat2[,index:=min(which(!is.na(value))),by=jugador]
dat3 <- dat2[,list(First_month_Olivier
=variable[index[1]],Value_First_month_Olivier
=value[index[1]]),by=jugador]
setkey(x = dat, jugador)
dat0 <- merge( x = dat, y = dat3, all.x = TRUE, all.y = FALSE)
},
Adolfo = {
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...
2016 Oct 27
2
Encontrar la primera columna no NA
Otra solución algo más rapida:
> t <- Sys.time()
> dat[,jugador:=1:.N]
> dat2=melt(dat,id.vars="jugador")
> setkey(dat2,jugador)
> dat2[,index:=min(which(!is.na(value))),by=jugador]
> dat2[,.(First_month=variable[index[1]],Value_First_month=value[index[1]]),by=jugador]
jugador First_month Value_First_month
1: 1 Uno 0.93520715
2:
2013 Jun 07
4
matched samples, dataframe, panel data
I R-helpers
#I have a data panel of thousands of firms, by year and industry and
#one dummy variable that separates the firms in two categories: 1 if the firm have an auditor; 0 if not
#and another variable the represents the firm dimension (total assets in thousand of euros)
#I need to create two separated samples with the same number os firms where
#one firm in the first have a corresponding
2003 Mar 18
3
Tukey's HSD
...pected things happen. First, the function TukeyHSD works for all the
comparisons but the function simint doesn't. Second, after the application
of na.omit def2$EL and def4$EL report factor values which have been
omitted. Please inform me what I am doing wrong. Thank you very much.
Peter B.
dat0 <- read.table("prole4.txt",header=T)
nrow(dat0)
attach(dat0)
dat <-
data.frame(PRO,GRA,SOL,CEN,LAC,factor(NP),factor(TP),factor(SC),factor(PD),factor(EL))
names(dat) <- c("PRO","GRA","SOL","CEN","LAC","NP","TP"...
2012 Jun 24
0
nouveau _BIOS method
..... ..[..SMPB...S
5ff0: 42 41 52 0b 5b 80 53 4d 42 49 01 79 53 42 41 52 BAR.[.SMBI.ySBAR
6000: 0a 05 00 0a 10 5b 81 3a 53 4d 42 49 01 48 53 54 .....[.:SMBI.HST
6010: 53 08 00 08 48 43 4f 4e 08 48 43 4f 4d 08 54 58 S...HCON.HCOM.TX
6020: 53 41 08 44 41 54 30 08 44 41 54 31 08 48 42 44 SA.DAT0.DAT1.HBD
6030: 52 08 50 45 43 52 08 52 58 53 41 08 53 44 41 54 R.PECR.RXSA.SDAT
6040: 10 14 44 04 53 53 58 42 0a a0 07 53 54 52 54 a4 ..D.SSXB...STRT.
6050: 00 70 00 49 32 43 45 70 0a bf 48 53 54 53 70 68 .p.I2CEp..HSTSph
6060: 54 58 53 41 70 69 48 43 4f 4d 70 0a 48 48 43 4f TXSApiHCOMp...