Displaying 20 results from an estimated 1000 matches similar to: "uneven list to matrix"
2007 Jun 18
3
String manipulation, insert delim
Hello All,
I've been using R for two years now and I am happy to say this is the
first time I could not find the answer to my problem in the R-help
archives. Here is the pending problem:
I want to be able to insert delimiters, say commas, into a string of
characters at uneven intervals such that:
foo<-c("haveaniceday")#my string of character
bar<-c(4,1,4,3) # my vector of
2007 Dec 20
2
factor manipulation: edgelist to a matrix?
Hello All,
I have had considerable bad luck with attempting the following with for
loops. Here is the problem:
# Suppose we have a data.frame with the following data, which can be
considered a type of edgelist (for those with networks backgrounds):
#
# V1 V2
# 1 A
# 1 A
# 1 B
# 2 A
# 3 C
# 3 A
# 3 C
# 3 B
#
# I want the output of the function to produce a matrix, such that #each
factor of
2008 Apr 03
2
iterative loop with user input?
Hello R-Users,
I would like to use an iterative loop to collect user input from within a
function. I'm sure that this would be some combination of "for","break",
and "next" but have not been able to get the syntax down.
I would like to print some text to the screen at each step in the loop,
ask the user for input which is saved in an object, and then advance the
2012 Jul 12
3
Add row into a Matrix witout headers from Function
Hi,
Here i have a matrix like this,
OLDMatrix <-
X1 X2 X3
----- ------ ------
22 24 23
25 27 27
10 13 15
the thing is,
im running two function(SUM,COUNT) to get output in another matrix called
NEWMatrix
NEWMatrix <- c("SUM",colSums(OLDMatrix ))
NEWMatrix <- c("COUNT",colSums(!is.na(OLDMatrix
2003 Oct 29
3
PXELinux cannot load the config file
I have DHCP and TFTP on a Solaris machine, pxelinux.0 loads, but it
can't load the configuration file. The tftp server on Solaris tries to
send the file, but data transfers do not receive ACKs. Previous posts
to this list have indicated that the suspect was the PXE BIOS (ref
"PXELinux can't load the config file?" dated March 20, 2003). Does that
still appear to be the case
2010 Jan 08
2
A better way to Rank Data that considers "ties"
This will start off sounding very easy, but I think it will be very
complicated.
Let's say that I have a matrix, which shows the number of apples that each
person in a group has.
OriginalMatrix<-matrix(c(2,3,5,4,6),nrow=5,ncol=1,byrow=T,dimnames=list(c("Bob","Frank","Joe","Jim","David"),c("Apples")))
Apples
Bob 2
2007 Sep 14
1
Copying row names
I have been trying to copy the row names of one matrix to another matrix but
having difficulty. The original matrix contains a row name which I would
like to replicate in the new matrix. I use the following approach?
The two matrices have identical dimensions.
rN <- row.names(origMatrix)
row.names(newMatrix) <- rN
However the new matrix does not take on the labels.
I have also tried,
2005 Apr 21
1
large matrix
Dear R-users
I need to convert a matrix with three columns in a new array with
multiple columns.
For example,
oldmatrix
1 4 5
1 54 52
1 9 43
2 32 5
2 54 6
2 76 6
3 54 54
3 543 7
3 54 6
newmatrix
5 5 54
52 6 7
43 6 6
if the first column have a new value then add a column to the new
matrix and the new[i,j] <- old[,3][i]
I write this code, but my initial matrix is very
2007 Feb 27
5
Multiple conditional without if
Dear all,
i am stuck with a syntax problem.
i have a matrix which has about 500 rows and 6 columns.
now i want to kick some data out.
i want create a new matrix which is basically the old one except for all
entries which have a 4 in the 5 column AND a 1 in the 6th column.
i tried the following but couldnĀ“t get a new matrix, just some wierd
errors:
2010 Jan 28
2
NA Replacement by lowest value?
Hi all,
I need to replace missing values in a matrix by 10 % of the lowest available value in the matrix. I've got a function I've used earlier to replace negative values by the lowest value, in a data frame, but I'm not sure how to modify it...
nonNeg = as.data.frame(apply(orig.df, 2, function(col) # Change negative values to a small value, close to zero
{
min.val =
2018 Mar 12
1
Equivalent of gtools::mixedsort in R base
x <- c( "a1", "a10", "a2" )
y <- c( "b10", "b2", "a12", "ca1" )
DF <- expand.grid( x = x, y = y )
# randomize
set.seed( 42 )
DF <- DF[ sample( nrow( DF ) ), ]
# missing from gtools
mixedrank <- function( x ) {
seq.int( length( x ) )[ gtools::mixedorder(x) ]
}
o <- do.call( order, lapply( DF, mixedrank ) )
2012 Oct 24
2
Ceph samba size reporting troubles
Dear developement team,
I want to share a massive storage casted with Ceph by samba with
windows workstations.
All works well. My problem so is that in windows the ceph storage size
statistics are wrong. Instead of seeing a 44TB hard drive I see a 176GB
hard drive.
Under linux that issue doesn't show. The size are properly reported.
I investigated around and it seems that the problem
2009 Apr 06
2
Bonpower Crashes Trying Sparse Matrix (Igraph)
Hello All,
I have been trying to do bonpow for a while now.Bonpow works for few graphs
and for few others it goes out of memory.
I did see reply to one of the posting Alph Centrality Crashed in Igraph
memory error.
The solution in the posting was to use sparse matrix. This is the link of
the message.
http://lists.gnu.org/archive/html/igraph-help/2008-04/msg00071.html
I was able to obtain
2004 Oct 22
3
pgamma discontinuity (PR#7307)
Full_Name: Morten Welinder
Version: 2
OS: Solaris/space/gcc2.95.2
Submission from: (NULL) (65.213.85.217)
I changed src/nmath/standalone/test.c to read:
---------------------------------------------------------------------------------
#define MATHLIB_STANDALONE 1
#include <Rmath.h>
#include <stdio.h>
int
main()
{
double x;
for (x = 99990; x <= 100009; x++)
printf
2011 Jul 07
2
kripp.alph error message
Hi! I fairly new to R, have only done pretty basic things so far, so this may
be a very basic question..... But I did search the forums and didn't see a
solution....
I'm trying to get going with kripp.alpha(). I'm loading data from a file,
like this:
> library(irr)
Loading required package: lpSolve
> x <- read.table("foo", comment.char="#", header=TRUE,
2013 Oct 15
1
Problem with lapply
Hi together
I'm pretty new to R, so excuse me if it is a basic question.
I have a big dataset (extract of it found in the attachment) of returns from
firms. I'd like to compute the Pearson correlation of each firm with the
"Market" and the corresponding p-Value. So I thought of making a list of
'cor.test's and then extract the needed values with a for loop. What I did
so
2004 Jan 15
1
Exactness of ppois
Hello,
by checking the precision of a convolution algorithm, we found the
following "inexactness":
We work with R Version 1.8.1 (2003-11-21) on Windows systems (NT, 2000,
XP).
Try the code:
## Kolmogorov distance between two methods to
## determine P(Poisson(lambda)<=x)
Kolm.dist <- function(lam, eps){
x <- seq(0,qpois(1-eps, lambda=lam), by=1)
max(abs(ppois(x,
2004 Sep 29
1
glm.fit and predict.glm: error ' no terms component'
Hi
when I fit a glm by
glm.fit(x,y,family = binomial())
and then try to use the object for prediction of newdata by:
predict.glm(object, newdata)
I get the error:
Error in terms.default(object) : no terms component
I know I can use glm() and a formula, but for my case I prefer
glm.fit(x,y)...
thanks for a hint
christoph
$platform
[1] "i686-pc-linux-gnu"
$arch
[1]
2005 May 05
2
efficient filtering of matrices
I was wondering if someone can tell me the best way to search through a
matrix and choose certain rows (based on certain conditions) to put into a
separate matrix.
What I have tried so far is very slow for a large dataset I'm working with.
e.g., I have this piece of code to create a new matrix (newmat) based on my
filtering conditions. Do I need to do this kind of thing where I keep
2006 Jan 27
0
pgamma - inadequate algorithm design and poor coding (PR#8528)
R versions 2.1.0 to present.
Examples shown were computed under Windows R-devel, current SVN, but ix86
Linux shows similar behaviour (sometimes NaN or -Inf rather than Inf,
depending on the compiler and optimization level used).
The replacement pgamma algorithm used from R 2.1.0 has an inadequate
design and no supporting documentation whatsoever. There is no reference
given to support the