Skip to main content

Questions tagged [r-rownames]

The `rownames()` method in R is used to rename and replace the row names of a matrix-like object (incl. data frames) .

2 votes
5 answers
65 views

How to access row and column names (year and month) from a (monthly) time series, when rownames and colnames fail?

In monthly time series (frequency = 12), R prints out the years and months automatically, arranging them to look like row names and column names. But they are not accessible through rownames or ...
dolphingang's user avatar
0 votes
1 answer
38 views

Name matrix rows with a loop Stata

I have a matrix with dimensions of 4x2. I would like to name the rows with a loop. For example. From something like this: c1 c2 r1 0 0 r2 0 0 r3 0 0 r4 0 0 I would like this: ...
Luis M. García's user avatar
1 vote
2 answers
47 views

Ordering rows and columns of R Matrix

I have a matrix in R like this: bio1 bio10 bio11 bio12 bio13 bio14 bio15 bio16 bio17 bio18 bio19 bio2 bio3 bio4 bio5 bio6 bio7 bio8 bio9 bio1 1.00 0.90 0.91 -0.40 -0.21 -0.54 0.71 -0.22 -...
Burak Suiçmez's user avatar
0 votes
1 answer
145 views

Change row names in kable (RMarkdown)

I have produced the following table with kable package, in RMarkdown. Here's the dataframe: structure(list(...1 = c("Catalunya", "PIB", "Demanda interna1", "Demanda ...
Maria's user avatar
  • 309
2 votes
3 answers
126 views

How do I change the row names of multiple data frames in a list in R at once?

I have the following example list of data.frames: df <- data.frame(A = 1:10, B = 1:10) list1 <- list(df[1:3,],df[4:6,],df[7:10,]) [[1]] A B 1 1 1 2 2 2 3 3 3 [[2]] A B 4 4 4 5 5 5 6 6 6 [[...
theforestecologist's user avatar
0 votes
1 answer
215 views

Error of "incorrect number of dimensions" occurred when using lapply to a list of dataframes

I was dealing with a list of two dataframes. Both look this way. What I would like to do was to change the row names and column names so that they may look this way. Here is the code I used. # ...
B-WingBreaker's user avatar
0 votes
0 answers
51 views

R memory consumption when accessing object slot with row names

I have encountered a very strange memory behavior in R when accessing slots from a custom S4-class where I have applied row names to the object. Imagine I have the S4 class below with two identical ...
STHOH's user avatar
  • 289
0 votes
2 answers
119 views

How to set row names for inner levels in a nested list?

In the nested list below, I need to set row names to resource and the row names should be taken from bodyPart. I want this to be applied to all objects (e.g., obj1, obj2) obj1 <- list(resource = ...
Rara's user avatar
  • 193
1 vote
2 answers
183 views

Saving CSV files as tab delimited files while keeping the row names

I have a folder that is full of CSV files. Each file has genes as row names and samples as columns. I need them as TSV, so I saved each one of them as TSV and into a new path. This is the code: ...
Programming Noob's user avatar
0 votes
1 answer
40 views

how to filter dataframe based on rownames using strsplit

I have a dataframe: dput(gene_exp[1:5,1:5]) structure(list(en_Adipose_Subcutaneous.db = c(0.0531016390078734, -0.00413407782001034, -0.035434632568444, 0.00968736935965742, 0.0523714252287003), ...
rheabedi1's user avatar
0 votes
0 answers
36 views

R, create row and give it a name whist assigning data

I would like to know if it is possible with R, to create in one go a row, name it and assign it values. for example, I have. This df is named domain and I Have This df is named tactics and I would ...
barnabe malandain's user avatar
0 votes
0 answers
32 views

Is there a way to order the rows of a data frame droping in the same function the rownames?

When I order a data frame by the values of a column using the function "order", I get the rows reordered but they preserve rownames, which they are numbers if I am not using rownames in my ...
TLaguna's user avatar
  • 21
3 votes
3 answers
681 views

Get row names based on column values, R, multiple conditions

Using the sample data set mtcars head(mtcars) mpg cyl disp hp drat wt qsec vs am gear carb Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 Mazda RX4 Wag ...
M3Lba's user avatar
  • 119
0 votes
1 answer
239 views

Error of "non-unique values when setting 'row.names'", after setting explicit unique row names

here is a weird one: I am working on the following data frame: str(ccomb) 'data.frame': 358 obs. of 36 variables: $ Country.Name : chr "Albania&...
Leetram's user avatar
  • 15
2 votes
2 answers
196 views

gather() remove the row names of my dataframe. how can I have this row names?

when I use tidyr's gather() function and manipulate my dataframe, I lose row names of prev. data frame. this is output of my rstudio console > DF <- as.data.frame((freethrows/Games), row.names = ...
Reza Esmaeelzade's user avatar

15 30 50 per page
1
2 3 4 5
8