R/pca_data_tidy.R
pca_data_tidy.Rd
the Principal Components Analysis need the data must be transformed
pca_data_tidy(data, id = NULL)
data | the input data must be a dataframe or tibble which' rownames is gene id and colnames is sample name |
---|---|
id | the rowid, can be a character or the column number |
a dataframe
test = matrix(rnorm(200), 20, 10) test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 3 test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 2 test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4 colnames(test) = paste("Test", 1:10, sep = "") rownames(test) = paste("Gene", 1:20, sep = "") annot <- c(rep("KEGG",20)) test <- data.frame(test,annot) pca_data_tidy(as.data.frame(test)) -> test#> ... Notice: the input data is a data frame not a tibble #> ... Problem: the input data vaule in every column must be numberic value #> ... Problem: the error because the character type value in data #> ... Successed! the pca data save in the object