The data this analysis used are download from: https://portal.gdc.cancer.gov

library(limma)
library(Seurat)
## Attaching SeuratObject
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(magrittr)
library(celldex)
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
## 
## Attaching package: 'matrixStats'
## The following object is masked from 'package:dplyr':
## 
##     count
## 
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
## 
##     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
##     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
##     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
##     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
##     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
##     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
##     colWeightedMeans, colWeightedMedians, colWeightedSds,
##     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
##     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
##     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
##     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
##     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
##     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
##     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
##     rowWeightedSds, rowWeightedVars
## Loading required package: GenomicRanges
## Loading required package: stats4
## Loading required package: BiocGenerics
## Warning: package 'BiocGenerics' was built under R version 4.0.5
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:dplyr':
## 
##     combine, intersect, setdiff, union
## The following object is masked from 'package:limma':
## 
##     plotMA
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,
##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which.max, which.min
## Loading required package: S4Vectors
## 
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:dplyr':
## 
##     first, rename
## The following object is masked from 'package:base':
## 
##     expand.grid
## Loading required package: IRanges
## 
## Attaching package: 'IRanges'
## The following objects are masked from 'package:dplyr':
## 
##     collapse, desc, slice
## Loading required package: GenomeInfoDb
## Warning: package 'GenomeInfoDb' was built under R version 4.0.5
## Loading required package: Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## 
## Attaching package: 'Biobase'
## The following object is masked from 'package:MatrixGenerics':
## 
##     rowMedians
## The following objects are masked from 'package:matrixStats':
## 
##     anyMissing, rowMedians
## 
## Attaching package: 'SummarizedExperiment'
## The following object is masked from 'package:SeuratObject':
## 
##     Assays
## The following object is masked from 'package:Seurat':
## 
##     Assays
library(SingleR)
## 
## Attaching package: 'SingleR'
## The following objects are masked from 'package:celldex':
## 
##     BlueprintEncodeData, DatabaseImmuneCellExpressionData,
##     HumanPrimaryCellAtlasData, ImmGenData, MonacoImmuneData,
##     MouseRNAseqData, NovershternHematopoieticData
library(monocle)
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following object is masked from 'package:S4Vectors':
## 
##     expand
## Loading required package: ggplot2
## Loading required package: VGAM
## Loading required package: splines
## Loading required package: DDRTree
## Loading required package: irlba

01. Data Processing

In this section, we proessed the data with folloing steps: 1.Reading the data 2.Taking the average value of data appear over one time 3.Transferring the matrix data to the version suitable for Seurat Package 4.Deleting samples which involves a low amount of numbers of cells or gene, which threshold I set min cell equals to 3 and min genes equal to 50 here 5.Calculating numbers of mitochondria of each sample

setwd("~/Bios")
rt=read.table("treat.txt", header=T, sep="\t", check.names=F)

rt=as.matrix(rt)
rownames(rt)=rt[,1]
exp=rt[,2:ncol(rt)]
dimnames=list(rownames(exp),colnames(exp))
data=matrix(as.numeric(as.matrix(exp)),nrow=nrow(exp),dimnames=dimnames)
data=avereps(data)

pbmc=CreateSeuratObject(counts = data,project = "seurat", min.cells=3, min.features=50, names.delim = "_")
## Warning: The following arguments are not used: row.names
## Warning: Feature names cannot have underscores ('_'), replacing with dashes
## ('-')
pbmc[["percent.mt"]] <- PercentageFeatureSet(object = pbmc, pattern = "^MT-")

Setting the thresholds:

logFCfilter=1               
adjPvalFilter=0.05          

Plotting violin plot of gene feature:

#VlnPlot(object = pbmc, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)
VlnPlot(object = pbmc,features ="nFeature_RNA")

VlnPlot(object = pbmc,features ="nCount_RNA")

VlnPlot(object = pbmc,features ="percent.mt")
## Warning in SingleExIPlot(type = type, data = data[, x, drop = FALSE], idents =
## idents, : All cells have the same value of percent.mt.

