similar to: Table manipulation question

Displaying 20 results from an estimated 2000 matches similar to: "Table manipulation question"

2002 Nov 04
3
write table and dinnames
I would write in tab-text file a table like this one: TAB colname1 TAB colname2 TAB TAB... colnameN rowname1 # # # rowname2 # # # rownameM # # # then I wrote something like: mymatrix <- matrix(nrow=M,ncol=N,byrow=T) rownames(mymatrix) <- chvector1 colnames(mymatrix) <- chvector2
2006 Feb 01
2
Write.table: change points to commas when object contains a row of characters
Dear Group! I asked write.table to change the decimal point from "." to "," , but apparently it would only do so if the object to be written does not contain any character elements. I would like to understand, why this has to be so and - of course - find a solution for my matrix object jjmat, that I tried to write out by write.table(jjmat, file="jjmat.txt",
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
2007 Mar 01
2
Query about data manipulation
Hi Thanks much for the prompt response to my earlier enquiry on packages for regression analyses. Along the same topic(?), I have another question about which I could use some input. I am retreiving data from a MySQL database using RODBC. The table has many BLOB columns and each BLOB column has data in the format "id1 \t id2 \t measure \n id3 \t id4 \t measure...." (i.e. multiple rows
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
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",
2011 Apr 25
2
Problem with ddply in the plyr-package: surprising output of a date-column
Hi Together, I have a problem 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,
2006 Jan 14
3
In place editing and external control
Dear all, First I''d like to thank authors for so nice Scriptaculous 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>
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
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
2012 Oct 12
3
Columns and rows
Hi, Could you please advice some easy way to do the following for a dataframe (header=F) having unequal column- & row- length. 1. Combine/stack/join contents from - a) multiple rows into one column. b) multiple columns into one row. 2. Stack contents from multiple columns (or, rows) into one column (or, row). Thank you. Cheers, Santana [[alternative HTML
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 to obtain : id
2010 Jun 03
2
deduplication
Colleagues, I am trying to de-duplicate a large (long) database (approx 1mil records) of diagnostic tests. Individuals 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
2006 Jan 24
9
Number of replications of a term
Hello, Is there a simple and fast function that returns a vector of the number of replications for each object of a vector ? For example : I have a vector of IDs : ids <- c( "ID1", "ID2", "ID2", "ID3", "ID3","ID3", "ID5") I want the function returns the following vector where each term is the number of replicates for the
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
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
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, if you have cases like the one
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 huge so looping with for and subsetting is not a
2012 Sep 15
5
create new variable with ifelse? (reproducible example)
Dear R users, I have a reproducible data and try to create new variable "clo" is 1 if know variable is equal to "very well" or "fairly well" and getalong is 4 or 5 otherwise it is 0. rep_data<- read.table(header=TRUE, text=" id1 id2 know getalong 100000016_a1 100000016_a2 very well 4 100000035_a1 100000035_a2 fairly
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",1,3,5