search for: id1

Displaying 20 results from an estimated 175 matches for "id1".

Did you mean: id
2006 Sep 13
3
group bunch of lines in a data.frame, an additional requirement
Thanks for pointing me out "aggregate", that works fine! There is one complication though: I have mixed types (numerical and character), So the matrix is of the form: A 1.0 200 ID1 A 3.0 800 ID1 A 2.0 200 ID1 B 0.5 20 ID2 B 0.9 50 ID2 C 5.0 70 ID1 One letter always has the same ID but one ID can be shared by many letters (like ID1) I just want to keep track of the ID, and get a matrix like: A 2.0 400 ID1 B 0.7 35 ID2 C 5.0 70 ID1 Any idea on how to do that without a...
2012 Apr 14
3
Choose between duplicated rows
Dear r experts, Sorry for this basic question, but I can't seem to find a solution? I have this data frame: df <- data.frame(id = c("id1", "id1", "id1", "id2", "id2", "id2"), A = c(11905, 11907, 11907, 11829, 11829, 11829), v1 = c(NA, 3, NA,1,2,NA), v2 = c(NA,2,NA, 2, NA,NA), v3 = c(NA,1,NA,1,NA,NA), v4 = c("N", "Y", "N", "Y", "N&quot...
2008 Jul 09
2
Parsing
Dear R users, I have a big text file formatted like this: x x_string y y_string id1 id1_string id2 id2_string z z_string w w_string stuff stuff stuff stuff stuff stuff stuff stuff stuff // x x_string1 y y_string1 z z_string1 w w_string1 stuff stuff stuff stuff stuff stuff stuff stuff stuff // x x_string2 y y_string2 id1...
2010 Oct 12
5
aggregate with cumsum
Hello everybody, Data is myd <- data.frame(id1=rep(c("a","b","c"),each=3),id2=rep(1:3,3),val=rnorm(9)) I want to get a cumulative sum over each of id1. trying aggregate does not work myd$pcum <- aggregate(myd[,c("val")],list(orig=myd$id1),cumsum) Please suggest a solution. In real the dataframe is h...
2011 Apr 25
2
Problem with ddply in the plyr-package: surprising output of a date-column
...roblem with the plyr package - more precisely with the ddply function - and would be very grateful for any help. I hope the example here is precise enough for someone to identify the problem. Basically, in this step I want to identify observations that are identical in terms of certain identifiers (ID1, ID2, ID3) and just want to save those observations (in this step, without deleting any rows or manipulating any data) in a separate data.frame. However, I get the warning message below and the column with dates is messed up. Interestingly, the value column (the type is factor here, but if you chan...
2003 Nov 17
1
Generalized linear model
Hi all! I am fitting a Poisson model, using the following command: > fit2<-glm(canc~id1+year1+time+lnpa,family=poisson) where 'id1', 'year1' and 'time' are factors. I defined them with: > id1<-C(factor(id1), treatment) and 'lnpa' is a continuous variable. The 'summary' function gives me all the effects estimates, that is, for id1,...
2005 Nov 09
3
dataframe without repetition
Hello, with a data.frame like this : > toto <- data.frame(id=c("id1","id1","id2","id3","id3","id3"),dpt=c("13","13","34","30","30","30")) > toto id dpt 1 id1 13 2 id1 13 3 id2 34 4 id3 30 5 id3 30 6 id3 30 what is the most efficient ways...
2010 Sep 07
1
average columns of data frame corresponding to replicates
Hi Group, I have a data frame below. Within this data frame there are samples (columns) that are measured more than once. Samples are indicated by "idx". So "id1" is present in columns 1, 3, and 5. Not every id is repeated. I would like to create a new data frame so that the repeated ids are averaged. For example, in the new data frame, columns 1, 3, and 5 of the original will be replaced by 1 new column that is the mean of these three. Thanks for an...
2011 May 25
1
Subtracting rows by id
Dear R users, I have two datasets: id1 <- c(rep(1,10), rep(2,10), rep(3,10)) value1 <- sample(1:100, 30, replace=TRUE) dataset1 <- cbind(id1,value1) id2 <- c(1,2,3) subtract.value <- c(1,3,5) dataset2 <- cbind(id2, subtract.value) I want to subtract the number of rows in the subtract.value that corresponds to the i...
2013 Apr 12
1
Removing rows that are duplicates but column values are in reversed order
Hi, From your example data, dat1<- read.table(text=" id1?? id2?? value a????? b?????? 10 c????? d??????? 11 b???? a???????? 10 c????? e???????? 12 ",sep="",header=TRUE,stringsAsFactors=FALSE) #it is easier to get the output you wanted dat1[!duplicated(dat1$value),] #? id1 id2 value #1?? a?? b??? 10 #2?? c?? d??? 11 #4?? c?? e??? 12 But,...
2008 Jan 10
1
data.frame manipulation: Unbinding strings in a row
Hi all, I have a data.frame I received with data that look like this (comma separated strings in last row): ID Shop Items ID1 A1 item1, item2, item3 ID2 A2 item4, item5 ID3 A1 item1, item3, item4 But I would like to unbind the strings in col(2) items so that it will look like this: ID Shop Items ID1 A1 item1 ID1 A1 item2 ID1 A1 item3 ID2 A2 item4 ID2 A2 item5 ID3 A1 item1 ID3 A1 item3 ID3 A1 item4 Meaning each item is...
2007 Apr 20
2
Fastest way to repeatedly subset a data frame?
Hi - I have a data frame with a large number of observations (62,000 rows, but only 2 columns - a character ID and a result list). Sample: > my.df <- data.frame(id=c("ID1", "ID2", "ID3"), result=1:3) > my.df id result 1 ID1 1 2 ID2 2 3 ID3 3 I have a list of ID vectors. This list will have anywhere from 100 to 1000 members, and each member will have anywhere from 10 to 5000 id entries. Sample: > my.idlist[[&quo...
2006 Jan 14
3
In place editing and external control
...riptaculous and Prototype libraries, which helped me already a lot! I have question regarding externalControl parameter in InPlaceEditor. If I understand correctly, I can use that to have one image as a trigger to enter edit mode? I tried with below code but without success: <span id="id1">My text</span> <script type="text/javascript"> new Ajax.InPlaceEditor(''id1'', ''/object/o2499548.html?ajaxRequest&ajaxInPlaceEditing'', {externalControl:''id2''}) </script> <img id="id2&qu...
2005 Aug 10
1
Why only a "" string for heading for row.names with write.csv with a matrix?
Consider: > x <- matrix(1:6, 2,3) > rownames(x) <- c("ID1", "ID2") > colnames(x) <- c("Attr1", "Attr2", "Attr3") > x Attr1 Attr2 Attr3 ID1 1 3 5 ID2 2 4 6 > write.csv(x,file="x.csv") "","Attr1","Attr2","Attr3" "ID1&...
2010 Jun 03
2
deduplication
...in the database can have up-to 25 observations, but most will have only one. IDs for de-duplication (names, sex, lab number...) are patchy. In a first step, I am using Andreas Borg's excellent record linkage package (), that leaves me with a list of 'pairs' looking very much like this: id1<-c(4,17,9,1,1,1,3,3,6,15,1,1,1,1,3,3,3,3,4,4,4,5,5,12,9,9,10,10) id2<-c(8,18,10,3,6,7,6,7,7,16,4,5,12,18,4,5,12,18,5,12,18,12,18,18,15,16,15,16) id<-data.frame(cbind(id1,id2)) where a pair means that the records belong to the same individual (e.g., record 4 and record 8; 17 and 18...). My...
2011 Aug 02
2
Data frame to matrix - revisited
Hi, I've tried to look through all the previous related Threads/posts but can't find a solution to what's probably a simple question. ? I have a data frame comprised of three columns e.g.: ? ID1?ID2?Value a?b?1 b?d?1 c?a?2 c?e?1 d?a?1 e?d?2 ? I'd like to convert the data to a matrix i.e.: ? ?a b c d e a n/a 1 2 1 n/a b 1 n/a n/a 1 n/a? c 2 n/a n/a n/a 1 d 1 1 n/a n/a 2 e n/a n/a 1 2 n/a ? Any help is much appreciated, ? Jagz
2006 Mar 31
1
model comparison with mixed effects glm
I use model comparison with glms without mixed effects with anova(modelA,modelB), with mixed effects glm (glmmPQL), this doesn't work. Is there a way to compare model fits with glmmPQL's? Paula M. den Hartog Behavioural Biology Institute of Biology Leiden Leiden University [[alternative HTML version deleted]]
2012 Feb 22
1
Lattice and horizontally stacked density plots
...http://dsarkar.fhcrc.org/lattice/book/images/Figure_14_03_stdBW.png I am facing problems, however. Using the code example below, I'd like to generate a separate panel for each val of id2. Within each panel, I'd like to have individual histograms each on separate lines based on the value of id1. ?Note that the code example works fine if I use "boxplot" instead of "densityplot". Any pointers would be much appreciated. library(lattice) val<-rep(rnorm(10),100) id1<-sample(c(1:5), 100, replace = TRUE) id2<-rep(c(6:10),100, replace = TRUE) a_df<-data.frame(cbi...
2008 Sep 25
2
How to order some of my columns (not rows) alphabetically
Hello, I have a dataframe with 9 columns, and I would like to sort (order) the right-most eight of them alphabetiaclly, i.e.: ID1 ID2 F G A B C E D would become ID1 ID2 A B C D E F G Right now, I'm using this code: attach(data) data<-data.frame(ID1,ID2,data[,sort(colnames(data)[3:9])]) detach(data) but that's not very elegant. Ideally I could specify which columns to sort and which to leave "as is"...
2009 Dec 10
1
problem with data processing in R
Hi, I'm stuck with parsing data into R for heatmap representation. The data looks like: 1 id1 x1 x2 x3 .... x20 2 id1 x1 x2 x3 .... x20 3 id1 x1 x2 x3 .... x20 4 id1 x1 x2 x3 .... x20 ......... 348 id2 x1 x2 x3 .... x20 349 id2 x1 x2 x3 .... x20 350 id2 x1 x2 x3 .... x20 351 id2 x1 x2 x3 .... x20 ......... The data is sorted for the IDs (id1,id2 .....id40) and I like to produce...