Plotting sequencing depth $Sequenceing  Depth = $

I filtering the data to remain the samples with more than 50 genes and the number of mitochondria less than 5.

pbmc=subset(x = pbmc, subset = nFeature_RNA > 50 & percent.mt < 5)  

Plotting

plot1 <- FeatureScatter(object = pbmc, feature1 = "nCount_RNA", feature2 = "percent.mt",pt.size=1.5)
## Warning in cor(x = data[, 1], y = data[, 2]): the standard deviation is zero
plot2 <- FeatureScatter(object = pbmc, feature1 = "nCount_RNA", feature2 = "nFeature_RNA",,pt.size=1.5)
plot1

plot2

#CombinePlots(plots = list(plot1, plot2))

These two plots are about the relation between sequencing depth and the number of mitochondria; and the relation between sd and the number of this gene separately.

The following step is to normalize the data and extract the gene with a high coefficient of variation among the cells, where I pull the first 1500 cells here, then plotting the feature variance.

The first ten fluctuating genes are plotted over here.

pbmc <- NormalizeData(object = pbmc, normalization.method = "LogNormalize", scale.factor = 10000)

pbmc <- FindVariableFeatures(object = pbmc, selection.method = "vst", nfeatures = 1500)

top10 <- head(x = VariableFeatures(object = pbmc), 10)
plot1 <- VariableFeaturePlot(object = pbmc)
plot2 <- LabelPoints(plot = plot1, points = top10, repel = TRUE)
## When using repel, set xnudge and ynudge to 0 for optimal results
plot1

plot2

#CombinePlots(plots = list(plot1, plot2))

0.2 Principal Component Analysis

Before plotting, scaling data first, then reducing the dimension of data.

Plotting the feature genes of first four principal components

