Displaying 20 results from an estimated 100 matches similar to: "moving onto returning a data.frame?"
2001 Dec 14
2
colSums in C
Hi, all!
My project today is to write a speedy colSums(), which is a function
available in S-Plus to add the columns of a matrix. Here are 4 ways to do it,
with the time it took (elapsed, best of 3 trials) in both R and S-Plus:
m <- matrix(1, 400, 40000)
x1 <- apply(m, 2, sum) ## R=16.55 S=52.39
x2 <- as.vector(rep(1,nrow(m)) %*% m) ## R= 2.39 S= 8.52
x3 <-
how to count the total number of (INCLUDING overlapping) occurrences of a substring within a string?
2009 Dec 20
1
how to count the total number of (INCLUDING overlapping) occurrences of a substring within a string?
Last one for you guys:
The command:
length(gregexpr('cus','hocus pocus')[[1]])
[1] 2
returns the number of times the substring 'cus' appears in 'hocus pocus'
(which is two)
It's returning the number of **disjoint** matches. So:
length(gregexpr('aa','aaa')[[1]])
[1] 1
returns 1.
**What I want to do:**
I'm looking for a way to count
2015 Oct 15
2
selinux commands fail on low memory box
Hey all,
I have 3 web servers hosted at Digital Ocean that all have the same amount
of memory at 512MB. They're all running CentOS 7.
They are low powered apache servers and don't really need more than that.
All they're doing is serving the web, no database on those hosts at all.
On the first two hosts I seem to have no trouble running SELinux related
commands. It's only on
2006 Jun 27
5
Ajax - Inserting selected elements from request.responseText
After retrieving a URL using an Ajax.Request...
function onComplete (request, json) {
// request.responseText holds the entire page
Only the content contained in elementID = ''source'' is intended for display
At this time, the following code works, but it disturbingly copies the
entire page from the source URL into the target DIV
$(''target'').innerHTML =
2005 Nov 22
4
the matrix of rows with specific row sums
I am just starting with R and have the following problem: given a matrix
of ones and zeroes, say
mdim=4
m<-matrix(round(runif(mdim^mdim)),mdim,mdim)
how to construct the matrix of those rows of m, whose elements sum to 2.
Contrary to the random matrix above, the actual matrix always has at
least one such row.
Serguei Kaniovski
2003 Jun 23
3
FW: S4 classes, creating in C
I am using C code to create an S4 object based on Douglas Bates's example
in his lecture notes on
<http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slide
s.pdf>
http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slides
.pdf
e.g.
SEXP La_DGE_dc(SEXP A)
{
SEXP aa = PROTECT(duplicate(A));
SEXP adims, pivot, val;
int
2015 Oct 15
0
selinux commands fail on low memory box
How about adding some swap into system?
--
Eero
2015-10-15 4:40 GMT+03:00 Tim Dunphy <bluethundr at gmail.com>:
> Hey all,
>
> I have 3 web servers hosted at Digital Ocean that all have the same amount
> of memory at 512MB. They're all running CentOS 7.
>
> They are low powered apache servers and don't really need more than that.
> All they're doing is
2015 Oct 15
1
selinux commands fail on low memory box
>
> How about adding some swap into system?
Not a bad idea, Eero! That worked.
[root at ops3:~] #cat /proc/swaps
Filename Type Size Used
Priority
/swapfile file 1048572 712 -1
[root at ops3:~] #semodule -i newrelic.pp
[root at ops3:~] #
Thanks!
Tim
On Thu, Oct 15, 2015 at 12:19 AM, Eero Volotinen
2004 Aug 06
0
Lose 17 Pounds In 7 Days ML
Hey there,
If you're like me, you've tried EVERYTHING to lose
weight. I know how you feel - the special diets,
miracle pills, and fancy exercise equipment never helped
me lose the pounds I need lose either. It seemed like
the harder I worked at it, the less weight I lost - until
I heard about 'Extreme Power Plus'.
You're probably thinking to yourself, "Oh geez, not
2004 Aug 06
0
Lose 20 Pounds In 14 Days ODEQT
Long time no chat!
How have you been? If you've been like me, you've been trying
trying almost EVERYTHING to lose weight. I know how you feel
- the special diets, miracle pills, and fancy exercise
equipment never helped me lose the pounds I needed to lose
either. It seemed like the harder I worked at it, the less
weight I lost - until I heard about 'Extreme Power Plus'.
2005 Oct 31
6
getting last 2 charcters of a string, other "text" functions?
I wish to obtain the right-most n characters of a character string? What is the appropriate function?
---------------------------------
[[alternative HTML version deleted]]
2012 Dec 06
1
Use .Call interface
Hi
I've written the following program:
#include <R.h>
#include <Rdefines.h>
#include "Projector.h"
SEXP Projector2(SEXP L, SEXP G, SEXP W, SEXP xymod, SEXP modif){
int nprot=0;
PROTECT(L=AS_NUMERIC(L));nprot++;
PROTECT(G=AS_NUMERIC(G));nprot++;
PROTECT(W=AS_NUMERIC(W));nprot++;
PROTECT(xymod=AS_INTEGER(xymod));nprot++;
PROTECT(modif=AS_NUMERIC(modif));nprot++;
2004 Jun 22
3
[Q] GET_DIM() crash on Windows only
I have the following contrived code in package format.
On Solaris and Mac OS X, code runs just fine. On Windows,
it crashes the R environment with the "Send Bug Report"
dialog. I tried R 1.8.1 (Win2K) and R 1.9 (WinXP) binaries
with the same result. PCs otherwise appear properly
configured for creating R packages. Anything blatantly
wrong? Suggestions?
TIA
Relevant files from package
2004 Jun 24
0
[SOLVED] GET_DIM() crash on Windows only
Paul Roebuck wrote:
>I have the following contrived code in package format.
>On Solaris and Mac OS X, code runs just fine. On Windows,
>it crashes the R environment with the "Send Bug Report"
>dialog. I tried R 1.8.1 (Win2K) and R 1.9 (WinXP) binaries
>with the same result. PCs otherwise appear properly
>configured for creating R packages. Anything blatantly
>wrong?
2007 May 22
2
inline C/C++ in R: question and suggestion
This is a question and maybe an announcement.
We've been discussing in the group that it would be nice to have a
mechanism for something like "inline" C/C++ function calls in R. I do
not want to reinvent the wheel, therefore, if something like that
already exists, please give me a hint -- I could not find anything. If
not, here is a working solution, please criticise so I could
2007 Feb 13
2
anyone has C++ STL classes stability issue if used with R
Hello,
is there any one who uses C++ STL classes when programming shared libs
for R and has had any problems with STL?
In the very simple example below I am constantly getting segfaults when
trying to populate the queue. The segfault occurs at what looks like a
random index in the loop when pushing another element to the queue.
Reproduced on 4 machines. Object x is an Image as in EBImage,
2006 Jan 27
1
rbind/cbind unimplemented for raw (RAWSXP) types. (PR#8529)
Full_Name: Hin-Tak Leung
Version: R 2.2.1
OS: x86_64-redhat-linux-gnu
Submission from: (NULL) (131.111.186.92)
rbind/cbind is unimplemented for raw (RAWSXP) types.
I have a working patch implementing the functionality,
to follow.
--please do not edit the information below--
Version:
platform = x86_64-redhat-linux-gnu
arch = x86_64
os = linux-gnu
system = x86_64, linux-gnu
status =
major
2005 Oct 25
1
Small issue with R's C API
Consider the R code:
mat <- matrix(seq(1,20),4,5)
is.matrix(mat) # gives TRUE
is.vector(mat) # gives FALSE
On the other hand, if mat is passed through the .Call interface the
corresponding SEXP (call it smat) satisfies
isMatrix(smat) // TRUE
isVector(smat) // TRUE
Consequently, you cannot distinguish matrices from vectors. Looking
at the dim attribute of a vector doesn't help because
2009 Mar 27
0
imporving performance of slicing on matrices and S4 their derivatives
Dear list.
It is a known issue that accessing slots of S4 objects and in particular
accessing .Data slots is slow in R. However, what surprises me are two
things demonstrated in the code below (runnable with 'inline', my times
are in the comments):
- copying data out of a large 3x1e7 .Data slot into a matrix can be
easily made 3-4 times faster than accessing a .Data slot which I believe
2007 Apr 18
1
undefined symbol: Rf_rownamesgets
I get the error
undefined symbol: Rf_rownamesgets
when I try to load my package, which include C++ code that calls that
function. This is particularly strange since the code also calls
Rf_classgets, and it loaded OK with just that.
Can anyone tell me what's going on?
For the record, I worked around this with the general purpose
attribute setting commands and R_RowNamesSymbol. I