[R] Error message for MCC
Jim Holtman
jholtman at gmail.com
Thu Aug 4 06:03:49 CEST 2011
'temp' is only a vector and you are trying to reference it as a matrix, therefore the error message
Sent from my iPad
On Aug 3, 2011, at 18:14, Matt Curcio <matt.curcio.ri at gmail.com> wrote:
> Greetings all,
> I am getting an error message that is stifling me.
> Any ideas?
>
>> ## Define Directories ##
>> load_from <- "/home/mcc/Dropbox/abrodsky/kegg_combine_data/"
>> save_to <- "/home/mcc/Dropbox/abrodsky/ttest_results/"
>>
>> ###############################
>> ## Define Columns To Compare ##
>> compareA <- "log_b_rich"
>> compareB <- "Fc_cdt_rich_tot"
>>
>> ################################
>> ## Collect Files To Compare ##
>> setwd(load_from)
>> files_to_test <- list.files(pattern = "combine.kegg")
>>
>> ##########################
>> ## Initialize Variables ##
>> vl <- length(files_to_test)
>> temp <- vector(mode="numeric", length = vl)
>> colA <- vector(mode="numeric", length = vl)
>> colB <- vector(mode="numeric", length = vl)
>> tt <- vector(mode="numeric", length = vl)
>>
>>
>> ########################
>> ## Calculate P-values ##
>> for (i in 1:3){
> + temp1 <- read.table(files_to_test[i], header=TRUE, sep=" ")
> + numrows <- nrow(temp1)
> + tt_pvalue <- matrix(data=temp, nrow=numrows, ncol=vl)
> + colA <- temp[,compareA]
> + colB <- temp[,compareB]
> + tt <- t.test(colA, colB, var.equal=TRUE)
> + tt_pvalue <- tt$p.value
> + }
> Error in temp[, compareA] : incorrect number of dimensions
>
> --
>
>
> Matt Curcio
> M: 401-316-5358
> E: matt.curcio.ri at gmail.com
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list