pbmc=ScaleData(pbmc)          
## Centering and scaling data matrix
pbmc=RunPCA(object= pbmc,npcs = 20,pc.genes=VariableFeatures(object = pbmc))     
## PC_ 1 
## Positive:  C5AR1, SDS, LAPTM5, GPNMB, VIM, MSR1, TYROBP, C1QB, SRGN, CD4 
##     FCER1G, ITGB2, CTSL, AIF1, CD86, MS4A7, ITGAX, C1QC, C1QA, LIPA 
##     SLC2A3, CD83, MS4A4A, G0S2, LST1, PLEK, CSF1R, CD163, PTPRC, GPR183 
## Negative:  TACSTD2, MET, FCGBP, TFF3, PHGR1, BCAS1, CEACAM6, TCN1, ASS1, TPM1 
##     MUC2, ITLN1, TRIM31, CAV2, REP15, SLURP1, CEACAM1, COL16A1, CHD7, C15orf48 
##     ITGA2, PLA2G2A, DES, GKN1, LYNX1, REG1B, TNFRSF11B, LYPD8, RIOK3, EPS8L1 
## PC_ 2 
## Positive:  CALD1, IGFBP7, SPARCL1, FN1, BGN, MYLK, COL18A1, CRISPLD2, SPARC, C1R 
##     COL6A2, C11orf96, COL14A1, PPP1R14A, COL6A1, AEBP1, FSTL1, MCAM, MYL9, PDGFRB 
##     MSRB3, PDLIM3, MEDAG, C1S, TAGLN, ADAMTS1, PLAC9, EDIL3, KCNMB1, ADAMTS4 
## Negative:  IFI30, TYROBP, C5AR1, SDS, MS4A7, ITGAX, TNFRSF1B, LST1, ITGB2, MS4A4A 
##     AIF1, LAPTM5, CD86, C1QA, CYBB, C1QB, PTPRC, CECR1, CD163, CCL3 
##     MSR1, CAPG, CD14, BCL2A1, CD4, IL1B, FCER1G, MPEG1, PLA2G7, CD68 
## PC_ 3 
## Positive:  CEACAM6, FCGBP, CAV2, PHGR1, MET, C15orf48, TXNIP, SLURP1, ITLN1, REP15 
##     TCN1, ASS1, TACSTD2, TRIM31, DES, MUC2, LYNX1, S100A4, TFF3, LYPD8 
##     COL16A1, REG1B, PLA2G2A, FFAR2, TNFRSF11B, CTTNBP2, GKN1, TPM1, FER1L6, CEACAM1 
## Negative:  OLFM4, MSMB, SPINK4, PIGR, PGC, LYZ, TESC, CXCL17, LCN2, MT1E 
##     SNRPD1, PHLDA2, ADIRF, TM4SF1, LIPF, FKBP11, LGALS2, CD74, ARL14, NME1 
##     CLDN2, DNPH1, GP2, SSR4, CA2, CPS1, MT1G, IFITM2, MUC6, PDIA2 
## PC_ 4 
## Positive:  VSIG2, PSCA, MUC5AC, GKN2, DPCR1, RNASE1, CLDN18, VSIG1, ANXA10, CTSE 
##     FER1L4, ADAM28, CAPN8, GKN1, CLU, TFF1, LGALS9C, VILL, ABCC5, TFF2 
##     NKX6-2, LAMB3, UPK1B, HPGD, AKR1C2, CA2, PSAPL1, SLC28A2, RASSF6, CYP2C9 
## Negative:  PSMA7, TNFRSF11B, MAGEA3, CAV2, TCN1, MET, CKS1B, DES, CEACAM6, GIF 
##     ITLN1, TOMM6, FFAR2, TFF3, ASS1, SQLE, PLA2G2A, SLURP1, MUC2, REG4 
##     EIF4E2, CTTNBP2, CEACAM1, ENSA, IRF2BP2, LZIC, C19orf48, SNRPD1, NDUFC1, STMN1 
## PC_ 5 
## Positive:  CASQ2, ITGA8, LMOD1, SUSD2, ACTG2, S1PR3, SGCA, RBPMS2, HRH2, PRELP 
##     MYH11, SNCG, SUSD5, SLC7A2, CSRP2, HEYL, AOC3, LIMS2, ACTA2, CRYAB 
##     CNN1, HSPB6, SOD3, MEDAG, KCNMB1, NTRK2, WISP2, TSPAN2, PLN, RERGL 
## Negative:  F2R, FBN1, PLAT, MMP2, LUM, COL6A3, TMEM158, PXDN, RHOJ, COL5A1 
##     GJA1, SERPINF1, THY1, COL5A2, ROBO1, RAMP2, SPON2, COL6A2, CYGB, PDGFRA 
##     FAM101B, FBLN1, COL3A1, POSTN, SERPINE2, ADGRL4, CLEC14A, PTGDS, VWF, SERPINE1
#VizDimLoadings(object = pbmc, dims = 1:4, reduction = "pca",nfeatures = 20)
for (i in 1:4) {
VizDimLoadings(object = pbmc, dims = i, reduction = "pca",nfeatures = 20) }  

#VizDimLoadings(object = pbmc, dims = 1, reduction = "pca",nfeatures = 20)
#VizDimLoadings(object = pbmc, dims = 2, reduction = "pca",nfeatures = 20)
#VizDimLoadings(object = pbmc, dims = 3, reduction = "pca",nfeatures = 20)
#VizDimLoadings(object = pbmc, dims = 4, reduction = "pca",nfeatures = 20)

PCA Plotting:

DimPlot(object = pbmc, reduction = "pca")

Cells are presented as points, and the colors are indicating the cells come from different samples.

PCA Heatmap Plotting:

DimHeatmap(object = pbmc, dims = 1:4, cells = 500, balanced = TRUE,nfeatures = 30,ncol=2)
## Warning: Requested number is larger than the number of available items (400).
## Setting to 400.

