similar to: How to retrieve a column name of a data frame

Displaying 20 results from an estimated 30000 matches similar to: "How to retrieve a column name of a data frame"

2010 Jan 08
3
Print data frame as list including row/column name
Hi all, I have the following problem: I have a data frame (actually it is a prop.table) which I want to print as a list, e.g.: C1 C2 C3 R1 0.0 0.0 1.0 R2 1.0 0.0 0.0 R3 0.0 0.0 0.0 R4 0.0 1.0 0.0 should be printed like C1;R1;0.0 C2;R1;0.0 C3;R1;1.0 C1;R2;1.0 C2;R2;0.0 ..... Is there any existing solution out there or could somebody please give me a hint on how to
2009 Jul 01
1
How should I denormalise a data frame list of lists column?
Hi, I have a data frame where one column is a list of lists. I would like to subset the data frame based on membership of the lists in that column and be able to 'denormalise' the data frame so that a row is duplicated for each of its list elements. Example code follows: # The data is read in in this form with the c2 list values in single strings which I then split to give lists: > f1
2013 Mar 14
2
Modifying a data frame based on a vector that contains column numbers
Hello! # I have a data frame: mydf<-data.frame(c1=rep(NA,5),c2=rep(NA,5),c3=rep(NA,5)) # I have an index whose length is always the same as nrow(mydf): myindex<-c(1,2,3,2,1) # I need c1 to have 1s in rows 1 and 5 (based on the information in myindex) # I need c2 to have 1s in rows 2 and 4 (also based on myindex) # I need c3 to have 1 in row 3 # In other words, I am trying to achieve this
2012 Jan 06
4
data.frame: temporal complexity
Hello, I created a data.frame which contains two columns: df$P (Power) et df$DateTime (time). I'd like to add a new column df$diffP (difference of Power between T and T-2). I made a loop : for (i in 3:length(df$DateTime)){ df$diffP[i] = df$P[i] - df$P[i-2] } execution time result is unaceptable: 24s !! Is there any way to reduce complexity about O(n) ? for example 2 or 3s (10s maxi)
2009 May 07
2
Matching multiple columns in a data frame
Hello, I am trying to extract a subset of a dataframe A (2 columns) by extracting all entries in A (several repeated entries) that match dataframe B in both columns. For example, part of A and B are shown below. The following does not seem to work correctly. This only seems to select on the first component and all instances of the second. ind <- A$C1 %in% B[,1] & A$C2 %in% B[,2]
2012 Jul 10
1
cbind and cbind.data.frame
## Hi, I'm having trouble understanding how the cbind function decides what method to apply to its arguments. Easy cut and paste code below. > > > > ## create two columns > c1 <- c("A","A","B","B") > c2 <- 1:4 > > ## cbind outputs a matrix with elements that are characters, seems reasonable > out <-
2018 Feb 21
3
Aggregate over multiple and unequal column length data frames
Hi All-- I have generated several 2 column data frames with variable length. The data frames have the same column names and variable types. I was trying to aggregate over the 2nd column for all the date frames, but could not figure out how. I thought i could make them all of equal length then combine them in 1 data frame where i can use aggregate, the formula version Or to put them in a list and
2007 Nov 22
1
Summary: Process multiple columns of data.frame
Thank you Jim Holtman and Mark Leeds for your help. Original question: >How do I do the following more concisely? > Bout[is.na(Bout$bd.n), 'bd.n'] <- 0 > Bout[is.na(Bout$ht.n), 'ht.n'] <- 0 > Bout[is.na(Bout$dbh.n), 'dbh.n'] <- 0 >. . . Solution: for (i in c('bd.n', 'ht.n', 'dbh.n')) Bout[is.na(Bout[[i]]), i] <- 0 Toy
2012 Feb 03
4
how to plot several curves in the same frame
Hello, I'd like to know how to plot several curves in the same frame (1curve = 1line=1day). For instance (csv file): 2012-02-01 01:00:00; 2100 2012-02-01 02:00:00; 2200 ... 2012-02-01 23:00:00; 2500 2012-02-02 01:00:00; 1000 2012-02-02 02:00:00; 1500 ... 2012-02-02 23:00:00; 1700 Here, I have to plot 2 curves in the same frame: 1 for 2012-02-01 (on the first line) and 1 for 2012-02-02 (on
2010 Feb 18
1
aggregate by column names
Hi, I've this dataframe: V1 V5 V6 1 MOD13Q1_2000049 0.1723 A1 2 MOD13Q1_2000049 0.1824 B1 3 MOD13Q1_2000049 0.1824 C1 4 MOD13Q1_2000049 0.1774 A2 5 MOD13Q1_2000049 0.1953 B2 6 MOD13Q1_2000049 0.1824 C2 7 MOD13Q1_2000065 0.1921 A1 8 MOD13Q1_2000065 0.1938 B1 9 MOD13Q1_2000065 0.2009 C1 10 MOD13Q1_2000065 0.2035 A2 11 MOD13Q1_2000065 0.2157 B2 12
2012 Jan 27
1
multiple column comparison
Hello, I have a very large content analysis project, which I've just begun to collect training data on. I have three coders, who are entering data on up to 95 measurements. Traditionally, I've used Excel to check coder agreement (e.g., percentage agreement), by lining up each coder's measurements side-by-side, creating a new column with the results using if statements. That is, if
2009 Sep 16
1
How to convert a frame to a matrix while maintaining that a number is still a number?
Hi, See the code below. 'x' is a frame. x$C1 are all numbers 1, 2 and 3. 'as.matrix(x)' convert x$C1 to strings "1", "2" and "3". I'm wondering how to maintain that the first column of 'as.matrix(x)' still numbers. Regards, Peng $ cat read.csv "C1","C2" "1","x" "2","y"
2007 Jul 31
5
extract columns of a matrix/data frame
Hello all, I have a matrix whose column names look like a1 a2 b1 b2 b3 c1 c2 1 2 3 7 1 3 2 4 6 7 8 1 4 3 Now, I can have any number of a's. not just two as shown above and same goes for b's and c's. I need to extract all the a's columns and put them in another matrix, extract all b's columns and put them in some matrix
2018 Feb 23
0
Aggregate over multiple and unequal column length data frames
Hi Your example is rather confusing - partly because HTML formating, partly because weird coding. You probably could concatenate your data frames e.g. by rbind or merge and after that you could try to aggregate them somehow. I could construct example data.frames myself but most probably they would be different from yours and also the result would not be necessary the same as you expect. You
2012 Feb 27
2
kmeans: how to retrieve clusters
Hello, I'd like to classify data with kmeans algorithm. In my case, I should get 2 clusters in output. Here is my data colCandInd colCandMed 1 82 2950.5 2 83 1831.5 3 1192 2899.0 4 1193 2103.5 The first cluster is the two first lines the 2nd cluster is the two last lines Here is the code: x = colCandList$colCandInd y = colCandList$colCandMed m = matrix(c(x, y),
2009 Feb 02
2
concatenating 2 text columns in a data.frame
Hi, I'm trying to concatenate values from two columns in a data frame. For example, I have the following data.frame: C1 C2 C3 C4 C5 A B *F C* Q G H *I J* T K D *R S* E P L *M N* O I'd like to concatenate text from columns C3 and C4, to yield either a list or vector, like so: NewCol FC IJ RS MN Is this feasible in R? Thanks!
2015 Dec 19
2
[PATCH] nvc0: add hardware ETC2 and ASTC support where possible
These are supported on GK20A and GM107. Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> --- Was a bit torn on where to place the enums... we're about to gut all the xml definitions so this seemed appropriate for now. Tested on GK20A only. src/gallium/drivers/nouveau/nv50/nv50_formats.c | 64 +++++++++++++++++++++++++ src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 10 ++++
2016 Feb 15
1
[PATCH 09/23] nv50-: separate vertex formats from surface format descriptions
Why not fix the new names instead to be like the old names? Seems like that would be way simpler... On Feb 15, 2016 12:38 AM, "Ben Skeggs" <skeggsb at gmail.com> wrote: > From: Ben Skeggs <bskeggs at redhat.com> > > We've previously had identical naming between vertex and texture > formats, so it mostly made sense to define these together. > > However,
2015 Apr 15
2
[LLVMdev] Instruction combiner multiplication canonicalization
Hi, I observed below behavior with Instruction combiner (visitMul Canonicalization) It tries to convert "(X+C1)*C2" to "X*C2+C1*C2" While transforming if operation is guaranteed to not overflow it does not reflect same property to transformed instructions. Consider following scenarios: 1) If input is ((X+C1)*C2)<nsw> Then post canonicalization output should be
2018 Feb 27
3
Aggregate over multiple and unequal column length data frames
Thank you Pikal and Bert. My apology for posting parts of my previous email in HTML. Bert's suggestion will work but i am wondering if there is an alternative especially in the case where the data frames are big; that is the difference in lengths among them is large. Below is a list of sample date frames and desired result. EK