The `rownames()` method in R is used to rename and replace the row names of a matrix-like object (incl. data frames) .
Questions tagged [r-rownames]
113 questions
1
vote
1 answer
How to set rownames of a data.frame?
I came across an issue when creating a data.frame. When I can create a data.frame, and set the appropriate row and column names.
Results looks like this:
row.names Africa ALPS Benelux
CS MRI Systems 92 151 130
CS Computed To 94 110…
Jasper Hillebrand
1
vote
1 answer
Convert object list to obtain rownames R
I am having trouble extracting rownames from an object.
When I type in rownames(object), I obtain "null", but if I type in object, I obtain the matrix of information. If it helps, when I type in class(object), it tells me that it is a list. What I…
user2105555
1
vote
1 answer
How to remove the rownames from the file
I have a file which looks like this..
"Locations" "X9442" "X5997"
"1" "cg00000957" 0.87 0.86
"2" "cg00001349" 0.78 0.78
"3" "cg00001583" 0.06 0.08
"4" "cg00002028" 0.01 0.01
I wish to remove the row names and make it look…

Letin
- 1,255
- 5
- 20
- 36
0
votes
1 answer
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.
# Create a list to hold both dataframes
list_info <-…
0
votes
0 answers
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 objects. The only difference is that for one of the…

STHOH
- 261
- 1
- 12
0
votes
2 answers
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 = list(bodyPart = c("leg", "arm", "knee"),side =…

Rara
- 105
- 9
0
votes
1 answer
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), en_Adipose_Visceral_Omentum.db = c(0, 0,
0, 0, 0),…

rheabedi1
- 65
- 7
0
votes
0 answers
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 like to combine both sort of like this
for(aptname…

barnabe malandain
- 11
- 2
0
votes
0 answers
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 data frame.
Example:
mydf <- data.frame(first_name=c("Arya",…

TLaguna
- 21
- 3
0
votes
1 answer
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" "Albania" "Albania" ...
$ Donor …

Leetram
- 15
- 4
0
votes
1 answer
How to name/title rownames in R
I have a dataframe named 'res', where the row names are numbers corresponding to genes.
>res
baseMean log2FoldChange lfcSE stat pvalue padj
…

claraina
- 63
- 5
0
votes
1 answer
row.names(x) versus row.names<- in lapply on a list of data frames
When I'm attempting to answer this question, I noticed that row.names(x) <- vector is not working when using lapply on a list of data frames, while row.names<- worked.
Here's some sample data, I'm attempting to append the names of the list to the…

benson23
- 16,369
- 9
- 19
- 38
0
votes
0 answers
Trouble converting Values in Column into Row Names of Data Frame in R
I am trying to convert the first column of a data frame as Row names.
It works fine but the names of the data frame format changes!
It changes from like 100-21-0 to X100.21.0
First column is Character values: Code, CBT, DQY, DQX etc.
and the names…

Zaman Muhammad Asad
- 19
- 4
0
votes
1 answer
Alignment of Rhandsontable's row names in Shiny
Is there a way to align the row names of a Rhandsontable in a Shiny app? I only found an argument to adjust the width (rowHeaderWidth), but not the alignment of the row names separately from the body of the table that I know can be done with…

CrisG
- 1
- 3
0
votes
1 answer
In R, replace rowvalues based on colname matching rowname in another column
I want R to replace rows with NA values if the column name matches the row name of another column. For instance, if individual 123 was last registered in array 6 (Very.last=Last.6), it will replace the time in Last.6 with NAs.
E.g.…

Lene
- 23
- 4