Displaying 20 results from an estimated 10000 matches similar to: "inconsistency with cor() - "x must be numeric""
2011 Dec 05
3
adding hyperlinked text to pdf plot
Howdy,
I have read that if you put a URL in the text of a plot being saved
into pdf, the result is a functional hyperlink. I am interested in
having text in a plot that is linked to a URL, but I would like the
text to be something other than the URL. Is this possible? Thank you.
- Fincher
2011 Aug 08
1
Creating a simple 1-row heatmap
Howdy,
I am trying to make a simple monochrome heatmap from 1 row of data.
Essentially, I just want a long bar where black represents the max value in
the data, white is the minimum, and all values in between are interpolated
appropriately. I have tried using heatmap and heatmap.2, but both have
issues. heatmap seems to be restricted to only drawing a square plot, and
this data requires a
2012 Feb 08
1
Force printing of excluded axis annotations
Howdy,
This should be simple, but I am finding that I can't find a simple
solution. I have a plot to which I am manually adding the annotations
to the y-axis with this command:
axis(2, c(-4,-3,-2,-1,0,1,2,3,4,5,6,7),labels=c(-4,-3,-2,-1,0,1,2,3,4,5,6,7),cex.axis=8)
The issue is that, apparently, R doesn't think that the -1 can fit,
even though there is most certainly enough space.
2010 Jul 08
1
plotting lines when data has missing/NA values
Howdy,
I have done many searches and can't seem to find a way around this.
I am reading in a .csv file where each row is a dataset and each
column represents a position. The values are sparse (there are 2003
positions but usually only 100-200 values) and the idea is to be able
to plot each dataset (row) and overlay them in different combinations.
What I would like to do is have a plot
2007 Jul 20
1
how to determine/assign a numeric vector to "Y" in the cor.test function for spearman's correlations?
Hello to all of you, R-expeRts!
I am trying to compute the cor.test for a matrix that i labelled mydata
according to mydata=read.csv...
then I converted my csv file into a matrix with the
mydata=as.matrix(mydata)
NOW, I need to get the p-values from the correlations...
I can successfully get the spearman's correlation matrix with:
cor(mydata, method="s",
2010 May 14
1
finding the plot limits generated by default
I have two datasets that I would like to plot in a single figure. The first
plot is generated by a function that then takes a subset of the data. (It
is biological data so it is usually by chromosome e.g.
function(data1,subset="chr8") ) Since not only are the chromosomes different
sizes, but across different datasets there may be different numbers of
points for a single chromosome, I
2004 Mar 03
1
cor(..., method="spearman") or cor(..., method="kendall") (PR#6641)
Dear R maintainers,
R is great. Now that I have that out of the way, I believe I have
encountered a bug, or at least an inconsistency, in how Spearman and
Kendall rank correlations are handled. Specifically, cor() and
cor.test() do not produce the same answer when the data contain NAs.
cor() treats the NAs as data, while cor.test() eliminates them. The
option
use="complete.obs" has
2009 Jan 17
1
bug in cor.test(method = "spearman")
Dear R developers:
There is a possible bug in calculating the p-value
for Spearman's rank correlation.
Line 155 in file
R-patched/src/library/stats/R/cor.test.R
is
as.double(round(q) + lower.tail),
I think, it should be
as.double(round(q) + 2*lower.tail),
The reason is that round(q) is expected to be an even number
(the S statistic), so the next feasible value is round(q)+2.
2009 Jul 07
1
cor vs cor.test
Hi,
I am trying to use R for some survey analysis, and need to compute the
significance of some correlations. I read the man pages for cor and
cor.test, but I am confused about
- whether these functions are intended to work the same way
- about how these functions handle NA values
- whether cor.test supports 'use = complete.obs'.
Some example output may explain why I am confused:
2008 Feb 27
4
Error in cor.default(x1, x2) : missing observations in cov/cor
Hello,
I'm trying to do cor(x1,x2) and I get the following error:
Error in cor.default(x1, x2) : missing observations in cov/cor
A few things:
1. I've used cor() many times and have never encountered this error.
2. length(x1) = length(x2)
3. is.numeric(x1) = is.numeric(x2) = TRUE
4. which(is.na(x1)) = which(is.na(x2)) = integer(0) {the same goes for
is.nan()}
5. I also try
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
2005 May 25
2
cor vs cor.test
Using Windows System, R 2.1.0
d is a data frame, 48 rows, 10 columns
cor(d) works properly providing all pairwise Pearson correlation
coefficients among columns
cor.test(d) gives error message "Error in cor.test.default(d) : argument
"y" is missing, with no default"
Why?
Thanks,
MCG
2008 May 02
1
cor.test like cor?
Hi,
Is there a simple way to do correlation coefficient tests with
"cor.test" like I would do with "cor" function? I have a data frame
where each column is a list.
================================================
y <- data.frame(a=sample(30, 20), b=sample(30, 20), c=sample(30,20))
cor(y)
================================================
But, cor.test does not take y
2005 Oct 09
3
cor doesn't accept na.rm? (PR#8193)
Full_Name: Paul Bailey
Version: 2.1.1
OS: OS X 10.3
Submission from: (NULL) (68.252.250.144)
?cor
[tells me that it has a na.rm variable]
> cor(frame2[1,],frame2[2,],na.rm=T)
Error in cor(frame2[1, ], frame2[2, ], na.rm = T) :
unused argument(s) (na.rm ...)
hmm.
2004 Aug 30
1
Wrong result with cor(x, y, method="spearman", use="complete.obs") with NA's???
Hallo!
Is there an error in cor to calculate Spearman
correlation with cor if there are NA's? cor.test gives
the correct result. At least there is a difference.
Or am I doing something wrong???
Does anybody know something about this?
a<-c(2,4,3,NA)
b<-c(4,1,2,3)
cor(a, b, method="spearman", use="complete.obs")
# -0.9819805
cor.test(a, b,
2010 May 19
2
How to look up source code for cor.test()
Dear all,
how can I check the source code for a hidden function like cor.test()?
At the moment I get ...
> cor.test
function (x, ...)
UseMethod("cor.test")
<environment: namespace:stats>
Thanks in advance,
Will
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,
2007 Dec 03
1
cor(data.frame) infelicities
In using cor(data.frame), it is annoying that you have to explicitly
filter out non-numeric columns, and when you don't, the error message
is misleading:
> cor(iris)
Error in cor(iris) : missing observations in cov/cor
In addition: Warning message:
In cor(iris) : NAs introduced by coercion
It would be nicer if stats:::cor() did the equivalent *itself* of the
following for a data.frame:
2012 Oct 11
2
ccf(x,y) vs. cor() of x and lagged values of y
Hi
I'm computing the correlation between two time-series x_t and y_t-1
(time-series lagged using the lag(y,-1) function) using the cor() function
and the returned value is different from the value of ccf() function at the
same lag. Any ideas why this is so?
Thanks in advance for any hints.
Mihnea
[[alternative HTML version deleted]]
2004 May 13
1
Bootstrapping kendall cor
Dear R-helpers,
I'm fighting with the following problem :
I want to do bootstrapping on a Kendall correlation with the following code
:
> cor.function <- function(data,i) cor(data[i, 1], data[i,
2],method="kendall")
> boot.ci <- boot.ci(boot.cor <- boot(cbind(x,y),cor.function,
R=1000),conf=c(0.95,0.99))
However, I've got problems because I've got ties