GithubHelp home page GithubHelp logo

Comments (3)

dschust-r avatar dschust-r commented on June 15, 2024

Hi Bryan,

Thank you for your question! Could you maybe provide me with more information on what your data frames (both the pd_prot_long and the annotation df) look like exactly (column names and information contained in your columns)? This would really help me to see where the issue might be.

In theory, the joining should work if both data frames (i.e. the one you want to merge with the annotation and the annotation data frame) contain exactly the same file names in a column called "file_name" in both data frames.

Just an example:

# create example data frame with abundances and file names

abundance <- c(1,2,3,1,3,7)

file_name <- c(
  "sample1",
  "sample2",
  "sample3",
  "sample4",
  "sample5",
  "sample6"
)

data <- data.frame(file_name, abundance)

# create annotation data frame

condition <- c(
  "control",
  "control",
  "control",
  "treated",
  "treated",
  "treated"
)
annotation <- data.frame(file_name, condition)

# join both data frames

data_annotated <- data %>%
  left_join(annotation, by = "file_name")

data_annotated will then look like this:

view(data_annotated)

> data_annotated
  file_name abundance condition
1   sample1         1   control
2   sample2         2   control
3   sample3         3   control
4   sample4         1   treated
5   sample5         3   treated
6   sample6         7   treated

All the best,
Dina

from protti.

dschust-r avatar dschust-r commented on June 15, 2024

I just had another look at your file_name vector that you use to make the annotation data frame. To me it looks like your file names in your annotation data frame and pd_prot_long do not match exactly.

E.g. in pd_prot_long your first file name is "abundances_normalized_dmso_1" whereas in your annotation data frame this is "Abundances Normalized DMSO 1".

If you change it to snake case ("abundances_normalized_dmso_1") in your annotation data frame this should work.

Please let me know if that helped you fix the issue.

All the best,
Dina

from protti.

bmroger2 avatar bmroger2 commented on June 15, 2024

Dina,

You're absolutely correct and I am embarrassed. This code works perfectly fine!

Thank you for the help and for designing such an easy to follow vignette for beginners in R!

Kind regards,
Bryan

from protti.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.