similar to: convert matrix to dataframe with repeating row names

Displaying 20 results from an estimated 6000 matches similar to: "convert matrix to dataframe with repeating row names"

2010 Mar 11
2
Can't convert list to matrix properly
Hi guys, here is a list of names that I have: MyList: > myList<-list("A", "B","C","D") > myList [[1]] [1] "A" [[2]] [1] "B" [[3]] [1] "C" [[4]] [1] "D" I want to turn this list into a matrix of 1 row and 4 columns with those four components (A, B, C, D) so here is what I do: myDataFrame <-
2001 Feb 05
4
Removing "row.names"
I need to completely remove row.names from a dataframe. Are there other ways to remove them (and not anything else) besides: mydataframe<-data.frame(mydataframe, row.names=NULL) I realize that this doesn't really remove the row.names; it merely replaces the current row.names vector with the numbers 1..nrow (in quotes). ===================== Dr. Marc R. Feldesman Professor and
2001 Feb 05
4
Removing "row.names"
I need to completely remove row.names from a dataframe. Are there other ways to remove them (and not anything else) besides: mydataframe<-data.frame(mydataframe, row.names=NULL) I realize that this doesn't really remove the row.names; it merely replaces the current row.names vector with the numbers 1..nrow (in quotes). ===================== Dr. Marc R. Feldesman Professor and
2002 Mar 21
5
repeating rows or columns within a matrix
Hello Spse I have a matrix, say 1 2 3 4 5 6 7 8 9 and I would like to expand it by repeating rows within the matrix, to get, if the repeating factor is 2, say: 123 123 456 456 789 789 (or columnwise as well) . There must be a smart way of doing that? Many thanks Juhana Vartiainen juhana.vartiainen at labour.fi -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
2012 Jul 31
2
Remove a complete row as per the Range in a Matrix
Hi, Here i have a Matrix MyMatrix <- Name Age --------- ------- ANTONY 27 IMRAN 30 RAJ 22 NAHAS 32 GEO 42 and here i have an array with Minimum and Maximum values. MinMaxArray <- data.frame(MIN = 25,MAX=35) MIN MAX ------ -------- 25 35
2012 Jul 19
2
problem with using apply for dataframe
Dear people, I am including an example of a dataframe: mydataframe<-data.frame(X=c(1:4),total_bill=c(16.99,10.34,21.01,23.68),tip=c(1.01,1.66,3.50,3.31),sex=c("Male","Male","Male","Female")) When I use the sapply function getting the information about the factors works: sapply(mydataframe,function(x)is.factor(x)) X total_bill tip
2010 May 15
1
Dataframe to word, using R2wd
Hi All, I'm trying to use R2wd to send a dataframe to Word. The dataframe isn't huge - 300 rows, 12 variables, although it has some long strings in it. Using: wdTable(format(myDataFrame)) or wdTable(myDataFrame) Produces a very complex table, which Word struggles to process and layout. (I can't work out what the table is - it seems to be nested tables. Converting to text gives
2003 Sep 23
3
number of distinct values in a dataframe
Hi R-users, How can I found the number of a distinct values in a data frame (occurrence of distinct values)? The dataframe consists of several thousands integer numbers. Thanks, Rado -- Radoslav Bonk M.S. Dept. of Physical Geography and Geoecology Faculty of Sciences, Comenius University Mlynska Dolina 842 15, Bratislava, SLOVAKIA tel: +421 905 968 127 e-mail: rbonk at host.sk
2007 Jan 24
1
how to change the dataframe labels' ?
? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070124/36f4b88b/attachment.pl
2012 Jan 13
3
access/row access/col access
Hello, I have a data.frame and I want to transfor it in a list of rows or columns. I can do apply(myDataFrame,MARGIN=1,FUN=???) I remember that there is a function which mean return or access column ... something like "::" or "]," or "[," I can't remember can somebody refresh my memory? -- View this message in context:
2011 May 20
3
Adding a numeric to all values in the dataframe
Hi there I just want to add 2 to all the values in dataframe. I tried using sapply but it seem to die all the time. Any help would be appreciated. Thanks Ramya -- View this message in context: http://r.789695.n4.nabble.com/Adding-a-numeric-to-all-values-in-the-dataframe-tp3537594p3537594.html Sent from the R help mailing list archive at Nabble.com.
2011 Apr 07
3
Correlation Matrix
Listers, I have a question regarding correlation matrices. It is fairly straight forward to build a correlation matrix of an entire data frame. I simply use the command cor(MyDataFrame). However, what I would like to do is construct a smaller correlation matrix using just three of the variable out of my data set. When I run this: cor(MyDataFrame$variable1,
2010 Feb 09
3
subset in a matrix
Hi, I have a matrix of data values like the example bellow. I would like to extract a subset of the matrix for the values where the first column is negative. I am using the subset function. However, I am getting an error message that the conditional variable doe snot exist. For some reason, the subset operation only works if I transform the matrix to a data set using as.data.set(). The help
2013 Jun 27
3
using "rollapply" to calculate a moving sum or running sum?
#using "rollapply" to calculate a moving sum or running sum? #I am tryign to use rollapply to calcualte a moving sum? #I tried rollapply and get the error message #"Error in seq.default(start.at, NROW(data), by = by) : # wrong sign in 'by' argument" #example: mymatrix <- ( matrix(data=1:100, nrow=5, ncol=20) ) mymatrix_cumsum <- ( matrix(data=NA, nrow=5,
2009 Jul 20
1
S4 method dispatch with inheritance
Hi, I'm trying to create a new S4 class (myMatrix) which for now just extends dgCMatrix (from package Matrix). Then I want to use "[" which is defined in Matrix. Out of the box with "[" (defined in Matrix) I lose the class information and the result is an object of class dgCMatrix. If I specify a "["-method for myMatrix, it is not used because a signature
2005 Jan 21
6
Avoiding a Loop?
Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant "const". The third column is the result of multiplying the second column with "const"..... So far, I did it like this (as a simplified example): nr.of.columns <- 4 myconstant <- 27.5 mymatrix <- matrix(numeric(0), nrow=5,
2005 Feb 21
3
Sorting a matrix on two columns
Hello, If a matrix with 5 columns has been defined and the first two columns need to be sorted in ascending order, how can this be achieved whilst ensuring the other 3 columns data are in relative position to the sorted columns? Glen Jones [[alternative HTML version deleted]]
2012 Mar 05
1
Error in file(fname, "r") : invalid 'description' argument when running maptools' readAsciiGrid on a dataframe
Hi, I'm trying to calculate a sum of differences between two ascii grids. I have the file names of the two grid files in a data.frame along with other data. I'm then trying to add a new column to the data.frame with the result of that calculation. eg. library(maptools) difcount <- function(surfA, surfB) { A <- readAsciiGrid(surfA, colname="a") B <-
2008 Jun 17
2
Reshape or Stack? (To produce output as columns)
Dear all, I have used 'read.table' to create a data frame of 720 columns and 360 rows (and assigned this to 'Jan'). The row and column names are numeric: > columnnames <- sprintf("%.2f", seq(from = -179.75, to = 179.75, length = 720)). > rnames <- sprintf("%.2f", seq(from = -89.75, to = 89.75, length = 360)) > colnames(Jan) <- columnnames
2009 Dec 08
1
problem with split eating giga-bytes of memory
I'm having trouble using split on a very large data-set with ~1400 levels of the factor to be split. Unfortunately, I can't reproduce it with the simple self-contained example below. As you can see, splitting the artificial dataframe of size ~13MB results in a split dataframe of ~ 144MB, with an increase memory allocation of ~10 fold for the split object. If split scales linearly, then my