Displaying 20 results from an estimated 6000 matches similar to: "Coercing Logical array to Numeric array"
2011 Jul 12
3
Help in error removal
Dear all,
I am new to programming in R.
I deal with microarray data,which is a data frame object type. I need to carry out a few statistical procedures on this, one of them being the pearson corelation. I need to do this between each row which is a gene. So the desired result is a square matrix with the pearson corelation value between each row. So the first column would be (1,1)=0,(1,2),(1,3)
2011 Jul 22
2
Installation of XMLPRC package
Dear R users,
I am trying to download the XMLRPC package for R from www.omegahat.org without any success. Any pointers?
Sumona
2012 Oct 15
2
Chopping a two column data frame by rows into a three dimensional array.
If I have a two column data frame like:
> dat <- cbind("x"=c(1:100),"y"=c(100:1))
How can I create an array that splits every ten rows of that data frame
into a third dimension of an array so that:
> newarray[,,1]
,,1
x y
1 100
2 99
3 98
... ...
10 91
,,2
x y
11 90
12 89
... ...
...
Thanks.
[[alternative HTML version deleted]]
2013 Jan 23
1
problems with coercing a factor to be numeric
Dear R listers,
I am trying to compute the mean of a dummy variable that is encoded as a
factor. However, even though the levels of my factor are 0 - 1, when I
compute the mean (after coercing the factor to be
numeric), R changes 0 into 1 and 1 into yes, thus altering my expected
result.
Please, consider the following working example:
pp <- rep(0:1, 10)
pp <- factor(pp, levels=(0:1),
2008 Dec 11
1
Coercing data into a simple array
I am using acf() to get the autocorrelations of a time series. It works but
I want to then get the autocorrelations into a simple list of numbers.
> x <- acf(price_changes, lag.max = 12,type = "correlation",plot = FALSE)
> x
Autocorrelations of series ‘price_changes’, by lag
0 1 2 3 4 5 6 7 8 9 10
11 12
1.000
2020 Feb 16
1
Why is any() only defined for a numeric and not logical data.frame?
Hello,
I recently stumbled on an unusual behaviour of any() and all() and have
been adviced from StackOverflow to share it here [1].
df1 <- data.frame(A=TRUE, B=FALSE)
df2 <- data.frame(A=1, B=0)
> any(df1)
Error in FUN(X[[i]], ...):
only defined on a data frame with all numeric variables
> any(df2)
[1] TRUE
Warning message: In any(c(1,
2002 May 02
2
coercing "numeric" components of data frame to "factor" or "ordered"?
I am getting ready to load a bunch of data into R. The data is all
numeric, but some of the numbers are integer codes representing
non-numeric semantics. What is the best way to "fix" the data frames
so that these compenents are recognized as "factors" or "ordered", as
appropriate?
Can I "assign" to some attribute of the data frame component, like the
2014 Dec 01
2
[LLVMdev] Optimization hints for "constant" loads
On 12/01/2014 11:14 AM, Andrew Trick wrote:
>
>> On Oct 21, 2014, at 4:03 PM, Philip Reames <listmail at philipreames.com
>> <mailto:listmail at philipreames.com>> wrote:
>>
>> Sanjoy made a good point. We don't actually need a new variant of
>> "invariant.start". Simply using an invariant.start with no uses
>> gives us a notion
2008 Apr 23
1
S4 default for coercing
Something has changed in the S4 default for coercing. Am I now suppose
to use setAs, or is there something else I should do to make this work:
R version 2.7.0 (2008-04-22)
....
> require("methods")
> setClassUnion("OptionalPOSIXct", c("POSIXct", "NULL"))
[1] "OptionalPOSIXct"
> setClass("TSmetax",
2011 Sep 27
2
Coercing a character zoo to a numeric
Dear R-helpers,
It seems to me that a character zoo cannot be coerced to a numeric zoo.
Below is a minimal example. Can someone tell me what I have done wrong?
> z<-zoo(1:4,order.by=1:4)
> coredata(z)<-as.character(coredata(z))
> str(z)
‘zoo’ series from 1 to 4
Data: chr [1:4] "1" "2" "3" "4"
Index: int [1:4] 1 2 3 4
>
2012 Nov 05
1
no method for coercing this S4 class to a vector
all of a sudden, after a SparseM upgrade(?)
I get this error:
> str(z)
Formal class 'matrix.csr' [package "SparseM"] with 4 slots
..@ ra : num [1:85372672] -0.4288 0.0397 0.0104 -0.1843 -0.1203 ...
..@ ja : int [1:85372672] 1 2 3 4 5 6 7 8 9 10 ...
..@ ia : int [1:699777] 1 123 245 367 489 611 733 855 977 1099 ...
..@ dimension: int [1:2] 699776 122
2012 Aug 19
1
radarchart axis scaling
Hello
I created a radar chart using the function of ?radarchart? from the
?fmsb? package in R software.
The matrix I am using is as follows:
x<-c(c(rep(4.5,7),c(rep(0,7)), 3.34, 3.28, 1.37, 1.12, 3.52, 4.07, 3.66));
a<-matrix(x,nrow=3, ncol=7,byrow=T)
I would like to show the range of c(0,5) on the axis instead of
c(0,100) or c(0,1).
I really appreciate it if any body can guide me.
2009 Jun 07
2
Need some help in R : value more than equals to a row.
Hallo,
I was trying some code, but couldn't make one step of the code properly.
Can anybody please help me?
I have one matrix like this
> values
[,1] [,2] [,3] [,4] [,5]
[1,] 0.7777778 0.36111111 0.22222222 0.1388889 0.0000000
[2,] 1.0000000 0.00000000 0.53846154 0.0000000 0.5384615
[3,] 0.5200000 0.48000000 0.64000000 0.0000000 0.8800000
[4,] 0.8928571
2004 Nov 10
1
Basic Q on coercing factors in data frames to numeric
Hi there,
I'm running R 2.0.0 on Windows 95. I'm trying to coerce a column of factors within a data frame to numeric. This is not a problem with a vector, but I can't find a way to index a column within a data frame to achieve this. All the examples from 'An introduction to R', 'S-plus 6 programmers guide', etc, use simple vectors. I'm sure I'm missing
2014 Dec 01
2
[LLVMdev] Optimization hints for "constant" loads
On 12/01/2014 02:42 PM, Andrew Trick wrote:
>
>> On Dec 1, 2014, at 2:21 PM, Philip Reames <listmail at philipreames.com
>> <mailto:listmail at philipreames.com>> wrote:
>>
>>
>> On 12/01/2014 11:14 AM, Andrew Trick wrote:
>>>
>>>> On Oct 21, 2014, at 4:03 PM, Philip Reames
>>>> <listmail at philipreames.com
2011 Sep 21
3
RESEND: Mixmonitor command parameter problem on Asterisk 1.8.4
Is anyone can help me with this ? I'm really desperate.
Thx in ad.
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Ikka - Mitra
Kreasindo
Sent: Wednesday, September 14, 2011 5:02 PM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: [asterisk-users] Mixmonitor command parameter problem on
2011 Apr 06
1
Creating a symmetric contingency table from two vectors with different length of levels in R
Hello,
How can I create a symmetric contingency table from two categorical vectors
having different length of levels?
For example one vector has 98 levels
TotalData1$Taxa.1
[1] "Aconoidasida" "Actinobacteria (class)"
"Actinopterygii" "Alphaproteobacteria"
[5] "Amoebozoa"
2014 Oct 21
3
[LLVMdev] Optimization hints for "constant" loads
On 10/21/2014 01:44 PM, Andrew Trick wrote:
>> On Oct 21, 2014, at 11:46 AM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
>>
>> Thank you for the explanation, I think I misunderstood your solution
>> initially. Is it accurate to say: by making the definition of the
>> source pointer of an !invariant load control (or data) dependent on
>> some
2006 Nov 29
1
Matrix*vector: coercing sparse to dense matrix for arithmetic
Hi,
I have a sparse Matrix (kronecker product of spline design matrices),
and I need to multiply each row by a number to get another matrix. If
the matrix is A and the numbers are stored in a vector k, with plain
vanilla matrices I would do
A*k
But when using the Matrix package (class of A is "dgCMatrix"), I get
the warning "coercing sparse to dense matrix for arithmetic".
2010 Dec 28
1
rJava question
After some trial and error I figured out how to pass matrices from R to java
and back
using rJava, but this method is not documented and I wonder if there is a
better way?
Anyway, here is what I found works:
(m = matrix(as.double(1:12),3,4))
[shows m as you would expect]
jtest <- .jnew("JTest")
(v <- .jcall(jtest, '[[D], 'myfunc', .jarray(m), evalArray=FALSE))
[shows