Displaying 20 results from an estimated 130 matches similar to: "subset in a matrix"
2009 Feb 11
2
sorting a matrix by the column
this is a bad question but I can't figure it out and i've tried. if i
sort the 2 column
matrix , temp1, by the first column, then things work as expected. But,
if I sort the 1 column matrix, temp2, then it gets turned coerced to a
vector. I realize that I
need to use drop=FALSE but i've put it in a few different places with no
success. Thanks.
temp1 <-
2008 Jun 17
2
Reshape or Stack? (To produce output as columns)
Dear all,
I have used 'read.table' to create a data frame of 720 columns and 360 rows (and assigned this to 'Jan'). The row and column names are numeric:
> columnnames <- sprintf("%.2f", seq(from = -179.75, to = 179.75, length = 720)).
> rnames <- sprintf("%.2f", seq(from = -89.75, to = 89.75, length = 360))
> colnames(Jan) <- columnnames
2010 Feb 22
1
rownames cannot allocate vector of size
Hi,
On R 2.10.1 for Windows, when I do the following to duplicate the
structure of a large numeric matrix called matrix1:
matrix2 <- matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1))
and then
rownames(matrix2) <- rownames(matrix1)
I get a "cannot allocate vector of size xxMb" error
but if I instead do:
rnames <- list()
rnames <- rownames(matrix1)
matrix2 <-
2010 Mar 22
1
sets package: converting a set to data frame?
I just started using nice package "sets"
and I wonder if there are utilities to convert (some) sets to data frame
(as in the example below)
> library(sets)
> a <- gset(elements = list(e('A', 0.1), e('B', 0.8)))
> lst <- as.list(a)
> nr <- length(lst)
> rnames <- character()
> for (i in 1:nr) rnames[i] <- lst[[i]]
> df <-
2008 Oct 20
2
convert matrix to dataframe with repeating row names
Hi R,
I have a matrix x with repeating row names.
> dim(x)
[1] 862 19
zz<-matrix(0,4,4)
rownames(zz)=c("a","a","b","b")
data.frame(zz) (?)
I need to use x in a linear regression
lm(as.formula(paste("final_dat[,5]~",paste(colnames(x),collapse="+"))),x
)
this gives me a error
Error in
2009 Feb 20
6
write.table
Hello,
I tried to turn lists into vectors and then bind them together in order to create a dataframe but if, after this, I
try to use the function write.table I get the following error message:
Error in write.table(x, file, nrow(x), p, rnames, sep, eol, na, dec, as.integer(quote), :
'list' type not implemented in 'EncodeElement'
Here is what I've done:
2004 Feb 25
2
PWM Help
I saw a Help e-mail related to MLE. Does R have a probability weighted method (PWM) estimator function? I can't seem to find anything on PWM, unless my eyes are playing trick on me.
[[alternative HTML version deleted]]
2002 Jun 21
1
naming things in functions
Hello,
I'm working with R version 1.5.0 in Windows. I've written a function
(SummaryMat, segment below) which uses a loop to
repeatedly call another function (PercentsMat, segment below).
PercentsMat creates a matrix and adds rows to it each time it is called.
I use deparse(substitute(...)) to get the names of the lists sent to
PercentsMat to use them as row names in the generated
2008 Jul 15
3
Melt (reshape) question
Dear all,
I
have a grid of 720 columns by 360 rows of global population density
values, and hope to convert this to column format using the 'melt' command in the 'reshape' package. I'm not receiving
any errors as such, but when the code has finished running, my output
looks like this:
> head(PopDens.long)
Latitude Longitude PopDensity
1 -84.75 V1 0
2
2007 Feb 19
3
Randomly extract rows from a data frame
Hi,
I am looking for a way to randomly extract a specified number of rows from a
data frame. I was planning on binding a column of random numbers to the
data frame and then sorting the data frame using this bound column. But I
can't figure out how to use this column to sort the entire data frame so
that the content of the rows remains together. Does anyone know how I can
do this? Hints
2008 Jan 04
2
R2WinBUGS sending variables as factors
Hello R and BUGS users,
I am writing a heirarchical model in R to send to BUGS via R2WinBUGS and
I am finding it difficult to get the model to run. I seem to be having
two problems.
1) I can't seem to send variables classed as factors (Month), is there a
way do this?
2) Checking the Log in WinBUGS I can see that the model is Syntactically
correct, but Bugs is not able to recognise the the
2009 Apr 08
2
Reshape - strange outputs
Dear R Users,
I am using the reshape package to reformat gridded data into column format using the code shown below. However, when I display the resulting object, a single column is fomed (instead of three) and all the latitude values (which should be in either column one or two) are collected at the bottom. Also, the NA values aren't removed, despite this being requested in the code.
Code:
2012 Apr 29
2
Count number of rows in a matrix with a character pattern
Hi,
I have a large data set that I input as a matrix, where I have 1:x rows
with names AX, then x+1: y rows named AY, etc. The idea is that I have to
count how many rows exactly I have with name AX and how many I have with
name AY (or find which row numbers have names AX). Is there any way in R to
count a number of rows with a name matching a required pattern?
Thanks in advance,
Katie
--
2008 Nov 20
5
summary statistics into table/data base, many factors to analyse
Dear list,
I reduced my data to the following:
x <- c(1,4,2,6,8,3,4,2,4,5,1,3)
y <- as.factor(c(2,2,1,1,1,2,2,1,1,2,1,2))
z <- as.factor(c(1,2,2,1,1,2,2,3,3,3,3,3))
I can produce the statistical summary just fine.
s1 <- tapply(x, y, summary)
d1 <- tapply(x, y, sd)
s2 <- tapply(x, z, summary)
d2 <- tapply(x, z, sd)
First thing:
I have 100 plus factors to analyse. Theirs
2010 Jul 16
1
Troubles with DBI's dbWriteTable in RMySQL
I am feeling rather dumb right now.
I created what I thought was a data.frame as follows:
aaa <- lapply(split(moreinfo,list(moreinfo$m_id),drop = TRUE), fun_m_id)
m_id_default_res <- do.call(rbind, aaa)
print("==========================================")
m_id_default_res
print("==========================================")
ndf <- m_id_default_res[, c('mid',
2007 Jul 30
50
boot a existing windows in hvm domain
Hi all
don''t get such envionment to try now. so ask for help here.
imagine that two os installed.
Xen3.1 + Linux is installed in /dev/hda
and windows xp is installed in /dev/hdb
I don''t want to reboot to use windows. Is it possiable to boot the hdb
windows in xen?
i saw there are some threads about P2V in this mail list. will the P2V
tools help?
thanks
2007 Jul 30
50
boot a existing windows in hvm domain
Hi all
don''t get such envionment to try now. so ask for help here.
imagine that two os installed.
Xen3.1 + Linux is installed in /dev/hda
and windows xp is installed in /dev/hdb
I don''t want to reboot to use windows. Is it possiable to boot the hdb
windows in xen?
i saw there are some threads about P2V in this mail list. will the P2V
tools help?
thanks
1998 May 30
9
"Flavors of Security Through Obscurity"
This was posted not too long ago on sci.crypt... Enjoy... I think the most
relevant information is near the top, but it''s all quite good... :-)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
There is no intrinsic difference between algorithm and data, the
same information can be viewed as data in one context and as
algorithm in another. Why then do so many people claim that
encryption algorithms
2013 Oct 27
2
Heteroscedasticity and mgcv.
I have a two part question one about statistical theory and the other
about implementations in R. Thank you for all help in advance.
(1) Am I correct in understanding that Heteroscedasticity is a problem for
Generalized Additive Models as it is for standard linear models? I am
asking particularly about the GAMs as implemented in the mgcv package.
Based upon my online search it seems that some
2017 Mar 20
2
IO error when writing to disk
Hello,
Here a small improvement for R.
When you use the function write.table, if the disk is full for example, the
function doesn't return an error and the file is written but truncated.
It can be a source of mistakes because you can then copy the output file
and think everything is ok.
How to reproduce
-------------------------
>> write.csv(1:10000000, 'path')
You must have