Hello everyone,
I did ELİSA experiment and I have an excel file.In this file column name A:H and Row names 1:12.I want to unite this column and rows (like A1,A2....H1,H2) and make a column.In other column ı want to my data next column.Like A1-0.25,B1-5.0.How can I do that?
FJCC
March 14, 2023, 1:55pm
2
I'm sorry, I do not understand what you want to do. Please ask your question again.
Here are some observations and questions:
Your Rows are labeled A:H and your Columns are labeled 1-12. Please be careful to refer to rows and columns consistently.
What does it mean to "unite" columns and rows? Do you want to calculate a sum or average?
When you calculate A1-0.25 or B1-5.0, where do the values 0.25 and 5.0 come from?
Do you want to do this in R or is this and Excel question?
I want to look like that my table.And I want to do that with just using R.
FJCC
March 27, 2023, 3:44pm
4
Here is an example of reshaping data from a wide format to a long format and combining two columns. I made some assumptions about your data structure. I if you need more detailed help, please post the output of
dput(DF)
where DF is the name of your data frame.
DF <- data.frame(`1` = c(2,4,3), `2` = c(6,5,4),`3` = c(12,32,22), `4` = c(1,2,3),
check.names = FALSE, row.names = c("A","B","C"))
DF
#> 1 2 3 4
#> A 2 6 12 1
#> B 4 5 32 2
#> C 3 4 22 3
library(tidyr)
library(tibble)
DF <- DF |> rownames_to_column()
DF
#> rowname 1 2 3 4
#> 1 A 2 6 12 1
#> 2 B 4 5 32 2
#> 3 C 3 4 22 3
DF <- DF |> pivot_longer(cols = -rowname, names_to = "TMP")
DF
#> # A tibble: 12 × 3
#> rowname TMP value
#> <chr> <chr> <dbl>
#> 1 A 1 2
#> 2 A 2 6
#> 3 A 3 12
#> 4 A 4 1
#> 5 B 1 4
#> 6 B 2 5
#> 7 B 3 32
#> 8 B 4 2
#> 9 C 1 3
#> 10 C 2 4
#> 11 C 3 22
#> 12 C 4 3
DF <- DF |> unite(col = "Kuyu", c("rowname", "TMP"), sep = "")
DF
#> # A tibble: 12 × 2
#> Kuyu value
#> <chr> <dbl>
#> 1 A1 2
#> 2 A2 6
#> 3 A3 12
#> 4 A4 1
#> 5 B1 4
#> 6 B2 5
#> 7 B3 32
#> 8 B4 2
#> 9 C1 3
#> 10 C2 4
#> 11 C3 22
#> 12 C4 3
Created on 2023-03-27 with reprex v2.0.2
system
Closed
April 17, 2023, 3:44pm
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.