All Questions
430 questions
-2
votes
2
answers
60
views
Edit row and column names in a transposed data frame
I have a dataframe that I have successfully transposed using the t function present in base R. However I'd like to change the column names and row names to be part of the dataframe. I'll use the iris ...
0
votes
1
answer
56
views
How do I transpose a dataframe properly in R [duplicate]
I am struggling with what I hope is a fairly basic problem in transposing a dataframe.
My dataframe has a structure like this:
Measure = c("Heightpercentile", "Weightpercentile", &...
0
votes
2
answers
37
views
Transforming Categorical Column into Binary Columns in R Based on Multiple Conditions
I have a dataframe with two columns in R. One of the columns (column1) has three possible values (A, A and B, B).
The rows are patients.
I want to tranpose the column1, so I'd have binary columns (Yes,...
0
votes
1
answer
44
views
Converting / transposing a crosstab of nominal variables to a dataframe with single cases in r
I have a cross table saved in Excel with information about employees and how many times they were on a given shift.
> my_data
...1 night day
1 jeff 2 3
2 stan 3 2
3 annie 1 4
...
3
votes
2
answers
54
views
Transposing dataset with repeated / incomplete observations in R
I have the following dataset:
Pt_ID vital_descr vital_value
1 HR 70
1 SBP 110
1 DBP 75
1 HR NA
1 SBP 105
1 DBP 60
2 SBP 150
2 DBP 90
3 HR 55
3 SBP 150
3 DBP 70
3 ...
0
votes
1
answer
27
views
Transform content of a row into columns in r [duplicate]
I have a dataframe named "Num_casos_Sar" with a structure like that:
Cod_municip Ano Not_Sarampo
1 310110 1989 3
2 310160 1988 0
3 310350 1985 ...
0
votes
2
answers
52
views
How to properly use pivot_wider() to align the values of two variables?
I have one dataset as below.
library(dplyr)
library(tidyr)
df= tibble::tibble(
variety=rep(c("CV1", "CV2", "CV3"), each=16L),
irrigation=rep(rep(c("yes"...
-1
votes
2
answers
32
views
in r, transposing a column and grouping
In R, From the following example df:
df <- as.data.frame(ID= c("ACTA", "ACTZ", "APHT", "ACTA", "ACTZ", "APHT"),
date ...
0
votes
1
answer
59
views
How to make multiple columns of independent values into 2 column in R
If I have data that looks like this
Condition 1
Condition 2
11
41
17
45
where the numeric values are length.
Is there a way to change the data so that it looks like this instead
Condition
length
...
0
votes
0
answers
40
views
Issues with dataframe after transposition seemingly not numeric without any obvious reason
I have got this pipeline that works perfectly without transposition but suddenly everything goes wrong once I need to transpose my data.
My data are loaded from an excel file, I have other 29000 ...
1
vote
1
answer
97
views
Is it possible to calculate expression matrix in R for further use in Cytoscape?
I have a table containing Fold change data for genes in three conditions (Samples). my data is:
> dput(df2)
structure(list(Samples = c("A-1", "A-2", "A-4", "B-1&...
0
votes
0
answers
25
views
Transpose row factor to column [duplicate]
I have a data frame like this in R:
df <- data.frame(var1 = c("A","A","A","A","A","A","B","B"),
...
0
votes
2
answers
66
views
Add column with row values based on a category to R dataframe
so I have a dataframe of the following structure, let's call this one df0:
year
category
a
b
c
d
1989
1
0.3
0.7
0.43
321
1989
1
0.3
0.7
0.43
321
1989
2
0.2
0.4
0.5
174
1989
2
0.2
0.4
0.5
174
1989
2
0....
0
votes
1
answer
73
views
Species list long format to wide format
I am trying to transpose from long format to wide format using reshape() in R.
I have tried several iterations of my reshape() code with no success and I can't work out where I am going wrong. I have ...
1
vote
1
answer
138
views
Transpose dataframe in R and maintain first column
I need to transpose a dataframe in R, making the first column the headers of the transposed df, and the current columns headers the values in column 1 of the df. Like this -
df =
| |S1|S2|S3|
1|A|1 ...