search for: dfrm

Displaying 20 results from an estimated 92 matches for "dfrm".

Did you mean: dfr
2011 May 16
2
conditional rowsums in sapply
Hi all I have a data frame with duplicate columns and i want to remove duplicates by adding rows in each group of duplicates, but have lots of NA's. Data: dfrm <- data.frame(a = 1:4, b= 1:4, cc= 1:4, dd=1:10, ee=1:4) names(dfrm) <- c("a", "a", "b", "b", "b") dfrm[3,2:3]<-NA dfrm a a b b b 1 1 1 1 1 1 2 2 2 2 2 2 3 NA NA NA 3 3 4 4 4 4 4 4 I did: sapply(unique(names(dfr...
2011 Jan 31
2
From data frame to list object
Dear all, let say I have following data frame: > data.frame(x=rnorm(18), y=rep(c("a", "b", "c"), each=6)) x y 1 -1.072152537 a 2 0.382985265 a 3 0.058877377 a 4 -0.006911939 a 5 -2.355269051 a 6 -0.303095553 a 7 0.484038422 b 8 0.733928931 b 9 -1.136014346 b 10 0.503552090 b 11 1.708609658 b 12 -0.294599403 b 13
2003 May 09
1
windows data editor changes dimensions displayed data frames
dear R-tists, i am experiencing a problem with the data editor in the windows version of R 1.6.1 envoked with the command 'fix'. the data editor changes the size of large data frames. a simple example illustrates this: ------------------------------------------------------- > dfrm <- data.frame(no=c(1:100000)) > length(dfrm[,1]) [1] 100000 > fix(dfrm) > length(dfrm[,1]) [1] 34464 -------------------------------------------------------- does anybody have a quick remedy for this? i am not sure whether it is worth putting much developmental effort in sol...
2011 Jan 31
2
Missing at random
R users: Thanks in advance  How to generate missing at random (MAR)? assaedi76@yahoo.com Thanks [[alternative HTML version deleted]]
2013 Mar 06
2
Fwd: How to conditionally remove dataframe rows?
Hi, I have a data frame with two columns. I need to remove duplicated rows in first column, but I need to do it conditionally to values of the second column. Example: Point_counts Psi_Sp 1 A 0 2 A 1 3 B 1 4 B 2 5 B 0
2011 Jul 15
3
summarized data set - how to use an "occurs" field
I have a data set with 22 fields and several thousand records in which one field (count) indicates the number of times that each specific combination of the other 21 fields occurred in a bigger and largely unavailable data set. So each record is unique in its combination of field values and has a field that identifies how many multiples of this record actually occurred. Without resorting to
2012 Mar 18
3
Extracting numbers from a character variable of different types
Hello, I have a file which contains a column with age, which is represented in the two following patterns 1. "007/A" or ''007/a" or ''7 /a" ..... In this case A or a means year and I would like to extract only the numeric values eg 7 in the above case if this pattern exits in a line of file. 2. "004/M" or "004/m" where M or m means month
2003 May 09
2
Re: [R] windows data editor changes dimensions displayed data frames (PR#2962)
...s you won't be able to edit big data frames (it looks like somewhere it's using a 16 bit row count), but it certainly shouldn't silently change things. Duncan Murdoch >a simple example illustrates this: > >------------------------------------------------------- > > > dfrm <- data.frame(no=c(1:100000)) > > length(dfrm[,1]) > >[1] 100000 > > > fix(dfrm) > > > length(dfrm[,1]) > >[1] 34464 > >-------------------------------------------------------- > > >does anybody have a quick remedy for this? > >i am not su...
2005 Dec 01
1
Kalman Smoothing - time-variant parameters (sspir)
...t? How do i Initialize the filter (i.e. what is appropriate to set m0, and C0 for the example below)? The model I want is: y = alpha + beta + err1; beta_(t+1) = beta_t + err2 I thought of the following: library(mvtnorm) # (1) library(sspir) # Let's get some data so we can all try this at home dfrm <- data.frame( y = c(0.02,0.04,-0.03,0.02,0,0.01,0.04,0.03,-0.01,0.04,-0.01,0.05,0.04, 0.03,0.01,-0.01,-0.01,-0.03,0.02,-0.04,-0.05,-0.02,-0.04,0,0.02,0, -0.01,-0.01,0.01,0.09,0.03,0.03,0.05,0.04,-0.01,0.05,0.03,0.01,...
2011 Jul 01
4
Access only part of last dimension of table/matrix
I would like to do some operations inside a function using only one value for the last dimension of a table/matrix: tabfn <- function (dfrm, facvec, YN ="event"){ return( Etbl <- do.call(table, dfrm[ , c(facvec, "event") ]) ) # just want Etbl[,,,"TRUE"] or Etbl[,, "TRUE"] or Etbl[,"TRUE"] } tbl <- tabfn(testdf, c("x", &qu...
2013 Mar 11
2
how to convert a data.frame to tree structure object such as dendrogram
I have a data.frame object like: > data.frame(x=c('A','A','B','B'), y=c('Ab','Ac','Ba','Bd')) x y 1 A Ab 2 A Ac 3 B Ba 4 B Bd how could I create a tree structure object like this: |---Ab A---| _| |---Ac | | |---Ba B---| |---Bb Thanks, Zech [[alternative HTML version deleted]]
2011 Mar 12
2
Merge data under conditions
Dear All, Debuting in R, I'm facing a problem. I have 2 vectors, say 'a' et 'b', and I'd like to merge them according to the proximity of their variable 'time'. How to do to keep elements which satisfy (for example) 'a$time-b$time<0.5'? For example : > a time x 1 1.0 4 2 2.2 5 3 5.2 6 > b time y 1 0 1 2 1 3 3 2 5 4 4 7 5
2010 Mar 16
2
Conditional variable assignment
Hi everyone, Once again I am stuck with a problem I can't seem to figure out. I suppose this learning curve levels off eventually, lol. I am learning on my own with absolutely no background in programming, so if I seem to request help a lot it's not because I am seeking others to do the work for me. I need to assign one of two arrival times to the 'ARRIVE' variable of my
2023 Oct 13
1
Create new data frame with conditional sums
...07,0.09,0.06,0.03),Totpop=c(4000,3500,4500,4100, 3900,4250,5100,4700, 4950,4800)) dfrm<-data.frame(matrix(ncol=2,nrow=0,dimnames=list(NULL,c("Cutoff","Pop")))) for (i in seq(0,0.15,by=0.01)) { temp<-sum(dummydata[dummydata$Pct>=i,"Totpop"]) dfrm[nrow(dfrm)+1,]<-c(i,temp) } Jason Stout, MD, MHS Division of Infectious Diseases Dept of Medicin...
2023 Oct 14
2
Create new data frame with conditional sums
...03),Totpop=c(4000,3500,4500,4100, > 3900,4250,5100,4700, > 4950,4800)) > dfrm<-data.frame(matrix(ncol=2,nrow=0,dimnames=list(NULL,c("Cutoff","Pop")))) > for (i in seq(0,0.15,by=0.01)) { > temp<-sum(dummydata[dummydata$Pct>=i,"Totpop"]) > dfrm[nrow(dfrm)+1,]<-c(i,temp) > } > > Jason Stout, MD, MHS > Division of I...
2010 Dec 24
4
Removing rows with earlier dates
Hi all, I'm new to the list but have benfited from it quite extensively. Straight to my rather strange question: I have a data frame that contains mapping rules in this way: ACCOUNT, RULE COLUMNS, Effective Date The dataframe comes from a database that stores all dates. What I would like to do is to create a data frame with only the most recent rule for each account. In traditional
2012 May 16
2
Splus equivalent of reshape in R
Hello R/Splus users.. I am posting in R discussion group in hope of wider response compared to what I received from Splus user groups.... Was wondering if there is any function available in Splus 8.2 that is equivalent to "reshape" of R? Below is a sample dataset. Size [both rows and columns) of the dataset may vary X1 Y1 Y2 Y3 0.25 40 38 22 0.5 44 41
2012 Feb 15
2
Splitting a data list into smaller data lists
Hi, I am new at R and have been looking for a guide on how to do this with no avail. I have a data set similar to this: X Y 1 2 3 3 4 9 2 4 6 3 9 1 1 7 0 2 5 6 3 8 and I need it to be split into something like this: X Y 1 2 3 3 4 9 2 4 6 3 X Y 9 1 1 7 0 2 5 6 3 8 I am thinking I need to write a loop because my data set is much larger than this
2011 Apr 12
2
bind mean to a df
Hello, I would like to take the mean of a column from a data frame and then bind the mean back to the data frame. I can do this using the following lines of code, but I am looking for a more elegant solution. Thank you very much. Geoff name <- c('Frank','Frank','Frank','Tony','Tony','Tony','Ed','Ed','Ed'); year <-
2010 Mar 12
5
Vertical subtraction in dataframes
Hello all, I have not been able to find an answer to this problem. I feel like it might be so simple though that it might not get a response. Suppose I have a dataframe like the one I have copied below (minus the 'calib' column). I wish to create a column like calib where I am subtracting the 'Count' when 'stain' is 'none' from all other 'Count' data for