similar to: Cannot be coerced to logical?

Displaying 20 results from an estimated 10000 matches similar to: "Cannot be coerced to logical?"

2010 Mar 30
3
use logical in cor.test
Hi, I've got 4 variables that I want to effectively 'stack' so that I have a grand R variable and a grand L variable. This works to achieve that goal: Twin1cor<-with(twin.wide,cbind(ACDepthR.1,ACDepthL.1)) Twin2cor<-with(twin.wide,cbind(ACDepthR.2,ACDepthL.2)) Both<-rbind(Twin1cor,Twin2cor) > str(Both) num [1:1858, 1:2] 3.36 NA NA NA NA NA NA 3.92 3.5 NA ... - attr(*,
2008 Mar 12
2
subset list based on logical within element flag
I have a very long list that I'd like to subset based on a logical value within each element. Example below. I'd like to get just those list elements for further study whose $sig.cor slot is TRUE. In this example, I'd only want element [[2]]. Should be simple, I know. How can I do this? Thanks, Mark > gene.pair.tf.lst [[1]] [[1]]$gene.pair [1] "Lgals1:Pxmp2"
2007 Jul 05
1
cor() and cor.test() (PR#9781)
Hello, I am trying to make a correlation matrix in R using cor() and also to get the p-value for each correlation using cor.test(). I can't get these commands to work. I'm getting errors like the following: cor(Pollution, Wet.days) Error in inherits(x, "data.frame") : Object "Wet.days" not found cor("Pollution", "Wet.days") Error in
2004 Sep 16
1
cor() fails with big dataframe
Hello, I have a big dataframe with *NO* na's (9 columns, 293380 rows). # doing memory.limit(size = 1000000000) cor(x) #gives Error in cor(x) : missing observations in cov/cor In addition: Warning message: NAs introduced by coercion #I found the obvious workaround: COR <- matrix(rep(0, 81),9,9) for (i in 1:9) for (j in 1:9) {if (i>j) COR[i,j] <- cor (x[,i],x[,j])} #which works fine,
2001 Sep 07
2
adding logical vector to data frame
Hello. I'm afraid that I'm missing something very obvious this afternoon... When I add a column to a data.frame (by assigning to a "new" column name a logical vector), I thought that I had (at least) 3 options to do so: R> j <- data.frame (x=1:2) R> j$y <- c(TRUE,FALSE) #assignment 1 R> str(j) `data.frame': 2 obs. of 2 variables: $ x: int 1 2 $ y: logi
2012 Jan 26
1
Error in ifelse(append, "a", "w") : , (list) object cannot be coerced to type 'logical'
Hello I will appreciate your help with the following. Running a script in R 2.14.1 under windows vista I get the following error message: Error in ifelse(append, "a", "w") : (list) object cannot be coerced to type 'logical' However, the very same script runs perfectly well under Ubuntu. My understanding is that this type of error is associated to
2006 Sep 22
2
Merge problem
Hello all, I have read as many merge issues as I possibly could tonight and although I presume this is a small error, I have not found the solution to my problem. I'm trying to merge two data sets: dat0 and TransTable. As you can see below, dat0 has 8000 rows, whereas TransTable has 47296 rows. I would expect when I merge the two data sets, with all.x=F, and all.y=F, that the
1997 Aug 20
1
R-alpha: R-0.50-a3: [logical, drop = FALSE] -- bug in R (and S-plus)
This is a bug both in R and S-plus (in R it's "worse"), I think. Look at this : ma <- cbind(1,1:8); logi <- rep(c(T,F),4) ma[logi,] ##> [,1] [,2] ##> [1,] 1 1 ##> [2,] 1 3 ##> [3,] 1 5 ##> [4,] 1 7 ##-- now the same with [ , drop = FALSE] ## R (-0.50-a3) : ma[logi, drop = F] ##>> Error: invalid subscript type ##
2011 Jun 29
5
[Urgent] Email Retrieval from remote servers doesn't use Dovecot
------------------------ Dovecot Version: ------------------------ 2.0.13 ------------------------ Output of "dovecot -n": ------------------------ # 2.0.13: /usr/local/etc/dovecot/dovecot.conf # OS: Linux 2.6.35-28-generic x86_64 Ubuntu 10.10 ext4 mail_location = maildir:/home/%u/Maildir passdb { args = %s driver = pam } protocols = imap pop3 ssl = no userdb { driver = passwd }
2012 Sep 14
2
calculate within-day correlations
useRs, Here is some R-ready data for my question to follow. Of course this data is small snippet from a much larger dataset that is about a decade long. Q<-read.table(textConnection("2002 3 28 15 77.38815 2002 3 28 30 77.09505 2002 3 28 45 76.80196 2002 3 28 60 76.50887 2002 3 28 75 76.50887 2002 3 28 90 76.50887 2002 3 28 105
2017 Jun 07
1
sum() returns NA on a long *logical* vector when nb of TRUE values exceeds 2^31
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Tue, 6 Jun 2017 09:45:44 +0200 writes: >>>>> Herv? Pag?s <hpages at fredhutch.org> >>>>> on Fri, 2 Jun 2017 04:05:15 -0700 writes: >> Hi, I have a long numeric vector 'xx' and I want to use >> sum() to count the number of
2008 Jul 18
1
only "T" becomes logical colum with read.table
Hello, I am a biologist and I am dealing with files composed of columns with T or A or C or G (example below) Sometimes a column is composed of only "T" and in that case, the columns becomes a logical column TRUE (example below) I know that the argument "as.is" controls the turns off turning a column into a factor, instead becoming a character Is there something similar for
2009 Aug 30
2
correlation between two 2D point patterns?
Suppose I have two sets of (x,y) points like this: x1<-runif(n=10) y1<-runif(n=10) A<-cbind(x1,y1) x2<-runif(n=10) y2<-runif(n=10) B<-cbind(x2,y2) I would like to measure how similar the two sets of points are. Something like a correlation coefficient, where 0 means the two patterns are unrelated, and 1 means they are identical. And in addition I'd like to be able to
2007 Sep 19
2
By() with method = spearman
I have a data set where I want the correlations between 2 variables conditional on a students grade level. This code works just fine. by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor, use='complete', method='pearson') However, this generates an error by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor, use='complete',
2016 Apr 28
0
Antwort: RE: Interdependencies of variable types, logical expressions and NA
Hi your initial ds > str(ds) 'data.frame': 2 obs. of 3 variables: $ var1: num 1 1 $ var2: logi TRUE FALSE $ var3: logi NA NA first result > str(ds) 'data.frame': 2 obs. of 6 variables: $ var1 : num 1 1 $ var2 : logi TRUE FALSE $ var3 : logi NA NA $ value_and_logical: logi TRUE TRUE $ logical_and_na : logi TRUE NA
2000 Nov 10
1
Modification to cov and cor
Can I suggest that in cov and cor the lines if (is.data.frame(x)) x <- as.matrix(x) if (is.data.frame(y)) y <- as.matrix(y) be replaced by if (is.data.frame(x)) x <- data.matrix(x) # coerce logical and factors if (is.data.frame(y)) y <- data.matrix(y) # likewise This would allow things like > data(iris) > cor(iris) which
2007 Jul 28
8
generating symmetric matrices
Greetings, I have a seemingly simple task which I have not been able to solve today. I want to construct a symmetric matrix of arbtriray size w/o using loops. The following I thought would do it: p <- 6 Rmat <- diag(p) dat.cor <- rnorm(p*(p-1)/2) Rmat[outer(1:p, 1:p, "<")] <- Rmat[outer(1:p, 1:p, ">")] <- dat.cor However, the problem is that the matrix
2017 Sep 21
2
rcorr error in R stat
Hello, Please keep this on the list, always cc r-help. One of the files in your attachment is empty: y <- read.csv(file.choose("GT.csv")) Error in read.table(file = file, header = header, sep = sep, quote = quote,? : ? no lines available in input Rui Barradas ? Citando Chaitanya Ganne <Chaitanya.Ganne at jefferson.edu>: > Thank you so much for your input. > > I am
2008 Oct 20
1
Zero mean correlation Matrix
Hi,, I want to use the existing cor function in R but with a different way to compute the correlation method.. basically zero mean correlation. The forumula I have is 'D' <- function(c1, c2) sum(c1*c2, na.rm=T)/(sqrt(sum(c1*c1, na.rm=T))*sqrt(sum(c2*c2, na.rm=T))) I am not sure how i can modify the method cor computes its square roots and covariance matrixes? I only need to add
2015 Oct 19
2
Error con tabla
Hola a todos, Tengo el siguiente problema: Tengo un archivo de excel que lo convertÍ a csv y tiene la siguiente estructura:La primera columna con el nombre de las empresas (48 empresas) y 17 columnas más (variables) con información sobre esas empresas. Cargo el archivo en r de la siguiente manera para poder trabajar con el: library(xtable)variables <-