qiime2R - Error: `by` must be supplied when `x` and `y` have no common variables

Hello,

Just created my physeq file following the tutorial (Tutorial: Integrating QIIME2 and R for data visualization and analysis using qiime2R)

I'm getting the following error: when running the following command.

Code:

library(tidyverse)
library(qiime2R)

metadata<-read_q2metadata("metadata_16S.tsv")
shannon<-read_qza("shannon_vector.qza")

shannon<-shannon$data %>% rownames_to_column("sample-id") # this moves the sample names to a new column that matches the metadata and allows them to be merged

metadata<-metadata %>% left_join(shannon)
head(metadata)

Error:

metadata<-metadata %>% left_join(shannon)
Error: by must be supplied when x and y have no common variables.
i use by = character()to perform a cross-join. Runrlang::last_error()to see where the error occurred. rlang::last_error() <error/rlang_error>bymust be supplied whenxandy have no common variables. i use by = character() to perform a cross-join.
Backtrace:

  1. dplyr::left_join(., shannon)
  2. dplyr:::join_mutate(...)
  3. dplyr:::join_cols(...)
  4. dplyr:::standardise_join_by(by, x_names = x_names, y_names = y_names)
    Run rlang::last_trace() to see the full context.

rlang::last_trace()
<error/rlang_error>
by must be supplied when x and y have no common variables.
i use by = character()` to perform a cross-join.
Backtrace:
x

  1. -metadata %>% left_join(shannon)
  2. +-base::withVisible(eval(quote(_fseq(_lhs)), env, env))
  3. -base::eval(quote(_fseq(_lhs)), env, env)
  4. \-base::eval(quote(`_fseq`(`_lhs`)), env, env)
    
  5.   \-`_fseq`(`_lhs`)
    
  6.     \-magrittr::freduce(value, `_function_list`)
    
  7.       +-base::withVisible(function_list[[k]](value))
    
  8.       \-function_list[[k]](value)
    
  9.         +-dplyr::left_join(., shannon)
    
  10.         \-dplyr:::left_join.data.frame(., shannon)
    
  11.           \-dplyr:::join_mutate(...)
    
  12.             \-dplyr:::join_cols(...)
    
  13.               \-dplyr:::standardise_join_by(by, x_names = x_names, y_names = y_names)
    

Anybody has any idea of what could be going on here? Metadata file is attached.

Thanks,

Leo

The sample identifier column in your shannon dataframe is "sample-id" while it's "sample_id" in your metadata. Change the column name "sample-id" to "sample_id" in your shannon dataframe may solve the problem.

shannon<-shannon$data %>% rownames_to_column(“sample_id”)

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.