## Warning: Requested number is larger than the number of available items (400).
## Setting to 400.

## Warning: Requested number is larger than the number of available items (400).
## Setting to 400.

## Warning: Requested number is larger than the number of available items (400).
## Setting to 400.

Getting the p value of each principal components:

pbmc <- JackStraw(object = pbmc, num.replicate = 100)
pbmc <- ScoreJackStraw(object = pbmc, dims = 1:15)
JackStrawPlot(object = pbmc, dims = 1:15)
## Warning: Removed 16003 rows containing missing values (geom_point).

The p-value is smaller, which means the principal component is relatively more important, then saves the cells with less than 0.05 p-value for the subsequent analysis.

03 TSNE Cluster Analysis and maker Gene

TSNE Cluster Analysis

pcSelect=14
pbmc <- FindNeighbors(object = pbmc, dims = 1:pcSelect) # calculating the neighbors distant  
## Computing nearest neighbor graph
## Computing SNN
pbmc <- FindClusters(object = pbmc, resolution = 0.5)   # group the cells and standardized cells module  
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
## 
## Number of nodes: 400
## Number of edges: 10272
## 
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.8528
## Number of communities: 6
## Elapsed time: 0 seconds
pbmc <- RunTSNE(object = pbmc, dims  = 1:pcSelect)      # TSNE cluster

TSNEPlot(object = pbmc, pt.size = 2, label = TRUE)  

write.table(pbmc$seurat_clusters,file="03.tsneCluster.txt",quote=F,sep="\t",col.names=F)

We could read which cells from which cluster from visualization and table.

head(knitr::kable(pbmc$seurat_clusters))
## [1] "|                           |x  |" "|:--------------------------|:--|"
## [3] "|GSM3067368_GAS14_C_B1_sc1  |0  |" "|GSM3067368_GAS14_C_B1_sc10 |0  |"
## [5] "|GSM3067368_GAS14_C_B1_sc11 |0  |" "|GSM3067368_GAS14_C_B1_sc12 |0  |"

This section is to find the differential gene of each cluster.

pbmc.markers <- FindAllMarkers(object = pbmc,
                               only.pos = FALSE,
                               min.pct = 0.25,
                               logfc.threshold = logFCfilter)
## Calculating cluster 0
## Calculating cluster 1
## Calculating cluster 2
## Calculating cluster 3
## Calculating cluster 4
## Calculating cluster 5
sig.markers=pbmc.markers[(abs(as.numeric(as.vector(pbmc.markers$avg_log2FC)))>logFCfilter & as.numeric(as.vector(pbmc.markers$p_val_adj))<adjPvalFilter),]
write.table(sig.markers,file="03.clusterMarkers.txt",sep="\t",row.names=F,quote=F)

top10 <- pbmc.markers %>% group_by(cluster) %>% top_n(n = 10, wt = avg_log2FC)


DoHeatmap(object = pbmc, features = top10$gene) + NoLegend()
## Warning in DoHeatmap(object = pbmc, features = top10$gene): The following
## features were omitted as they were not found in the scale.data slot for the RNA
## assay: HMGB1, LSM8, CAPZA2

Significant marker genes:

head(knitr::kable(sig.markers))
## [1] "|             |   p_val| avg_log2FC| pct.1| pct.2| p_val_adj|cluster |gene         |"
## [2] "|:------------|-------:|----------:|-----:|-----:|---------:|:-------|:------------|"
## [3] "|KRT20        | 0.0e+00|   2.835370| 0.914| 0.161| 0.0000000|0       |KRT20        |"
## [4] "|CAPZA2       | 0.0e+00|   3.964119| 0.987| 0.936| 0.0000000|0       |CAPZA2       |"
## [5] "|CEACAM6      | 0.0e+00|   4.315500| 0.967| 0.498| 0.0000000|0       |CEACAM6      |"
## [6] "|CAV2         | 0.0e+00|   3.605285| 0.960| 0.498| 0.0000000|0       |CAV2         |"

