Reshaping data in R to be long or wide with pivot_longer and pivot_wider (CC185)

  Рет қаралды 8,174

Riffomonas Project

Riffomonas Project

Күн бұрын

Пікірлер: 21
@dashadayzz360
@dashadayzz360 Жыл бұрын
Thank you so much, Pat!!!! As a beginner to R, this video was very easy to follow & helped me transform my data into a dist matrix. I am so appreciative!!
@420npc
@420npc 2 жыл бұрын
Thanks a bunch for this series. Your videos are really clear, and practical. I’ve recommended your videos to everyone on my team!
@Riffomonas
@Riffomonas 2 жыл бұрын
Wonderful! Thanks for spreading the word 😊
@mikep8857
@mikep8857 2 жыл бұрын
I love the trick of comparing two character strings using < or >. Very nice.
@Riffomonas
@Riffomonas 2 жыл бұрын
You have to think a little about what’s going on but it’s pretty slick. Thanks for watching!
@sven9r
@sven9r 2 жыл бұрын
Thank you for this video! And of course for advice and help earlier. The video was already shared with the other people in my department.
@Riffomonas
@Riffomonas 2 жыл бұрын
Fantastic!
@siriyaksiriyak6067
@siriyaksiriyak6067 2 жыл бұрын
good ideas for matrix diagonal extraction for PCA
@Riffomonas
@Riffomonas 2 жыл бұрын
Thanks for watching!
@caty863
@caty863 2 жыл бұрын
I am confused as to which package *pivot_** functions belong to. I thought that should be *tidyr* but I realized the functions still work fine with only *dplyr* loaded.
@Riffomonas
@Riffomonas 2 жыл бұрын
Hi Caty! It is tidyr but I’m sure dplyr uses tidyr as a dependency to work with tibbles
@caty863
@caty863 2 жыл бұрын
@@Riffomonas Yeah, that might be the case then. I strive not to load the the whole *tidyverse* thing; I like to keep my environment lean that way. So, I have to know where every function I call comes from.
@Riffomonas
@Riffomonas 2 жыл бұрын
@@caty863 I think you could do tidyr::pivot_longer to load only that function without calling library(dplyr) or library(tidyr)
@hope2024-g
@hope2024-g Жыл бұрын
Thank you Sir for the nice tutorial. How can I convert pairwise distance matrix data (Bray-Curtis pairwise dissimilarity matrix) into continues variable Please ? I have collected plant species diversity and biomss from 25 sites. I want to assess relationship between Biomass and Beta diversity in r. As you know the biomass data from 25 sites is continues variable, while the Bray-Curtise pairwise distance data is a matrix. So how can I make linear regression using these Biomass as response variable and Bray-Curtis dissimilarity (beta diversity) as predictor Please ? Your help will be highly appreciated!
@cristianjaviermena6955
@cristianjaviermena6955 Жыл бұрын
The MANNNNNN
@dariushghasemi6476
@dariushghasemi6476 2 жыл бұрын
Amazing video again! It took longer this time , didn't it? :)) Dear Pat! What happens if we want to repeat a multiple linear regression model like this lm(y ~ SNP[i] + biomarker[p]) for all the combinations of (i, p) -> (e.g if we have i=200 SNPs' dosage level and p=100 different quantitative traits like biochemical lab tests), so that we want to do sth like sensitivity analysis and take the Regression coefficients and their corresponding Pvalues in a neat and tidy dataframe for our publication. Map2_df does not work because it does not work like 2x for loop! Any idea will be appreciated, or even it's a great exercise for next videos to scale up more our advanced functioning and object oriented programming skills. Many thanks! Dariush
@sven9r
@sven9r 2 жыл бұрын
Couldn't you use the broom package? You could run the 200 lms in a listed df and extract all the values you need. After that, you can use gtable:: to create a neat table
@Riffomonas
@Riffomonas 2 жыл бұрын
I think Hadley or David Robinson have a video somewhere talking about this.
@dariushghasemi6476
@dariushghasemi6476 2 жыл бұрын
@@sven9r Thank you so much for your suggestion. I've seen it in map functions manual in the help section, but I did not try it. I actually tried to run it by using subsequentially lapply and map, and then write another function to make the raw output in my desired format. I can later share my solution in my Github. Many thanks :)
@dariushghasemi6476
@dariushghasemi6476 2 жыл бұрын
@@Riffomonas I'm seeking for it in David's channel but I don't think I can find it :( Thanks BTW
@dariushghasemi6476
@dariushghasemi6476 2 жыл бұрын
@@Riffomonas I think you meant this talk by Hadley Wickham on "Managing many models with R". Sure, I'll have look again, maybe it's better to make up my mind again and apply their approach.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 13 МЛН
Lamborghini vs Smoke 😱
00:38
Topper Guild
Рет қаралды 64 МЛН
Transform Your Data Like a Pro with {tidyr} and Say Goodbye to Messy Data!
13:17
Rarefying ecological distances with R: Should you?  (CC189)
22:01
Riffomonas Project
Рет қаралды 6 М.
Rstudio tutorial (Geom Boxplot with Kruskal Wallis)
5:53
Matthew Peterson
Рет қаралды 10 М.
I never understood why you can't go faster than light - until now!
16:40
FloatHeadPhysics
Рет қаралды 4,5 МЛН
Use pivot_wider() to shape your data. R programming from beginners.
4:28
R Programming 101
Рет қаралды 11 М.
Tidying Data in R with pivot_longer()
11:57
Equitable Equations
Рет қаралды 19 М.
Using dplyr's group_by function with and without summarize (CC233)
25:54
Riffomonas Project
Рет қаралды 5 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 13 МЛН