Displaying 20 results from an estimated 246 matches for "inelegent".
Did you mean:
inelegant
2013 Feb 14
3
list of matrices --> array
i'm somehow embarrassed to even ask this, but is there any built-in
method for doing this:
my_list <- list()
my_list[[1]] <- matrix(1:20, ncol = 5)
my_list[[2]] <- matrix(20:1, ncol = 5)
now, knowing that these matrices are identical in dimension, i'd like
to unfold the list to a 2x4x5 (or some other permutation of the dim
sizes) array.
i know i can initialize the array, then
2003 Apr 02
19
Combining the components of a character vector
Dear Help,
Suppose I have a character vector.
x <- c("Bob", "loves", "Sally")
I want to combine it into a single string: "Bob loves Sally" .
paste(x) yields:
paste(x)
[1] "Bob" "loves" "Sally"
The following function combines the character vector into a string in the
way that I want, but it seems somewhat inelegant.
2002 Dec 12
4
sum a list of vectors
In Mathematica there is a neat feature, where you can change the head of a list from "list" to say "+" and obtain a sum of the list elements.
I can't find a way to sum a list of vectors of same length or list of matrices of the same dimension and was curious if something like that exists in R. do.call("+",list) doesn't work because "+" accepts only
2008 Jan 20
3
Bugs through R in Mac
Hello,
I recently changed from Win XP to Mac OS X (10.5.1).
Is there a way to run Bugs (in any version) in R (R version 2.6.0
(2007-10-03)) on this platform?
Fredrik
2008 Sep 14
3
Using R from Java
Hello,
I am interesting in using R from a web application, for basic statistics and
plots. The server is Java-based (tomcat).
The simplest solution is a system call that generates the text or the image,
then the servlet forwards the output. This can be done from any language,
but it is quite inelegant and slow for the initialization time.
Is there any package or approach for accessing R from a
2003 Aug 20
5
Interlacing two vectors
I want to interlace two vectors. This I can do:
> x <- 1:4
> z <- x+0.5
> as.vector(t(cbind(x,z)))
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5
but this seems rather inelegant. Any suggestions?
Murray
--
Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz
2003 Mar 31
4
Convert char vector to numeric table
I'm a great fan of read.table(), but this time the data had a lot of cruft. So I used readLines() and editted the char vector to eventually get something like this:
" 23.4 1.5 4.2"
" 19.1 2.2 4.1"
and so on. To get that into a 3 col numeric table, I first just used:
writeLines(data,"tempfile")
2011 Mar 29
3
passing arguments via "..."
I would like to do something like the following:
Fancyhist<-function(x,...) {
# first, process x into xprocess somehow, then ...
if (is.null(breaks)) { # yes, I know this is wrong
# define the histogram breaks somehow, then call hist:
hist(xprocess,breaks=breaks,...)
} else {
# use breaks give in calling argument
hist(xprocess,...)
}
}
But, those of you who know R better
2007 Jan 11
1
Matching on multiple columns
Am I correct in believing that one cannot match on multiple columns?
One can indeed subset on multiple criteria from different variables
(or columns) but not from unique combinations thereof.
I need to exclude about 10000 rows from 108000 rows of data based on
several unique combinations of identifiers in two columns. Only
merge() seems to be able to do that. Merge would allow me to
positively
2006 Nov 04
8
alternatives to script/runner?
I''ve been using script/runner to add and delete files from the
database in response to inotify events. This works in theory, but is
too slow to keep up with a large number of events in succession; I''m
suspecting that the bottleneck is that script/runner has a huge
startup cost.
One thing I thought of was to queue inotify events, and call
script/runner once a minute to clear the
2005 Jan 05
4
output from table() in matrix form
Hi
How do I get the output from table() in matrix form?
If I have
R> table(c(1,1,1,1,2,20))
1 2 20
4 1 1
I want
[,1] [,2] [,3]
[1,] 1 2 20
[2,] 4 1 1
The problem is that names(table) is a vector of characters and I need
the numeric values.
I am using
R> rbind(as.integer(names(x)),x)
I thought tabulate() might be better as it takes an
1999 Aug 02
2
zero replacement
AARRGGHH! Sometimes it's the simple things that are particularly frustrating,
especially late at night....
Can anyone suggest a simple means for replacing all of the zero values in a
matrix with NANs? I ended up writing an awk script to massage the input file,
which works, of course, but is rather an inelegant blunt instrument. I'd
prefer an R operation. I'm certain that
2008 Apr 14
2
Plotting with exact axis limits
Hello,
If I make a plot, say something simple like
plot( runif(100) )
then the origin (0,0) is not at the bottom-left corner of the box
surrounding the plot. The axis limits are "padded" slightly. This is
ordinarily a good feature, because it makes plots look better. But now I
would like to make a plot with the origin exactly on the bottom left.
Through trial and error, I have
2005 Apr 02
2
An exercise in the use of 'substitute'
I would like to create a method for the generic function "with" applied
to a class of fitted models. The method should do two things:
1. Substitute the name of the first argument for '.' throughout the
expression
2. Evaluate the modified expression using the data argument to the
fitted model as the first element of the search list.
The second part is relatively easy. The
2009 Mar 10
2
1.4.23 + Realtime Queues/Agents NOT via SIP
I'm working on a project that involves Queues with Agents that are at home
with a PSTN phone number, NOT connected via SIP phones.
In the queues.conf it clearly states that only the SIP driver supports "In
Use" detection of making members of a Queue available or unavailable.
I've not yet figured out the best way to handle this. Currently I've got a
macro that is executed
2010 Feb 05
2
[LLVMdev] Basic block with two return instructions
Fair enough. In that case, is there an elegant way to test whether a
basic block already has a terminator instruction?
(I can think of several ways to do it in the front-end, but all of
them are fairly inelegant. The problem I'm trying to solve is things
like 'a return instruction needs to be added to the end of a function,
if and only if the programmer didn't already end the function
2017 Sep 28
3
building random matrices from vectors of random parameters
Suppose I have interest in a matrix with the following symbolic
structure (specified by 3 parameters: sa, so, m):
matrix(c(0,sa*m,so,sa),2,2,byrow=T)
What I can't figure out is how to construct a series of matrices, where
the elements/parameters are rnorm values. I'd like to construct separate
matrices, with each matrix in the series using the 'next random
parameter value'.
2010 Jul 16
2
aggregate(...) with multiple functions
hi all - i'm just wondering what sort of code people write to
essentially performa an aggregate call, but with different functions
being applied to the various columns.
for example, if i have a data frame x and would like to marginalize by
a factor f for the rows, but apply mean() to col1 and median() to
col2.
if i wanted to apply mean() to both columns, i would call:
aggregate(x, list(f),
2007 Jan 14
3
ListCtrl help
Is there any sample code around that sorts a virtual listctrl?
I have loaded data into a ListCtrl and set things up so that if I
click on a column heading on_col_left_click(event) gets called and it
in turn sorts / reverses the sort of that column. I am printing out
the data for debugging purposes so I know that my internal data
representation is getting sorted but I nothing is getting
2007 Mar 16
1
cumsum over varying column lengths
Folks,
I have a matrix of historicalReturns, where entry (i, j) is the daily return
corresponding to date i and equity j. I also have a matrix startOffset,
where entry (1, k) is the row offset in historicalReturns where I entered
into equity k.
So we have that NCOL(startOffset) = NCOL(historicalReturns).
Now I would like compute for each column in historicalReturns, the
cumulative return