Displaying 19 results from an estimated 19 matches for "kfmfe04".
2009 Mar 25
3
Converting a Matrix to a Vector
Say I have:
> set.seed( 1 )
> m <- matrix( runif(5^2), nrow=5, dimnames = list( c("A","B","C","D","E"),
> c("O","P","Q","R","S") ) )
> m
O P Q R S
A 0.2655087 0.89838968 0.2059746 0.4976992 0.9347052
B 0.3721239 0.94467527 0.1765568
2009 Mar 21
1
How to avoid switching on input type?
Hi,
I need some help improving this ugly code I wrote. I would like to shift
forward a zoo object, matrix, ts, or list by "shift" items (default 1) and
fill the holes with 0's.
The code below works, but it looks ugly. I could write a function
lag.zerofill() which calls the two functions below depending on the class()
of the item passed in, but that feels very unlike R.
What is
2009 Sep 27
2
xtable - how to add a "sum of values in a row" column?
Hi,
I saw this example for 2.10 Time series in the xtable gallery documentation.
http://cran.r-project.org/web/packages/xtable/vignettes/xtableGallery.pdf
How would I add a column at the end "Total" which sums the row, with minimal
changes to the code below?
Thanks in advance.
- Ken
2.10 Time series
> temp.ts <- ts(cumsum(1 + round(rnorm(100), 0)), start = c(1954,
+ 7),
2009 Apr 01
0
回复: R-help Digest, Vol 73, Issue 32
...ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
------------------------------
Message: 35
Date: Mon, 30 Mar 2009 08:28:15 -0700 (PDT)
From: Ken-JP <kfmfe04@gmail.com>
Subject: [R] Excellent Talk on Statistics (Good examples of stat.
visualization)
To: r-help@r-project.org
Message-ID: <22785778.post@talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
with very good examples of statistical visualization.
"Talks Hans Rosling...
2009 Apr 02
1
[tcl] unknown color name "red" errors
I am running on 64-bit Ubuntu, R version 2.8.1
If I do anything Tcl/Tk related like:
> library( Rcmdr )
or
> available.packages()
I get the error:
Error in structure(.External("dotTclObjv", objv, PACKAGE="tcltk"), class =
"tclObj") :
[tcl] unknown color name "red"
-------------------------------------------------
I am starting R from a terminal
2009 Jun 21
2
Roxygen to ignore a block of code?
Any way to tell Roxygen to ignore a block of code? It is generating an
unwanted .Rd file.
I've been searching for hours for an example, scouring documentation, but no
luck...
Thanks.
- Ken
--
View this message in context: http://www.nabble.com/Roxygen-to-ignore-a-block-of-code--tp24133293p24133293.html
Sent from the R help mailing list archive at Nabble.com.
2009 Jul 29
1
xtable formatting: RED for negative numbers?
I've been experimenting recently with the fantastic Sweave/xtable combination
for generating latex. In the xtable vignette, I found this great example of
printing a ts object by months.
Is there a way to modify this code to generate RED numbers inside xtable for
negative results in x.ts?
Thanks in advance.
- Ken
# Sweave/xtable snippet below
2009 Apr 13
0
BUG in RODBC() on Ubuntu 64amd : rows_at_time=1024
R 2.8.1
Ubuntu 64amd
RODBC 1.2-5
---------------------------------
This was a hard-to-track bug for me, because sqlQuery() did not fail -
instead, it looked like it returned some good data and some NA where there
should have been numbers and 0 where there should have been NAs.
I did:
(a) sqlQuery( o, qry, as.is=TRUE, errors=TRUE, rows_at_time=1024 );
(b) sqlQuery( o, qry, as.is=TRUE,
2009 Jul 29
2
xtable formatting: RED for negative numbers?
I've been experimenting recently with the fantastic Sweave/xtable
combination for generating latex. In the xtable vignette, I found this
great example of printing a ts object by months.
Is there a way to modify this code to generate RED numbers inside xtable for
negative results in x.ts?
Thanks in advance.
- Ken
# Sweave/xtable snippet below
2009 Apr 25
2
How to get rid of loop?
set.seed(1)
x <- runif(100)
# I want to calculate y such that:
#
# 1. if x>0.75, y <- 1
# 2. else if x<0.25, y <- -1
# 3. else if y_prev==1 && x<0.5, y <- 0
# 4. else if y_prev==-1 && x>0.5, y <- 0
# 5. else y <- y_prev
#
# 1. and 2. are directly doable without looping.
#
# How do I do 3.-5. without looping? The problem is, I need to run this
2009 Apr 21
1
n-dimensional vector operations
Let's start with a concrete case of n=3 dimensions.
Along dimension x, I have a matrix of 5 vectors (each with ten rows)
Along dimension y, I have a matrix of 3 vectors (each with ten rows)
Along dimension z, I have a matrix of 2 vectors (each with ten rows)
I am trying to write a:
function(..., funcp) { }
where funcp(...) is an operator which works on n vectors and returns a
numeric.
2009 Apr 06
4
R package: Where to put code to Run Once Only?
Is there a specific place where we can place code to run once only in a
package?
I have code that switches based on Sys.info()[["nodename"]] - but since this
just about never changes, I would like to run it only once when someone
runs:
require( mypackage ) or library( mypackage )
I'm tempted to have some free-floating code in global space (in one of my
package's .R files), but
2009 Mar 23
1
performance: zoo's rollapply() vs inline
zoo's rollapply() function appears to be extremely useful for plugging in a
function on-the-fly to run over a window. With inline, there is a lot more
coding and room for error, and the code is less portable because the user
has to have R compiling set up or it won't work.
However, rollapply() seems to be really slow. Several orders of magnitude
slower than inline, in fact. I don't
2009 Apr 07
2
parse_Rd() Version 2 on Japanese Vista 32 (encoding problems)
Hi,
I need some help with 2.9.0 parse_Rd() Version 2 changes. I read the .pdf
file and some posts on r-help, but after playing with this for several
hours, I can't seem to get around this UTF-8 problem.
- I'm trying to get rid of some warnings during R CMD Check for R 2.9.0Alpha
on Japanese Vista 32
- The same setup on a R 2.9.0Alpha English XP Pro 32 works fine without any
2009 Apr 17
3
rnorm() converted to daily
yearly 8% drift, 25% sd
why are x and y so different (x and z look ok)?
Does this have something to do with biases due to the relationship between
population and sample-estimates as a function of n samples and sd? Or am I
doing something wrong?
-----------------------------------------------------------------------
set.seed( 1 );
x <- mean( rnorm( 100000, mean=0.08, sd=0.25 ));
set.seed( 1
2009 Jun 21
5
Roxygen vs Sweave for S4 documentation
Hi,
I have been using R for a while. Recently, I have begun converting my
package into S4 classes. I was previously using Rdoc for documentation.
Now, I am looking to use the best tool for S4 documentation. It seems that
the best choices for me are Roxygen and Sweave (I am fine with tex).
Are there any users of Roxygen or Sweave who can comment on the strengths or
weaknesses of one or othe
2009 Mar 21
4
Problem with zoo and rbind() converting matrix to vector
require( zoo )
inp <- c( 5, 9, 4, 2, 1 );
m <- zoo( cbind( inp ), as.Date("2003-02-01") + (0:(length(inp)-1)));
dim( m ) # [1] 5 1
dim( m[1,,drop=FALSE] ) # [1] 1 1 - ok
dim( lag( m, -1 )) # [1] 4 1 - ok
dim( rbind( m[1,,drop=FALSE], lag(m,-1) )) # NULL - converted from zoo
matrix to zoo vector!?!?
# any way to keep the last line as a zoo matrix???
--
View this message in
2009 Mar 29
3
Eclipse and StatET Howto (also added Subversion, Rtools)
I recently got a RFC on Eclipse and StatET setup from a R-help user, so here
it is.
Note: there may be slight errors of omission in my directions as I am making
these notes after I had a successful install. If you have questions post
here.
Setup tested with Eclipse 3.4.0 on XP 32-bit and Eclipse 3.4.2 on Vista
32-bit.
R 2.9.0 alpha.
Installing StatET:
1. Go to Help > Software Updates...
2009 Apr 06
1
Need Help with StatET Error/Bug? on Ubuntu 8.10 amd64
Hi,
I posted this message on the StatET-user board last week, but it looks like
a ghost-town...
I have a bad feeling that there is some code in the plug-in which doesn't
work well with my environment, but if I am lucky, maybe other users have
worked around this problem somehow - I am hoping that my setup is the issue.
Note: very similar StatET setups on 32-bit XP Pro and Vista run