Displaying 20 results from an estimated 70 matches similar to: "help:coerce lmer.coef to matrix"
2010 Jan 12
1
coerce vector into array - change filling sequence
Dear all,
When I coerce a vector into a multi dimensional array, I would like R to start filling the array along the last dimension, then the 2nd last etc.
Let's jump straight into an example.
x <- 1 : 24
y <- array(dim=c(2,2,6))
I would like to have:
y[1,1,1] = 1
y[1,1,2] = 2
...
y[1,1,6] = 6
y[1,2,1] = 7
y[1,2,2] = 8
...
y[2,1,1] = 13
...
y[2,2,1] = 19
if I do y<- array(x,
2009 Feb 05
0
plotrix::thigmophobe could usefully coerce to numeric...
thigmophobe.labels() fails with error when supplied with an array
resulting from tapply (example below).
The error originates in thigmophobe()
I know the help page says 'numeric vector' but it would be kind of nice
if it worked with numeric things of class array too. I think it would
need no more than a couple of as.numeric() calls in thigmophobe itself,
or (simpler but slightly less
2004 May 13
0
using trace() on S4 coerce method
I'm trying to use trace() on an S4 coerce method, but get the error
Error in bindingIsLocked(what, whereM) : no binding for "coerce"
What am I doing wrong? Example code follows.
(I've googled the R mailing lists for "trace coerce" and "trace
bindingisLocked" without finding anything relevant. Perhaps I should
re-define the method in terms of an
2005 Feb 10
1
Undocumented S4 methods: generic coerce and siglist matrix, Massvector
Hi,
While checking the package I am getting all the time the following
complain about the function:
Undocumented S4 methods:
generic coerce and siglist matrix,Massvector
I have not defined the function nowhere in the R files.
My gues is that this has something to do with the following definition
of the setAs function.
setAs("matrix","Massvector"
,def=
2010 Aug 27
1
Is it safe not to coerce matrices with as.double() in .C()?
I'd very much appreciate guidance on this. A user reported that the
as.double() coercion used inside the .C() call for a function in my
package (specifically, randomForest:::predict.randomForest()) is
taking up significant amount of time when called repeatedly, and
Removing some of these reduced run time by 30-40% in some cases.
These arguments are components of the fitted model (thus do
2001 Mar 01
1
How to coerce data frame elements into factors?
Greetings -
In trying to do a multiple correspondence analysis, I need to coerce a
data frame such that each of its columns will be a factor. Can someone
offer advice on how to make this happen? I've tried this:
> logic.resources.f.df<-apply(logics.resources.df, 2, factor)
but:
> is.factor(logic.resources.f.df$interests)
[1] FALSE
I've also tried individually,
>
2002 May 16
0
is.na() can coerce character vectors to be factors within a dataframe
Thanks to Brian Ripley for suggesting, to my previous post about a problem with
merge, that I trace through merge.data.frame. I did so with my test case and
all seemed to be well until I got to:
if (all.x)
for (i in seq(along = y)) is.na(y[[i]]) <- (lxy +
1):(lxy + nxx)
I believe that this code sets observations in y (which has been expanded to be the
2005 Jun 15
1
cannot coerce class "matchit" into a data.frame"
Greetings fellow humans,
I am attempting to export a text file after using the MatchIt package to match control with treatment subjects. I attempted to write.table and used the following syntax:
"write.table(social,"shaka.txt",sep=" ",quote=FALSE,row.names=FALSE,col.names= FALSE)"
But received the following error message:
"Error in
2005 Jul 17
3
Is it possible to coerce R to continue proceeding the next command in a loop after an error message ?
Hello R-users,
In a loop, if a function, such as "nls", gives an error, is it possible to
coerce R to continue proceeding the next command with the same
loop?
Thanks so much for your advice!
Hanna Lu
[[alternative HTML version deleted]]
2008 Nov 17
1
coerce data.frame with table-like data to a table for use with barchart.table
I have a data.frame containing survey data that is already organized
like a table:
> foo
Excellent Very Good Good Fair Poor Very Poor
Question 1 8 7 3 0 0 0
Question 2 5 5 7 1 0 0
Question 3 7 10 1 0 0 0
> class(foo)
[1] "data.frame"
>
I would like to make a barchart
2010 Sep 01
1
transaction object - how to coerce this data
Hi,
I am wanting to look at frequent item sets using the arules package. I need
to transform my data into a "transactions" object. The data I read in from a
file has 2 columns, an ID and an item. How do I convert data like this into
a transactions object?
I've tried
class? transactions
but it only confuses me.
My data is like this....
basketID item
1 bread
1 cheese
1 milk
2
1998 Mar 03
1
":" (seq) bug -- should not always coerce to integer!
The problem seems that ":" always coerces to integer, but should not..
9.9:12
## R: [1] 9 10 11
## S-plus 3.4: [1] 9.9 10.9 11.9
## and many more examples....
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or
2011 Jan 11
1
how to coerce part of each column of a matrix to a vector and merge them
Hello
Suppose I have a matrix mat=(1:16,2)
[,1] [,2] [,3] [,4]
[1,] 1 5 9 13
[2,] 2 6 10 14
[3,] 3 7 11 15
[4,] 4 8 12 16
there is a vector end=c(2,3,1,3)
#coerce the 1st 2 numbers of the 1st column to a vector [1] 1 2
#coerce the 1st 3 numbers of the 2nd column and append it to the previous vector [1] 1 2 5 6 7
#coerce the 1st number of
2012 Nov 29
1
Coerce rownames to factor for ordering
Hi all,
I think this might be an easy one but I cannot think of a way to do this
other than what I am currently attempting. I simply want to sort my data
frame's rownames by a defined vector so that the plots I generate from that
vector are in the desired order
Consider the test data below:
#Create test data
DataToPlot.. <- data.frame("Location1" =
2010 Feb 20
1
coerce (list) object to type 'double'
Dear all,
I am really new to R, and I have problem here. I searched around, but did
not get a solution.
I have a numetrix matrix (20 by 25) saved in .csv. I read it as
>sx<-read.csv("sx.csv",header=F)
Then I try to convert it to numeric using
>sx<-as.numeric(sx)
Error: (list) object cannot be coerced to type 'double'
The class of sx is "data.frame".
I
2006 Jan 23
2
Master's project to coerce linux nvidia drivers to run generalised linear models
Hi,
I am working with a friend on a master's project. Our laboratory does a
lot of statistical analysis using the R stats package and we also have a
lot of under-utilised nvidia cards sitting in the back of our networked
linux machines. Our idea is to coerce the linux nvidia driver to run
some of our statistical analysis for us. Our first thought was to
specifically code up a version of
2009 Jun 17
1
Coerce rectangular matrix to symmetrical square matrix
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have a rectangular matrix of size 920 by 85. I'd like to coerce it into a
square matrix such that all row/col names are present in the new matrix and the
additional values are zero.
As an example:
A B C D
A 1 2 3 4
E 5 6 7 8
F 9 10 11 12
Would be coerced to:
A B C D E F
A 1 2 3 4 5 9
B 2 0 0 0 6 10
C 3 0 0
2001 Feb 23
1
as.formula and lme ( Fixed effects: Error in as.vector(x, "list") : cannot coerce to vector)
Using a formula converted with as.formula with lme leads
to an error message. Same works ok with lm, and with
lme and a fixed formula.
# demonstrates problems with lme and as.formula
demo<-data.frame(x=1:20,y=(1:20)+rnorm(20),subj=as.factor(rep(1:2,10)))
demo.lm1<-lme(y~x,data=demo,random=~1|subj)
print(summary(demo.lm1))
newframe<-data.frame(x=1:5,subj=rep(1,5))
2012 Oct 16
2
cannot coerce class '"rle"' into a data.frame
why?
> rle
Run Length Encoding
lengths: int [1:1650061] 2 2 8 2 4 5 6 3 26 46 ...
values : chr [1:1650061] "4bbf9e94cbceb70c BG bg" "4fbbf2c67e0fb867 SK sk" ...
> as.data.frame(rle)
Error in as.data.frame.default(vertices.rle) :
cannot coerce class '"rle"' into a data.frame
it seems that
rle.df <-
2003 Sep 08
2
How do I coerce numeric factor columns of data frame to vector?
I have just noticed that quite a few columns of a data frame that I am
working on are numeric factors. For summary() purposes I want them to be
vectors. I tried, for example
> indx <- c(1:18,21:37,40,41)
> i <- 0
> i <- i+1
> summary(as.vector(sflows1[indx[i]]))
Length Class Mode
min.pkt.sz 3000 factor numeric
but this does not give the five-number