search for: dat

Displaying 20 results from an estimated 5288 matches for "dat".

Did you mean: at
2011 Jul 02
5
How many times occurs
Hi all, I have a data matrix likein "input.txt" 8 9 2 5 4 5 8 5 6 6 8 9 2 8 9 2 8 9 2 1 8 9 2 5 4 5 8 5 6 4 8 9 2 5 4 5 8 5 6 6 8 9 2 8 9 2 8 9 2 1 8 9 2 5 4 5 8 9 2 2 In this example will be an 6x10 matrix (or data frame) I want to detect how many times in a row appears this combination 8 follewd by...
2005 Mar 29
5
pairewise plots
Dear R users, I have a data generated as the following, dat <- data.frame(matrix(sample(24), nrow=4)) dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'), colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH3","C_CH3")) » dat...
2005 Aug 01
6
converting stata's by syntax to R
I am struggling with migrating some stata code to R. I have a data frame containing, sometimes, repeat observations (rows) of the same family. I want to keep only one observation per family, selecting that observation according to some other variable. An example data frame is: # construct example data fam <- c(1,2,3,3,4,4,4) wt <- c(1,1,0.6,0.4,0.4,0.4,0...
2010 Aug 20
2
Problem with POSIXct in ave
Hi, I am having trouble using the ave function with a POSIXct object. For example: x<-Sys.time()+0:9*3600 dat<-data.frame(id=rep(c('a',' b','c'),each=10),dt=rep(x,3),i=rep(1:10,3)) dat # This is what I want to do: dat$time.elapsed<-unsplit(lapply(split(dat$dt,dat$id),function(x) x-x[1]),f=dat$id) dat # The above code does the trick, but from the standpoint of simplicity, the...
2014 Aug 28
2
problema al copiar datos de tipo caracter de un archivo a otro
Estimada comunidad, tengo un problema que no puedo resolver. Tengo muchos archivos (los llamaremos "TMP") con los que debo construir un archivo resumen que llamare "DAT". A partir de los nombres de los archivos TMP construyo las primeras 4 columnas de DAT, luego, con datos del interior del archivo TMP construyo las columnas 5 a 9 de DAT. El problema insoluble que tengo es que la columna 7 de DAT, se rellena a partir de la columna 9 de TMP. Sin embargo, cuan...
2011 Nov 27
1
Simplifying my code
Hi, I have a pretty simple problem. Here is the code: dat1=complete(dat.mice,1) dat2=complete(dat.mice,2) dat3=complete(dat.mice,3) dat4=complete(dat.mice,4) dat5=complete(dat.mice,5) dat6=complete(dat.mice,6) dat7=complete(dat.mice,7) dat8=complete(dat.mice,8) dat9=complete(dat.mice,9) dat10=complete(dat.mice,10) dat11=complete(dat.mice,11) da...
2012 Jul 22
2
Reading many large files causes R to crash - Possible Bug in R 2.15.1 64-bit Ubuntu
...rs that when I read these files with R 2.15.1 the process will hang or seg fault on the scan() call. This does not happen on R 2.14.1. This is happening on the precise build of Ubuntu. I have included everything, but the issue appears to be when performing the scan in the method parseTickData. Below is the code. Hopefully this is the right place to post. parseTickDataFromDir = function(tickerDir, per, subper, fun) { tickerAbsFilenames = list.files(tickerDir,full.names=T) tickerNames = list.files(tickerDir,full.names=F) tickerNames = gsub("_[a-zA-Z0-9].csv",&...
2013 Mar 28
4
bayesian HLM random effects
Hello, all. I've been working on this for sometime and was almost at the end/ last chunk of code i would need.... When I received an error. Rather than go to bed and think about it in the morning, I messed with my data and now I am not getting anything. I was up until 4am trying to fix this. Zip files of my data are attached (the data which ends in 'a' matches with wvsA and the data which ends in 'b' matches with my data code wvsB). my code is below. I can't even get plots, now. If i...
2006 Aug 02
2
lme4 and lmeSplines
I'm trying to use the lmeSplines package together with lme4. Below is (1) an example of lmeSplines together with nlme (2) an attempt to use lmeSplines with lme4 (3) then a comparison of the random effects from the two different methods. (1) require(lmeSplines) data(smSplineEx1) dat <- smSplineEx1 dat.lo <- loess(y~time, data=dat) plot(dat.lo) dat$all <- rep(1,nrow(dat)) times20 <- seq(1,100,length=20) Zt20 <- smspline(times20) dat$Zt20 <- approx.Z(Zt20, times20, dat$time) fit1.20 <- lme(y~time, data=dat, random=list(all=pdIdent(~Zt20-1))...
2005 Jan 31
2
changing the time base in a ts
...one above the other. When I do that as below the time series don't line up for reasons that are obvious. How can I change the base of the seasonal time series so I can make my plots line up? That is, I want the points for the seasonal plot to line up with cycle 6 of the first plot. Thanks. dat <- ts(rnorm(12*20), start = c(1980,1), frequency = 12) plot(dat) dat.sub <- dat dat.sub[cycle(dat.sub) < 6] <- NA dat.sub[cycle(dat.sub) > 8] <- NA dat.sub <- aggregate(dat.sub, nfrequency = 1, FUN = mean, na.rm = T) tsp(dat) tsp(dat.sub) par(mfrow = c(2, 1)) plot(dat) plot(dat...
2009 Aug 06
2
Ylim
Hello All: Can anybody tell me what is the problem with my program please. I have an error message as appears below. My program is: ifn <- "Jul08_09.LM" data <- read.table(ifn) ofn <- "Jul.png" bitmap(ofn, type = "png256", width = 30, height = 30, pointsize = 30, bg = "white",res=50) par(mar=c(5, 5, 3, 2),lwd=5) par(cex.main=1.6,cex.lab=1.6,cex.axis=1.6) par(mfrow = c(3,4)) ifn <- "T.dat" trait &lt...
2017 Jan 21
2
problema con grafico lattice ....
Hola, Por si lo quieres con colores rellenando cada punto: #---------------- library(data.table) library(lattice) dat <- read.table("pba.csv", header=TRUE, dec=",", as.is=TRUE) row.names(dat) <- NULL dat <- as.data.table(dat) dat$mycol <- ifelse(dat$sol =="ControlAE", "red", dat$sol) dat$mycol <- ifelse(dat$mycol =="Contro...
2012 Aug 07
2
Re-grouping data in R
I have a data frame with a column of values that I want to bucket (group) into specific levels. > str(dat)'data.frame': 3678 obs. of 39 variables: $ id : int 23 76 129 156 166 180 200 214 296 344 ... $ final_purchase_amount : Factor w/ 32 levels "\\N",&qu...
2015 Jan 22
5
Simulación de modelo logit con interacción
...es y comprobar si son o no parecidos al modelo teórico. Con este ejemplo obtengo que los coeficientes estimados no se asemejan mucho a los originales. ¿Se le ocurre a alguien cuál es el motivo de esta discrepancia? ¿y cómo solucionarlo? Muchas gracias Emilio logisticsimulation <- function(n){ dat <- data.frame(x1=sample(0:1, n,replace=TRUE), x2=sample(0:1, n,replace=TRUE)) odds <- exp(-1 - 4 * dat$x1 + 7*dat$x2 - 1 *dat$x1* dat$x2 ) pr <- odds/(1+odds) res <- replicate(100, { dat$y <- rbinom(n,1,pr) coef(glm(y ~ x1*x2, data = dat, family = bi...
2017 Sep 27
1
need held in r coding.
Need Help in Debugging below script:-------------------------------- dat <- get_majorlandmarks(dat,Dmin,Per) fit_xts <- xts(dat$fit,order.by = dat$Date,frequency = 365) close_xts <- xts(dat$Close, order.by = dat$Date, frequency = 365 ) majorlandmarks_xts <-xts(dat$Close[dat$majorlandmarks==TRUE], order.by = dat$Date[dat$majorlandmarks==TRUE], frequency = 365...
2011 Nov 01
3
factor level issue after subsetting
Dear list, I cannot figure out why, after sub-setting my data, that particular item which I don't want to plot is still in the newly created subset (please see example below). R somehow remembers what was in the original data set. A work around is exporting and importing the new subset. Then it's all fine; but I don't like this idea and was wonde...
2005 Jun 27
2
simplifying the code
dear list: I need help to achieve a simpler code to complete a task I'm performing. here is an example: dat<-expand.grid(a=seq(1,5),b=seq(1000,1005)) I want to add a new column dat$c in that: t1<-ifelse(dat$a==1&dat$b==1001,1001,0) t2<-ifelse(dat$a==2&dat$b==1002,1001,0) t3<-ifelse(dat$a==3&dat$b==1003,1001,0) t4<-ifelse(dat$a==1&dat$b==1002,1002,0) t5<-ifelse(dat$a==2...
2011 Jun 17
3
rle on large data . . . without a for loop!
I think need to do something like this: dat<-data.frame(state=sample(id=rep(1:5,each=200),1:3, 1000, replace=T,prob=c(0.7,0.05,0.25)),V1=runif(1,10,1000),V2=rnorm(1000)) rle.dat<-rle(dat$state) temp<-1 out<-data.frame(id=1:length(rle.dat$length)) for(i in 1:length(rle.dat$length)){ temp2<-temp+rle.dat$length[[i]] out$V1[i]&l...
2009 Mar 08
0
ARIMA second order differencing problem
Hi, I have been using this site ( http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm) to help me with some ARIMA modelling in R. Unfortunately the methods mentioned do not appear to work with second order differencing; arima(*, 2, *). I have used some dummy data to illustrate my point. When I use the xreg=... method, the estimate of intercept is *way* off. This can be seen by the high s.e but I *have* checked it in SPSS. This in turn gives the wrong t and p values (using the data that I'm actually working with; these are NaNs). Despite this problem,...
2012 Mar 20
3
error message
Dear all,  Who will bail me out. Iam using R with S-Splancs. Anytime i typed in the syntex, an error will appear eg setwd("C:\\TEMP) >dat <- read.table(cheshire_fmd.cvs",header=TRUE, sep=",") > dat.<-read.table(''chesire_fmd.cvs'',header=TRUE,sep='',) Error: unexpected symbol in "dat.<-read.table(''chesire_fmd.cvs" > dat$x.km <-dat$xcoord/1000 Error: object ...