Displaying 20 results from an estimated 500 matches similar to: "array slice notation?"
2009 Aug 05
7
why is 0 not an integer?
Why when I assign 0 to an element of an integer vector does the type change
to numeric?
Here is a particularly perplexing example:
> v <- 0:10
> v
[1] 0 1 2 3 4 5 6 7 8 9 10
> class(v)
[1] "integer"
> v[1] <- 0
> class(v)
[1] "numeric" #!!
>
--
View this message in context:
2009 Aug 05
7
why is 0 not an integer?
Why when I assign 0 to an element of an integer vector does the type change
to numeric?
Here is a particularly perplexing example:
> v <- 0:10
> v
[1] 0 1 2 3 4 5 6 7 8 9 10
> class(v)
[1] "integer"
> v[1] <- 0
> class(v)
[1] "numeric" #!!
>
--
View this message in context:
2009 Jul 08
2
print() to file?
I'd like to write some objects (eg arrays) to a log file. cat() flattens them
out. I'd like them formatted as in 'print' but print only writes to stdout.
Is there a simple way to achieve this result?
Thanks
--
View this message in context: http://www.nabble.com/print%28%29-to-file--tp24397445p24397445.html
Sent from the R help mailing list archive at Nabble.com.
2009 Jul 01
2
sorting question
I've asked about custom sorting before and it appears that -- in terms of a
user-defined order -- it can only be done either by defining a custom class
or using various tricks with "order"
Just wondering if anyone has a clever way to order "vintages" of the form
2002, 2003H1, 2003H2, 2004, 2005Q1, 2005Q2, etc
some have H1 or H2, some have Q1,Q2,Q3,Q4, some are just plain
2009 Jun 23
1
X-window graphics -- preventing window coming to front?
When I do dev.new(), the resulting window comes to the front and grabs the
focus. Is there a way to prevent this so I can continue working in other
windows while the graphics are being produced?
Thanks
--
View this message in context: http://www.nabble.com/X-window-graphics----preventing-window-coming-to-front--tp24167763p24167763.html
Sent from the R help mailing list archive at Nabble.com.
2012 Dec 15
3
interfacing with .Call
Hi
My code is as following:
#include <R.h>
#include <Rinternals.h>
//* the Projector part *//
void Projector(double *L, int *dimL, double *G, int *dimG, double *W, int
*dimW, int *xymod, int *dimxy, double *modif, int *dimif, double *Lsum)
{ ...}
//* the interface part *//
#define getDim(A) INTEGER(coerceVector(getAttrib(A,R_DimSymbol), INTSXP))
SEXP Projector5(SEXP L, SEXP G,
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++;
2010 Feb 01
5
regular expression submatch?
What is the simplest way to extract a matched subexpression?
Eg. in perl you can do
"hello world" =~ m/hello (.*)/
which would return 1(true) and set $1 to the matched subexpression "world".
--
View this message in context: http://n4.nabble.com/regular-expression-submatch-tp1459146p1459146.html
Sent from the R help mailing list archive at Nabble.com.
2009 Apr 24
4
omit empty cells in crosstab?
Perhaps this is a common question but I haven't been able to find the answer.
I have data with many factors, each taking many values. However, only
relatively few combinations appear in the data, ie have nonzero counts, in
other words the resulting table is sparse. Say we have 10 factors each with
10 levels. The result of table() would exceed the memory space (on a 32bit
machine). Is there
2009 Feb 13
3
R Help
Hi,
I have a list of numbers (classified as a list) that contains integer(0)
empty vectors. How do I convert those integer(0) into NAs? Thanks
[[alternative HTML version deleted]]
2004 Jul 30
2
mirroring in both directions with rsync
When operating in daemon mode, will rsync check to see which file is newer and decide which direction to transfer based on that?
Example,
We have 2 terminal servers, A and B. I want users to be able to work on either server and have their home directories on both stay in sync. If a user logs into server A and changes files, the server would know to transfer the file from A to B. If they log
2009 Jun 17
4
searching help for partial matches
The situation is that I know there is a function and know approximately what
the name is, and want to find the exact name. Is there a way of searching
for near-matches (similar to unix apropos). For example, I know there is a
function called something like allequal (or allequals or AllEquals or...).
But ?allequal, etc, return nothing, only if I remember the name can I get
help via ?all.equal.
2009 Jul 07
3
vectorizing a function
I'm sure I'm missing something obvious but I'm not seeing how to simply
"vectorize" a function of two or more variables.
Say I have
f <- function(x,y) if (x>0) y else -y
Now I have vectors x and y of equal length and I'd like to apply f
element-wise. I.e. conceptually
z <- f(x,y) where x, y, z are vectors of the same length
Some magic involving apply?
2004 Oct 27
1
Warning messages in function fitdistr (library:MASS)
Why the warning messages (2:4)?
> x <- rexp(1000,0.2)
> fitdistr(x,"exponential",list(rate=1))
rate
0.219824219
(0.006951308)
Warning messages:
1: one-diml optimization by Nelder-Mead is unreliable: use optimize in: optim(start, mylogfn, x = x, hessian = TRUE, ...)
2: NaNs produced in: dexp(x, 1/rate, log)
3: NaNs produced in: dexp(x, 1/rate, log)
4: NaNs
2012 Feb 23
1
error in fitdistr
Hi dear,
I want to estimate d.f for Chi-squared distribution:
est.chi[i,]<-c(
fitdistr(as.numeric(data2[,i]),"chi-squared",start=list(df=1))$estimate)Warning
message:In optim(x = c(7.86755, 7.50852, 7.86342, 7.70589, 7.70153,
7.58272, :
one-diml optimization by Nelder-Mead is unreliable:
use "Brent" or optimize() directly
Who can help me to solve this problem?
Best
2012 Apr 14
1
what is this warnings ?
i am running one script for many files,
Script file atttached:-
http://r.789695.n4.nabble.com/file/n4556770/AR_anarkali_aic.r
AR_anarkali_aic.r
& warnings are given as below
what is meaning of these warnings?
Warning messages:
1: In optim(coef, err, gr = NULL, hessian = TRUE, ...) :
one-diml optimization by Nelder-Mead is unreliable:
use "Brent" or optimize() directly
is there
2009 Jun 17
2
list of data.frames?
I'm trying to build up a list of data.frames by "appending" one by one.
If x,y,z are data.frames, I can do
somelist <- list(x, y, z) (or even somelist <- list(x=x, y=y, z=z) to get
names)
But if I start with
somelist <- list(x,y) and now want to go from this to list(x,y,z) I'm stuck.
I've tried
append(somelist, z)
c(somelist, z)
list(somelist, z)
Each gives
2007 May 14
1
optim bug (PR#9684)
Full_Name: Christina Merz
Version: R version 2.5.0 (2007-04-23)
OS: mingw32
Submission from: (NULL) (213.70.209.132)
R> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
2010 Sep 19
1
odds ratios for n-way tables: seeking an *apply-able method
I'm looking for a way to generalize the calculation of (log) odds
ratios for 2 x 2 x {strata} frequency
tables in vcd::oddsratio() to R x C x {strata} tables.
For an R x C table, F, odds ratios can be defined
in several ways; one simple way, particularly for tables with ordered
factors, is to calculate the
set of continuation odds ratios, based on the (R-1)x(C-1) set of 2x2
tables with
2017 Aug 12
2
Keep on losing communication: Raspberry Pi, CyberPower PR1500LCD
Everything runs fine for several hours, then communication is lost and nut
doesn't reestablish communication on its own.
Running sudo upsdrvctl stop then sudo upsdrvctl start reestablishes
communication.
OS Version: Linux piaware 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017
armv7l GNU/Linux
Nut Version: 2.7.2-4
Nut Installation Method: apt
Device: CyberPower PR1500LCD
Uses
? ?
Generic