We could see the feature genes from each cluster.

Plotting the violin plot of marker genes:

VlnPlot(object = pbmc, features = row.names(sig.markers)[1:2])

Scatter plots of several genes:

showGenes=c("OLFM4","PDIA2","CPS1","LGALS2","TMED3","CLDN2","MSMB","AQP5","SPINK4","PIGR") 

FeaturePlot(object = pbmc, features = showGenes, cols = c("green", "red"))

Dot plot of marker genes in different clusters:

cluster10Marker=showGenes
DotPlot(object = pbmc, features = cluster10Marker)

We could see above selective gene is up regulate or down regulate in different clusters.

0.4 Cells Annotation

counts<-pbmc@assays$RNA@counts
clusters<-pbmc@meta.data$seurat_clusters
ann=pbmc@meta.data$orig.ident
#ref=get(load("ref_Human_all.RData"))
ref=celldex::HumanPrimaryCellAtlasData()
## snapshotDate(): 2020-10-27
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
singler=SingleR(test=counts, ref =ref,
                labels=ref$label.main, clusters = clusters)
clusterAnn=as.data.frame(singler)
clusterAnn=cbind(id=row.names(clusterAnn), clusterAnn)
clusterAnn=clusterAnn[,c("id", "labels")]
write.table(clusterAnn,file="04.clusterAnn.txt",quote=F,sep="\t", row.names=F)
singler2=SingleR(test=counts, ref =ref, 
                labels=ref$label.main)
cellAnn=as.data.frame(singler2)
cellAnn=cbind(id=row.names(cellAnn), cellAnn)
cellAnn=cellAnn[,c("id", "labels")]
write.table(cellAnn, file="04.cellAnn.txt", quote=F, sep="\t", row.names=F)


newLabels=singler$labels
names(newLabels)=levels(pbmc)
pbmc=RenameIdents(pbmc, newLabels)

TSNEPlot(object = pbmc, pt.size = 2, label = TRUE)   

We could see each cluster from which cells.

The outcome of cluster annotation and cell annotation:

head(knitr::kable(clusterAnn))
## [1] "|   |id |labels           |" "|:--|:--|:----------------|"
## [3] "|0  |0  |Epithelial_cells |" "|1  |1  |Epithelial_cells |"
## [5] "|2  |2  |Epithelial_cells |" "|3  |3  |Epithelial_cells |"
print("                                                                                                      ")
## [1] "                                                                                                      "
print("******************************************************************************************************")
## [1] "******************************************************************************************************"
print("                                                                                                      ")
## [1] "                                                                                                      "
head(knitr::kable(cellAnn))
## [1] "|                           |id                         |labels               |"
## [2] "|:--------------------------|:--------------------------|:--------------------|"
## [3] "|GSM3067368_GAS14_C_B1_sc1  |GSM3067368_GAS14_C_B1_sc1  |Epithelial_cells     |"
## [4] "|GSM3067368_GAS14_C_B1_sc10 |GSM3067368_GAS14_C_B1_sc10 |Epithelial_cells     |"
## [5] "|GSM3067368_GAS14_C_B1_sc11 |GSM3067368_GAS14_C_B1_sc11 |Epithelial_cells     |"
## [6] "|GSM3067368_GAS14_C_B1_sc12 |GSM3067368_GAS14_C_B1_sc12 |Epithelial_cells     |"

Differential Analysis of annotated cluster

pbmc.markers=FindAllMarkers(object = pbmc,
                            only.pos = FALSE,
                            min.pct = 0.25,
                            logfc.threshold = logFCfilter)
## Calculating cluster Epithelial_cells
## Calculating cluster Macrophage
sig.cellMarkers=pbmc.markers[(abs(as.numeric(as.vector(pbmc.markers$avg_log2FC)))>logFCfilter & as.numeric(as.vector(pbmc.markers$p_val_adj))<adjPvalFilter),]
write.table(sig.cellMarkers,file="04.cellMarkers.txt",sep="\t",row.names=F,quote=F)

