Displaying 20 results from an estimated 9000 matches similar to: "Adding matrix rows that have the same name?"
2010 Mar 24
0
R-help ordinal regression
Dear colleagues,
i am carrying out an ordinal regression model. I try it on SPSS but I "flirt" with R as well. I have a few questions.
1. What is the most reliable/tested/trusted package for ordinal regression in the R world?
2. Also, I have a statistical question. What is the danger of having to many 'empty cells' in ordinal regression? How many empty cells are too many? Do
2010 Mar 30
2
jpeg() saving blank files?
Hi,
I am having trouble saving graphics from R. jpeg() saves a file with
the correct name to the correct directory, but it consists of a blank
(white) jpeg with the specified dimensions--the image itself is not
being saved.
My code is
jpeg(filename="myfile.jpg",
height = 2.5, width = 8, units = "in", res = 72,
pointsize = 12, quality = 100, bg = "white",
2017 Jun 27
2
paste strings in C
Dear R-devs,
Below is a small example of what I am trying to achieve, that is trivial in
R and I would like to learn how to do in C, for very large matrices:
> (mymat <- matrix(c(1,0,0,2,2,1), nrow = 2))
[,1] [,2] [,3]
[1,] 1 0 2
[2,] 0 2 1
And I would like to produce:
[1] "a*C" "B*c"
Which can be trivially done in R via something like:
foo
2010 Jul 15
2
replace negative numbers by smallest positive value in matrix
Hi Group,
I have a matrix, and I would like to replace numbers less than 0 by
the smallest minimum number. Below is an
small matrix, and the loop I used. I would like to get suggestions on
the "R way" to do this.
Thanks,
Juliet
# example data set
mymat <- structure(c(-0.503183609420937, 0.179063475173256, 0.130473004669938,
-1.80825226960127, -0.794910626384209, 1.03857280868547,
2008 Sep 21
1
How to put given values in lower triangle of splom-plot?
Dear R-experts,
I have found a splom-modification online which is given below. This
works perfectly, but I would like to have a matrix of given
correlation values to be used in the lower triangular part
(lower.panel) of the splom-plot instead of calculated correlation
values. Here is the matrix I would like to use (it can be any other
convenient data structure):
2011 Oct 01
1
class definition
Hi everybody!
I have a matrix of class "myClass", for example:
myMat <- matrix(rnorm(30), nrow = 6)
attr(myMat, "class") <- "myClass"
class(myMat)
When I extract part of ''myMat'', the corresponding class ''myClass'' unfortunately disappear:
myMat.p <- myMat[,1:2]
class(myMat.p)
Please for any advice / suggestions, how
2010 Apr 07
1
Customizing ordination plots using symbols for factors
Hi,
I could use a hand solving a fairly straightforward ordination plot problem:
I am conducing NMDS on some community data for roughly 300 localities
and 650 species. I have a community matrix, a species attribute
matrix, and an environmental attributes matrix. After running metaMDS
{vegan} on the community matrix, I can successfully use either of the
other two matrices to draw hulls around
2006 Mar 21
1
rownames, colnames, and date and time
I noticed something surprising (in R 2.2.1 on WinXP)
According to the documentation, rownames and colnames are character vectors.
Assigning a vector of class POSIXct or POSIXlt as rownames or colnames
therefore is not strictly according to the rules.
In some cases, R performs a reasonable typecast, but in some other cases
where the same typecast also would be possible, it does not.
Assigning a
2006 Mar 21
1
rownames, colnames, and date and time
I noticed something surprising (in R 2.2.1 on WinXP)
According to the documentation, rownames and colnames are character vectors.
Assigning a vector of class POSIXct or POSIXlt as rownames or colnames
therefore is not strictly according to the rules.
In some cases, R performs a reasonable typecast, but in some other cases
where the same typecast also would be possible, it does not.
Assigning a
2006 Jul 03
1
rownames, colnames, and date and time
Hi all
I was wondering whether there has ever been an update on the rownames and
colnames behaviour as described by Eric below?
I still get the same behaviour, exactly as described by Eric, on my WinXP
installation of R-2.3.0. I also posted a message to r-help on Friday but
looking through the online archives it seems to have not made it to the
list. I would agree with Eric that a consistent
2002 Dec 04
1
using edit.data.frame
dum is a simple data frame transferred to Splus using the dump()
command in Splus and the source() in R. All fields are numeric. There
are no missing data. The data frame looks like it is should:
> apply(dum,2,mode)
yrcl sland s02 s234
"numeric" "numeric" "numeric" "numeric"
> apply(dum,2,is.vector)
yrcl sland s02 s234
2009 Aug 26
3
changing equal values on matrix by same random number
Dear all,
I have about 30,000 matrix (512x512), with values from 1 to N.
Each value on a matrix represent a habitat patch on my
matrix (i.e. my landscape). Non-habitat are stored as ZERO.
No I need to change each 1-to-N values for the same random
number.
Just supose my matrix is:
mymat<-matrix(c(1,1,1,0,0,0,0,0,0,0,0,
0,0,0,0,2,2,2,0,0,0,0,
0,0,0,0,2,2,2,0,0,0,0,
3,3,0,0,0,0,0,0,0,4,4,
2017 Jan 09
1
problem with print.generic(x)deparse(substitute(x))
Hi, Peter et al.:
On 2017-01-09 4:24 AM, peter dalgaard wrote:
> On 09 Jan 2017, at 10:53 , Spencer Graves <spencer.graves at prodsyse.com> wrote:
>
>> # Define an object of class 'dum'
>> k <- 1
>> class(k) <- 'dum'
>> str(k) # as expected
>>
>> # Define print.dum
>> print.dum <- function(x, ...)
>>
2017 Jan 09
2
problem with print.generic(x)deparse(substitute(x))
Hi, All:
I'm having trouble getting deparse(substitute(x)) inside
print.generic to consistently
I'm having trouble getting a print.something to work
consistently. Consider the following toy example:
# Define an object of class 'dum'
k <- 1
class(k) <- 'dum'
str(k) # as expected
# Define print.dum
print.dum <- function(x, ...)
2005 Oct 11
1
problems with levelplot and contourplot
Hello,
Using the following code i want to make a level or contourplot of some
data that I produced
library(grid);library(lattice);
mydata <- read.table("avgee.dat");
mymat <- as.matrix(mydata);
mymat <-t(mymat)
vals<-as.vector(mymat);
conc<-c(0.0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5);
a<- c(0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5,5.0,
7.5,10,
2011 Aug 25
2
How to store the output of a loop into a matrix??
Hello,
I want to create a matrix of N random numbers with a uniform distributions. Later, I want to repeat T times each row of this matrix. For this I do the following loop:
N<-45
T<-10
n<-N*T
a<-matrix(runif(N,min=-1,max=1),nr=N)
mymat<-matrix(rep(NA,n),nr=n,nc=1)
for(i in i:N){
b<-rep(a[i,],T)
mymat[i,]<-b
}
Mi problem is that with this loop I can see the output of the
2010 Jan 15
1
Lattice: How to color the data points in splom() according to the panel they are plotted?
Dear ExpeRts,
I have the scatter plot matrix as given below. I would like the different "sub-plots" in the scatter plot matrix to be colored differently. How do I get all points shown in the upper-left plot (on position (1,1) in the scatter plot matrix) to be plotted in blue, and the points shown in the plot to the right (on position (1,2) in the scatter plot matrix) to be plotted in
2005 Mar 09
2
Question about biasing in sd()???
Hi,
Can anyone help me with the following. I have been using R for Monte
Carlo simulations and got some results I couldn't explain. Therefor I
performed following short test:
--------------
mean.sds <- NULL
sample.sizes <- 3:30
for(N in sample.sizes){
dum <- NULL
for(I in 1:5000){
x <- rnorm(N,0,1)
dum <- c(dum,sd(x))
}
mean.sds<- c(mean.sds,mean(dum))
}
2011 Feb 21
1
Query: matrix definition
Dear list users,
if within a function I first define a matrix
mymat <- matrix(NA, nrow=m, ncol=n)
and somewhere afterwards by mistake
mymat <- c(1,2,3)
this second command deletes the first one.
How can I make sure that within the function mymat will always remain the matrix defined at the beginning, without possibility of changing it throughout the code?
Secondly, is it possible to define
2009 Nov 12
1
how to pass matrices from C to R effectively
Hi,
I have C code to produce a lot of matrices to be analyzed. As these
matrices are large (> 1000*10000) and are a lot (> 1000), I am thinking
about how to pass them from C to R effectively.
Would you think about the following solution? In R, I create a wrapper
function
passDataFromCToR = function(row, col) {
mat = matrix(0, row, col)
.C("passDataFromCToR",mat)[[1]]
}