similar to: Need help to split a given matrix is a "sequential" way

Displaying 20 results from an estimated 700 matches similar to: "Need help to split a given matrix is a "sequential" way"

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) dat12=complete(dat.mice,12)
2010 Oct 15
7
Problem with merging two zoo objects
Dear all, I have following 2 zoo objects. However when I try to merge those 2 objects into one, nothing is coming as intended. Please see below the objects as well as the merged object: > dat11 V2 V3 V4 V5 2010-10-15 13:43:54 73.8 73.8 73.8 73.8 2010-10-15 13:44:15 73.8 73.8 73.8 73.8 2010-10-15 13:45:51 73.8 73.8 73.8 73.8 2010-10-15 13:46:21 73.8 73.8 73.8 73.8
2008 Oct 08
1
Choose subset for plot use (bwplot)
Hello, this code below was from a helpful R-help user. dat <- read.csv("Resid_fix2.csv", sep="," , header=T) dat11 <- dat[1:413,] # convert ambiguous columns to factors: dat11$Pri_No <- factor(dat11$Pri_No) dat11$RecovUnit <- factor(dat11$RecovUnit) # plot: require(lattice) bwplot(bbED~ Pri_No | RecovUnit, data=dat11, as.table=TRUE, layout=c(4,1)) This works,
2011 Dec 22
5
Como calcular la media de una gran cantidad de flow.frame en un ciclo "for" ...
Queridos amigos tengo el siguiente problema: Tengo alrededor de 100 archivos del tipo flowFrame (datos de citometria) que he importado a R. Estos archivos tienen 6 columnas y 10.000 (diez mil) filas. Tengo que calcular el promedio de la quinta columna y graficarlo contra el promedio de la segunda columna. La segunda columna tiene el mismo valor para las 10.000 filas en cada archivo asi es que
2012 Aug 07
0
predicting test dataset response from training dataset with randomForest
Hi I am new to R so I apologize if this is trivial. I am trying to predict the resistance or susceptibility of my sequences to a certain drug with a randomForest function from a file with amino acids on each of the positions in the protein. I ran the following: > library(randomForest) > > path <- "C:\\..." > path2 <- "..." > name <-
2004 Nov 24
1
what does order() stand for in an lme formula?
I'm a beginner in R, and trying to fit linear models with different intercepts per group, of the type y ~ A*x1 + B, where x1 is a numerical variable. I cannot understand whether I should use y1 ~ x1 +1 or y1 ~ order(x1) + 1 Although in the toy example included it makes a small difference, in models with many groups the models without order() converge slower if at all!
2012 Dec 20
2
Filling Lists or Arrays of variable dimensions
Following problem: Say you have a bunch of parameters and want to produce results for all combinations of those: height<-c("high","low") width<-c("slim","wide") then what i used to do was something like this: l<-list() for(h in height){ l[[h]]<-list() for(w in width){ l[[h]][[w]] <- doSomething() } } Now those parameters aren't
2013 Sep 09
0
Duplicated genes
Hi, May be you can try this: dat1New<-? dat1[!(duplicated(dat1$gene)|duplicated(dat1$gene,fromLast=TRUE)),] dat2<-dat1[duplicated(dat1$gene)|duplicated(dat1$gene,fromLast=TRUE),] ?lst1<-split(dat2,dat2$gene) dat3<-unsplit(lapply(lst1,function(x) {x1<- sum(apply(x[,6:32],2,function(y) y[1]>=y[2]));x2<- sum(apply(x[,6:32],2, function(y) y[1]<=y[2])); if(x1>x2) x[1,] else
2009 Oct 10
1
Resultados distintos
Buenas tardes a todos, tengo un problema con R: ejecuto el mismo script en el ordenador del trabajo y en mi portátil con los mismos datos y obtengo resultados diferentes (siendo los correctos, los obtenidos en el trabajo): rm(list=ls()) directorio<-"C:\\Documents and Settings\\BDs\\" library(RODBC) library(car) library(gdata) ### DATOS A ###
2012 Dec 06
0
Summary command: Two independent variables against dependent.
Brilliant, thanks very much!! Works fine. Dan On 6 Dec 2012, at 18:25, arun kirshna [via R] wrote: > Hi, > Your question is not very clear. I hope you are not looking for the subset option in summary(lm()). > If you want just the summary(), then use '&' or '|' > For e.g. > dat1<-read.table(text=" > opcorn Oilamt Batch Yield >
2018 May 11
0
add one variable to a data frame
Sarah's solutions are good, and here's another, even more basic: tmp1 <- unique(dat1$B) tmp2 <- seq_along(tmp1) dat1$C <- tmp2[ match( dat1$B, tmp1) ] > dat1 N B C 1 1 29_log 1 2 2 29_log 1 3 3 29_log 1 4 4 27_cat 2 5 5 27_cat 2 6 6 1_log 3 7 7 1_log 3 8 8 1_log 3 9 9 1_log 3 10 10 1_log 3 11 11 3_cat 4 12 12 3_cat 4 As a single line
2008 Jan 14
1
Quick and Easy Question
All, Been a while since I''ve "mechanized" and I''m running into an idiot simple problem. I''m looking for more detailed examples to refresh my memory. My question is how to get a list of links off of a page based on information in the img src attribute, specifically if the img tag contains a "mp3.gif/jpg". I, for the life of me, can''t seem
2009 Apr 16
1
Connection to non-human numbers
Greetings listers, I've got 1.4.21.2 using Polycom 501 phones and Zap lines. Most of my calls come in and go out fine with the exception of Mechanized answering devices. When I call my 401K plan (1-800-777-401K) the call will last exactly one minute. The call never bridges, so even though the connection is made, Asterisk hangs up at the end of the Dial command.
2013 Mar 14
0
reshape
Hi Elisa, You need to check your data.? For some 'st', the data is repeated/duplicated (I am assuming, didn't check it) especially for a particular year. dat1<-read.csv("elisa.csv",sep="\t") dat1$st<- as.character(dat1$st) ?str(dat1) #'data.frame':??? 506953 obs. of? 5 variables: # $ st?????? : chr? "AGOMO" "AGOMO"
2013 Jan 02
0
Plot of Fine and Gray model
Dear all, Happy New year! I have used the 'crr' function to fit the 'proportional subdistribution hazards' regression model described in Fine and Gray (1999). dat1 is a three column dataset where: - ccr is the time to event variable - Crcens is an indicator variable equal to 0 if the event was achieved, 1 if the event wasn't acheived due to death or 2 if the event wasn't
2018 May 11
1
add one variable to a data frame
Um, maybe just dat1$C <- match(dat1$B, unique(dat1$B)) Indexing 1:k with numbers between 1 and k is a bit of a no-op... AFAICT, this even works without stringsAsFactors=FALSE -pd > On 11 May 2018, at 21:30 , MacQueen, Don <macqueen1 at llnl.gov> wrote: > > dat1$C <- seq(length(unique(dat1$B)))[ match( dat1$B, unique(dat1$B) )] -- Peter Dalgaard, Professor, Center for
2013 Jun 15
0
Calculate days with R
Hi, May be this helps: dat1<- read.table(text=" pbnr??????? dat? dep? dys? sop? ago? mis age female 1 10023 1994-02-21 0.75 1.00 0.50 0.50 0.75? 35????? 1 2 10023 1994-05-25 0.75 1.00 0.50 0.50 0.75? 35????? 1 3 10028 1994-02-01 2.00 1.75 3.00 0.50 1.50? 42????? 1 4 10028 1999-01-15 1.25 0.75 2.25 0.50 0.25? 42????? 1 5 10053 1994-03-16 2.50 0.75 1.25 0.50 1.25? 22????? 1 6 10053
2010 Jul 23
1
sink function
I have the following code to write the output from auto.arima function. The issue is not in finding the model but to divert its out put fit to a file order_fit.txt. code runs but nothing is written to order_fit.txt where am I going wrong library(forecast) for (i in 1:2) { filen = paste("file",i,".txt",sep="") data <- read.table(filen) dat1 <- data[,1] xt <-
2012 Nov 22
0
selcting a random sample and saving it in a seprate dataframe and also remaining part in other data frame
HI Madhu, I guess you got your solution from Rui: ?dat1<-data.frame(x=c(1,1,2,2,2,3,4,4,4),y=c(23,45,87,46,78,12,87,79,76)) s<-sample(unique(dat1[,1]),length(unique(dat1[,1]))*0.8) ?s #[1] 3 4 2 You can have a list containing both the dataframes list1<-list(dat1[dat1$x%in%s,],dat1[!dat1$x%in%s,]) list1 [[1]] #? x? y #3 2 87 #4 2 46 #5 2 78 #6 3 12 #7 4 87 #8 4 79 #9 4 76 #[[2]] ?# x? y
2013 Jan 21
1
Percentiles with R for a big data.frame
Dear R users, I came up to a problem dealing with percentiles in R. >From my previous questions: I do have a big data.frame, with lots of columns and rows. The following command enables me to calculate means for all data frame. dat1$newID<-rep(1:(nrow(dat1)/12),each=12) #if nrow(dat1)/12 is integer dat2<-with(dat1,aggregate(cbind(dat1[,1:71]),by=list(newID),mean)) What I need is to