05.Cells trajectory analysis

Transferring the outcome from Seurat package to cells matrix to fit monocle package

monocle.matrix=as.matrix(pbmc@assays$RNA@data)
monocle.sample=pbmc@meta.data
monocle.geneAnn=data.frame(gene_short_name = row.names(monocle.matrix), row.names = row.names(monocle.matrix))
monocle.clusterAnn=clusterAnn
monocle.markers=sig.markers


data <- as(as.matrix(monocle.matrix), 'sparseMatrix')
pd<-new("AnnotatedDataFrame", data = monocle.sample)
fd<-new("AnnotatedDataFrame", data = monocle.geneAnn)
cds <- newCellDataSet(data, phenoData = pd, featureData = fd)
names(pData(cds))[names(pData(cds))=="seurat_clusters"]="Cluster"
pData(cds)[,"Cluster"]=paste0("cluster",pData(cds)[,"Cluster"])

#Adding outcome from cells cluster
clusterAnn=as.character(monocle.clusterAnn[,2])
names(clusterAnn)=paste0("cluster",monocle.clusterAnn[,1])
pData(cds)$cell_type2 <- plyr::revalue(as.character(pData(cds)$Cluster),clusterAnn)

# cells trajectory analysis process
cds <- estimateSizeFactors(cds)
cds <- estimateDispersions(cds)
## Warning: `group_by_()` was deprecated in dplyr 0.7.0.
## Please use `group_by()` instead.
## See vignette('programming') for more help
## Warning: `select_()` was deprecated in dplyr 0.7.0.
## Please use `select()` instead.
## Removing 312 outliers
cds <- setOrderingFilter(cds, as.vector(sig.markers$gene))
#plot_ordering_genes(cds)
cds <- reduceDimension(cds, max_components = 2, reduction_method = 'DDRTree')
cds <- orderCells(cds)
## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used
## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used

## Warning in if (class(projection) != "matrix") projection <-
## as.matrix(projection): the condition has length > 1 and only the first element
## will be used
plot_cell_trajectory(cds,color_by = "State")

plot_cell_trajectory(cds,color_by = "Pseudotime")

plot_cell_trajectory(cds,color_by = "cell_type2")

plot_cell_trajectory(cds, color_by = "Cluster")

Cells tragetory differential analysis:

groups=subset(pData(cds),select='State')
pbmc=AddMetaData(object=pbmc, metadata=groups, col.name="group")
geneList=list()
for(i in levels(factor(groups$State))){
    pbmc.markers=FindMarkers(pbmc, ident.1 = i, group.by = 'group')
    sig.markers=pbmc.markers[(abs(as.numeric(as.vector(pbmc.markers$avg_log2FC)))>logFCfilter & as.numeric(as.vector(pbmc.markers$p_val_adj))<adjPvalFilter),]
    sig.markers=cbind(Gene=row.names(sig.markers), sig.markers)
    write.table(sig.markers,file=paste0("05.monocleDiff.", i, ".txt"),sep="\t",row.names=F,quote=F)
    geneList[[i]]=row.names(sig.markers)
}


unionGenes=Reduce(union,geneList)
write.table(file="05.monocleDiff.union.txt",unionGenes,sep="\t",quote=F,col.names=F,row.names=F)
head(knitr::kable(unionGenes),20)
##  [1] "|x          |" "|:----------|" "|OLFM4      |" "|JCHAIN     |"
##  [5] "|SLURP1     |" "|CEACAM6    |" "|LIPF       |" "|CXCL2      |"
##  [9] "|GKN1       |" "|CEACAM5    |" "|IFITM2     |" "|PHGR1      |"
## [13] "|KRT20      |" "|ITLN1      |" "|CAV2       |" "|FCGBP      |"
## [17] "|REG1B      |" "|PGA5       |" "|ADIRF      |" "|MET        |"