red_maple
2 2 1 1 1
white_oak white_spruce
1 2
> table(doc)
doc
1 2 3
9 5 3
>
hope this helps,
Tony Plate
Steven K Friedman wrote:
> Hello,
>
> I have a data set with 9700 recor
t2[2,])
>
> quantile(dat2[1,])
0% 25% 50% 75%100%
0.000655829 0.246216035 0.507075912 0.745158441 0.16418
> quantile(dat2[2,])
0% 25% 50% 75% 100%
0.0393046 0.4980066 0.7150426 0.9208855 1.3864704
>
-- Tony Plate
Ji
1 3 NA
2 NA 6
> # if you really want to create new variables rather
> # than have them in a data frame:
> # (use paste() or sub() to modify the names if you
> # want something like "newfielda")
> for (i in names(y)) assign(i, y[[i]])
> a
[1] 3 NA
> b
d lots of features. I think the
situation is that the original author of any particular function gets to
decide what features the function will have, and after that there is
considerable reluctance (justifiably) to add new features, especially in
cases where there desired functionality can b
X24"
[8,] "A2" "B2" "C2" "X25"
[9,] "A3" "B3" "C3" "NA"
[10,] "A4" "B4" "C4" "X41"
[11,] "A4" "B4" "C4" "X42"
[12,] "A4" &
king relevant
[leaving "the" and "of" in the query results in the search engine timing
out - odd?]
-- Tony Plate
Corey Powell wrote:
> Do you know of any references that verify the accuracy of R for basic
> statistical calculations and tests. The results of these studie
places -- it's not too difficult to make
mistakes when pulling apart and reassembling arrays like this. (For
simpler cases involving lists of vectors or matrices, the abind()
function can help.)
-- Tony Plate
Jessica Gervais wrote:
> Hi,
>
> I need some help
>
> I ha
ple, if your function has an argument 'he=', you will not be
able to pass it, because if you say optim(x0, fr, he=3), the 'he' will
match the 'hessian=' argument of optim(), and it will not be interpreted
as being a '...' argument.
-- Tony Plate
Michael Pape
I added an example of passing additional arguments through optim() to
the objective and gradient functions to the Discussion section of the
Wiki-fied R documentation. See it at
http://wiki.r-project.org/rwiki/doku.php?id=rdoc:stats:optim
-- Tony Plate
PS. I had to add "&purge=tru
?unlink says that unlink() can remove directories (and has a 'recursive'
argument). 'unlink' is in the "SEE ALSO" section in ?file.remove.
-- Tony Plate
Sundar Dorai-Raj wrote:
> Hi, all,
>
> I'm looking a utility for removing a directory from
What is the problem you are having? Seems to work fine for me running
under Windows2000:
> write.table(data.frame(a=1:3,b=4:6), file="@# x.csv", sep=",")
> read.csv(file="@# x.csv")
a b
1 1 4
2 2 5
3 3 6
> sessionInfo()
Version 2.3.1 (2006-06-01)
i386-pc-mingw32
attached base packages:
[1
I think this does the trick. Note that it is case sensitive.
> x <- c("lad.tab", "xxladyy.tab", "xxyy.tab", "lad.tabx", "LAD.tab",
"lad.TAB")
> grep("lad.*\\.tab$", x, value=T)
[1] "lad.tab" "xxladyy.tab"
>
Jon Minton wrote:
> Hi, apologies if this is too simple but I've been stuck on th
t; str(other)
?
Maybe the labelled data frame is causing the problem? Did you try
as.data.frame(md1[,1:11])? (I'm guessing that will strip off extra
attributes).
-- Tony Plate
John Kane wrote:
> I am stuck on a simple problem where an example works
> fine but the real one does not.
>
I suspect you are not thinking about the list and the
subsetting/extraction operators in the right way.
A list contains a number of components.
To get a subset of the list, use the '[' operator. The subset can
contain zero or more components of the list, and it is a list itself.
So, if x is a
5
3 3 6
>
For a data frame, 'names(x) <- c("Apple", "Orange")' also works, because
a dataframe is stored internally as a list of columns.
-- Tony Plate
Ethan Johnsons wrote:
> A quick question please!
>
> How do you rename column names
> x <- scan("clipboard", what="")
Read 7 items
> x
[1] "1.11" "10.11" "11.11" "113.31" "114.2" "114.3" "114.8"
> gsub("[0-9]*\\.", "", x)
[1] "11" "11" "11" "31" "2" "3" "8"
>
Bernd Weiss wrote:
> Dear all,
>
> I am struggling with the use of regular expression. I got
>
>
>>as.char
I've found "Bayesian Data Analysis" by Gelman, Carlin, Stern & Rubin
(2nd ed) to be quite useful for understanding how MCMC can be used for
Bayesian models. It has a little bit of R code in it too.
-- Tony Plate
Molins, Jordi wrote:
> Dear list users,
>
> I need
t of thing in R is to modify a local
copy of the dataframe and return that, or if you have to return several
dataframes, then return a list of dataframes.
-- Tony Plate
[EMAIL PROTECTED] wrote:
> Folks,
>
> I've run into trouble while writing functions that I hope will create
> a
nt of the computation done in your R program involves basic linear
algebra (matrix multiplication, etc.), then you might see a good speedup.
-- Tony Plate
Kimpel, Mark William wrote:
> I am using R with Bioconductor to perform analyses on large datasets
> using bootstrap methods. In an attem
+ return(a*b+(sum(d)))
+ }
> additional <- runif(100)
> outer(X=a, Y=b, FUN=f, d=additional)
In f: 12 12
[,1] [,2] [,3] [,4]
[1,] 53.61985 54.61985 55.61985 56.61985
[2,] 54.61985 56.61985 58.61985 60.61985
[3,] 55.61985 58.61985 61.61985 64.61985
>
Note tha
1:2, numeric(0), f, 2, VECTORIZED=F)
[1,]
[2,]
>
If a patch to add this feature would be considered, I'd be happy to
submit one (including documentation). If so, and if there are any
potential traps I should bear in mind, please let me know!
-- Tony Plate
Rau, Roland wrote:
> Dear all,
Apologies for the cross post. I explicitly tried to avoid this but
somehow r-help got tacked onto the end of the To: line without my
realizing it.
-- Tony Plate
Tony Plate wrote:
> [following on from a thread on R-help, but my post here seems more
> appropriate to R
e warning message). Only the first element of that
vector is used, so you are passing essentially a random value. By luck,
in your example, the first element was T, which is why you got a value
of 1.707825 as the result, and not NA. The rest might fall int
nInfo()
R version 2.4.1 (2006-12-18)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] "stats" "graphics&quo
tes, Time, and, Calendars, Diethelm W¨urtz
http://www.itp.phys.ethz.ch/econophysics/R/docs/rCalendar.pdf
S4 ’timeDate’ and ’timeSeries’ Classes for R, Diethelm W¨urtz
http://www.itp.phys.ethz.ch/econophysics/R/pdf/calendar.pdf
-- Tony Plate
Michael Toews wrote:
> Sadly, I don't know of any tu
(1,2,3,1,2,1,2,3)])
> table(x, y)
y
x a b c
x 1 1 1
y 1 1 1
z 1 0 1
>
If x and y are already columns in a data frame, then just do
> table(X$factor1, X$factor2)
hope this helps,
Tony Plate
Michela Cameletti wrote:
> Dear R-users,
> I have a little problem that
;tips" section
on the Wiki, please go ahead!)
-- Tony Plate
Petr Pikal wrote:
> Hi
>
> On 27 Mar 2007 at 9:09, Charles Dupont wrote:
>
> Date sent:Tue, 27 Mar 2007 09:09:27 -0500
> From: Charles Dupont <[EMAIL PROTECTED]>
> Organization:
Peter Dalgaard wrote:
> Daniel Berg wrote:
>> Dear all,
>>
>> Suppose I have a very long expression e. Lets assume, for simplicity, that
>> it is
>>
>> e = expression(u1+u2+u3)
>>
>> Now I wish to replace u2 with x and u3 with 1. I.e. the 'new'
>> expression, after replacement, should be:
>>
>>
Here's some timings on seemingly minor variations of data structure
showing timings ranging by a factor of 100 (factor of 3 if the worst is
omitted). One of the keys is to avoid use of the partial string match
that happens with ordinary data frame subscripting.
-- Tony Plate
> n
ed to know for myself what sort of speed differences there was now
among the various approaches.
-- Tony Plate
Iestyn Lewis wrote:
> This is fantastic. I just tested the first match() method and it is
> acceptably fast. I'll look into some of the even better methods
> later. Thank
Try the following and look at what they return:
str(ca)
dimnames(ca)
-- Tony Plate
[EMAIL PROTECTED] wrote:
> Dear R-Experts,
>
> I just imported a workspace from Matlab. I know that I can get the names of
> the imported variables with names(). It works. The variable &quo
I don't think there's that sort of "apply-reduce" function in R, but for
this problem, the last line below happens to be a "one-liner":
> set.seed(1)
> x <- lapply(1:10, function(i) sample(letters, 20))
> table(unlist(x))
a b c d e f g h i j k l m n o p q r s t u v w
I use regexpr() instead of grep() in cases like this, e.g.:
x2[regexpr("exclude",x2)==-1]
(regexpr returns a vector of the same length as character vector given
it, so there's no problem with it returning a zero length vector)
-- Tony Plate
Peter Dalgaard wrote:
> St
do.call("rbind", l)
or, in the case of matrices, using the abind package:
abind(l, along=1)
> library(abind)
> l <- list(matrix(1:6, ncol=2), matrix(11:14, ncol=2))
> abind(l, along=1)
[,1] [,2]
[1,]14
[2,]25
[3,]36
[4,] 11 13
[5,] 12 14
>
Hendrik Fuß w
the DESCRIPTION file:
Package: RSVGTipsDevice
Version: 0.7.0
Date:04/30/2007
Title: An R SVG graphics device with dynamic tips and hyperlinks
Author: Tony Plate <[EMAIL PROTECTED]>, based on RSvgDevice by T Jake
Luciani <[EMAIL PROTECTED]>
Maintainer: Tony Plate <[
s there anything I can do to get a more informative error message in
this type of situation? I couldn't find any help in the section
"Debugging R Code" in "R-exts" (or anything at all relevant in "R-intro").
(Different values for options(error=...) and different
ast
and easy way of distinguishing those from the ones that do matter. I
did look in R-exts, and on developer.r-project.org but was unable to
find clear guidance there either.
-- Tony Plate
>
>
> On Mon, 7 May 2007, Tony Plate wrote:
>
>> Certain errors seem to generate mes
6503186
> y.hat <- fitted(lm3)
> # no-intercept version of R^2 (2 ways to compute)
> 1-sum((y.hat-data$y)^2)/sum((data$y)^2)
[1] 0.6503186
> sum((y.hat)^2)/sum((data$y)^2)
[1] 0.6503186
> # standard (assuming model has intercept) computations for R^2:
> SSE <- sum((y.hat -
The package RSVGTipsDevice allows you to do just it just -- you create a
plot in an SVG file that can be viewed in a browser like FireFox, and
the points (or shapes) in that plot can have pop-up tooltips.
-- Tony Plate
mister_bluesman wrote:
> Hi there.
>
> I have a matrix that
An Introduction to R" will
probably be well worth it. The relevant sections are "5 Arrays and
matrices", and "6.3 Data frames".
-- Tony Plate
Michael Gormley wrote:
> I have created a data frame using the read.table command. I want to be able
> to access the row
* x + 4)
>
Using list() with language objects is much safer if you just want to
make lists of them.
-- Tony Plate
Evan Cooch wrote:
>
> Eik Vettorazzi wrote:
>
>>test=matrix(c( expression(x^3-5*x+4), expression(log(x^2-4*x
>>works.
>
> Well, not really (or I
Does this do what you want?
> x <- list(1,2,3:7,8,9:10)
> sapply(x, function(xx) xx[1])
[1] 1 2 3 8 9
>
-- Tony Plate
Benjamin Otto wrote:
> Hi,
>
>
>
> Sorry for the question, I know it should be basic knowledge but I'm
> struggling for two hours no
q(len=n))
(For very large matrices, the third will be more efficient, I believe.)
-- Tony Plate
roger bos wrote:
> Dear useRs,
>
> Trying to replace the diagonal of a matrix is not working for me. I
> want a matrix with .6 on the diag and .4 elsewhere. The following
> code looks lik
06600
400980
5000 12 10
>
I don't know if the conversion to and from a time-series class will
impact the timing, but if this might serve your purposes, it's easy to
do some experiments to find out.
- Tony Plate
Huang-Wen Chen wr
e(c(1,2,2,3,3,3), rep=F, size=4)
-- Tony Plate
From reading ?sample, I was a little unclear on whether sampling
without replacement could work
Petr Pikal wrote:
> Hi
>
> a litle bit different story. But
>
> x1 <- sample(c(rep("red",400),rep("green", 100),
[sample(rep(1:3,c(400,100,300)), 5)]
[1] "red" "blue" "red" "red" "red"
>
-- Tony Plate
Brian Frappier wrote:
> I tried all of the approaches below.
>
> the problem with:
>
> > x <- data.frame(matrix(NA,100,3))
&g
- 4:6
> c <- 7:9
> x1 <- list(a=a,b=b)
> x2 <- list(a=a,b=b,c=c)
> do.call("cbind", x1)
a b
[1,] 1 4
[2,] 2 5
[3,] 3 6
> do.call("cbind", x2)
a b c
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
>
-- Tony Plate
Leeds, Mark (IED) wrote:
> I did
Your problem is that you are using cat() on a factor. Use
as.character() or format() to convert the factor to character data,
which cat will then print in the way you want.
> x <- data.frame(L=letters[1:3])
> x
L
1 a
2 b
3 c
> x$L
[1] a b c
Levels: a b c
> cat(x$L, "\n")
1 2 3
> cat(as.
will bind together vectors
and arrays into higher dimensional arrays -- it might come in handy for you.
-- Tony Plate
Piet van Remortel wrote:
> Hi all,
>
> I am faced with the situation where I want to store/analyze
> relatively large, organized sets of numerical data, which dep
nd I believe it is very widely used.
Did you try using that optimization routine with this problem?
-- Tony Plate
dave fournier wrote:
> There has recently been some discussion on the list about
> AD Model builder and the suitability of R for constructing the
> types of models
This is very useful, thanks for posting!
I created a page for this at the R Wiki:
http://fawn.unibw-hamburg.de/cgi-bin/Rwiki.pl?DataBases
If any one has any info to add, go at it!
-- Tony Plate
charles loboz wrote:
> 1. That was a part of a private email exchange. It has
> been suggeste
e that sessionInfo() currently does not report all the information
that 'version' does (it omits at least "Status" and "svn rev"). R-core
members are aware of this -- whether or not they change this is up to them.]
-- Tony Plate
__
can gather momentum?
-- Tony Plate
Frank E Harrell Jr wrote:
> I feel that as long as people continue to provide help on r-help wikis
> will not be successful. I think we need to move to a central wiki or
> discussion board and to move away from e-mail. People are extremely
> helpf
There's a gotcha in using identical() to compare dimensions -- it also
compares names, e.g.:
> x <- array(1:14, dim=c(rows=3,cols=5))
> dim(x)
rows cols
35
> identical(dim(x)+0, c(3,5))
[1] FALSE
> identical(as.numeric(dim(x)+0), c(3,5))
[1] TRUE
>
Gabor Grothendieck wrote:
> If its
complaint. Can you explain exactly how it didn't work for
you? (e.g., show the exact error message).
-- Tony Plate
Chia, Yen Lin wrote:
> Hi all,
>
>
>
> I wonder how could I convert a matrix A to a dataframe such that
> whenever I'm running a linear model such lm
sing something like seq(1,len=length(x)) (or simply
seq(len=length(x)), or seq(2, len=length(x)-1) or seq(along=x)[-1].
-- Tony Plate
johan Faux wrote:
> Hello ,
>
> a<-c(1)
> for(i in 2:length(a))
> do.something with a[[i]]
>
> I get :
> Error in
atches your definition of
"neighbor" (the above formula does not include diagonal neighbors).
And of course, ties make things more complicated (note that the above
simple algorithm misses the local maximum consisting of two 8's in the
last row.)
-- Tony Plate
Patrick Wang wrot
The new version of RSVGTipsDevice (0.7.1) that is now available on CRAN
should fix this problem. Please let me know if it doesn't, or if there
are other problems.
-- Tony Plate
mister_bluesman wrote:
> Hi there.
>
> I am still trying to get the RSVGTipsDevice to work, yet I c
t;rbind", list.of.dfs)
> myData
i c
1 3 c
2 4 d
3 5 e
4 6 f
5 7 g
6 8 h
>
(and of course, these last two expressions can be composed into a single
expression if you want)
-- Tony Plate
Aydemir, Zava (FID) wrote:
> Hi
>
> I rbind data frames in a loop in a
actors, I would have
expected a warning from the comparison operator).
You might get more help by distilling your problem to a simple example
that can be tried out by others.
-- Tony Plate
Sachin J wrote:
> Hi,
>
> I am trying to extract subset of data from my original data frame
result
of the quadratic expression must be treated as a scalar?
-- Tony Plate
Michael wrote:
> imagine when you have complicated matrix algebra computation using R,
>
> you cannot prevent some middle-terms become quadratic and absorbs into one
> scalar, right?
>
> if R cannot intel
Here's an example of how I think you can do what you want. Play with
the definition of the function highest.use() to get random selection of
multiple maxima.
> drug.names <- c("marijuana", "crack", "cocaine", "heroin")
> drugs <- factor(drug.names, levels=drug.names)
> drugs
[1] marijuana cr
1:3, 11:14)
-- Tony Plate
Jacques Ropers wrote:
>>But you got only two (eventually one) distinct values, right? Look at
>>the code for 'ifelse': yes and no are only called once each, then
>>recycled to desired length.
>>
>>I guess you want something li
ode making
unwanted interpretations of certain bit patterns.
-- Tony Plate
Knut M. Wittkowski wrote:
> We have packed logical vectors into integers, 32 flags at a time and
> then want to AND or OR these vectors of "integers" using other C functions.
>
> The problem: occasio
;))
int date
1 1 2005-01-24
2 2 2006-01-23
3 3 2006-01-23
> (x <- data.frame(int=1:3, date=as.Date(c("2005/01/24" ,"2006/01/23"
,"2006/01/23"), "%Y/%m/%d")))
int date
1 1 2005-01-24
2 2 2006-01-23
3 3 2006-01-23
> class
033.aspx, one can
view threads in Outlook by selecting "View->Arrange By->Conversation".
Hope this helps (in case the horse was not thoroughly dead already.)
-- Tony Plate
Kimpel, Mark William wrote:
> See below for Bert Gunter's off list reply to me (which I do
> apprec
> a <- data.frame(value=c(6.5,7.5,8.5,12.0),class=c(1,3,5,2))
> x <- c(1,1,2,7,6,5,4,3,2,2,2)
> match(x, a$class)
[1] 1 1 4 NA NA 3 NA 2 4 4 4
> a[match(x, a$class), "value"]
[1] 6.5 6.5 12.0 NA NA 8.5 NA 7.5 12.0 12.0 12.0
>
-- Tony Pla
> cat('Open fnd "test"\n')
Open fnd "test"
> cat("Open fnd \"test\"\n")
Open fnd "test"
>
Bos, Roger wrote:
> Can anyone tell me how to get R to include a double quote in the middle
> of a character string?
>
> For example, the following code is close:
>
>> fnd<-"Open fnd 'test'"
>>
te point for a reasonably well-behaved
function. It may be possible to increase the number of steps, but I
don't see how from the docs for ?optim. Of course, the source is available.
hope this helps,
Tony Plate
Petr Klasterecky wrote:
> Hi,
> my call of optim() with the L-BFGS-B
ool to deal with software updates is automated
testing. I highly recommend it. R comes with a testing framework.
-- Tony Plate
cheers, jari oksanen
--
Jari Oksanen <[EMAIL PROTECTED]>
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch
Probably the simplest way to improve the speed of your code would be to
write the data so that all the data in a column is contiguous. Then you'll
be able to read each column with a single call to readBin().
hope this helps,
Tony Plate
At Tuesday 04:02 AM 6/1/2004, Uli Tuerk wrot
debugging is harder than it needs to be.
Yup, that's why I proposed (and provided an implementation) of an
alternative "$$" operator that did report an error when object$$name didn't
have a "name" component (and also didn't allow abbreviation), but there was
n
easy to do it by column:
> d <-
data.frame(name=c("obs1name","obs2name","obs3name"),val1=c(0.2,0.4,0.6),val2=c(0.3,1.0,2.0),row.names=c("r1","r2","r3"))
> d
name val1 val2
r1 obs1name 0.2 0.3
r2 obs2name 0.4 1.0
r3 obs3name 0.6 2.0
>
(when you do it by row, you get the numbers as fac
This looks like it probably is a scope problem with non-standard evaluation
rules for the argument subset= of nnet.
Instead of subset=sub[-i], try data=dftc[-i,] (I've not tested this since
I don't have the data objects you used.)
hope this helps,
Tony Plate
At Thursday 04:38 PM
so the standard argument
interpretation rules result in the arguments having the values y=3, x=1.
hope this help,
Tony Plate
Thanks,
-ans.
--
Ajay Shah Consultant
[EMAIL PROTECTED] Department of Economic Affairs
http
ago at:
>
> http://fawn.unibw-hamburg.de/cgi-bin/Rwiki.pl?RwikiHome
>
> yet no one really used it. Some critical mass of use is needed
> to get such a project off the ground.
Comments?
-- Tony Plate
__
[EMAIL PROTECTED] mailing list
htt
file, then, as others have suggested, writing
a C program wouldn't be that hard, as long as you make the format inflexible.
-- Tony Plate
At Tuesday 06:19 PM 6/29/2004, Igor Rivin wrote:
I was not particularly annoyed, just disappointed, since R seems like
a much better thing than SAS i
t R is an open source volunteer project suggests that the time is
ripe for one of those disappointed people to fix the matter and contribute
the function read.table.fast()!
-- Tony Plate
At Wednesday 10:08 AM 6/30/2004, Igor Rivin wrote:
Thank you! It's interesting about S-Plus, since they appare
The easiest way would probably be to do the hack of creating a temporary
file to hold stdin, then call R to process that file. That would be easy
to do in a shell script.
If this really won't suffice, this older message might lead to something
useful:
Rd] R scripting patches for R-1.8.0
Neil
t;thomas"), function(re) grep(re, x))
$perl
[1] 3
$program
[1] 3 4
$thomas
[1] 2 3 4
> unlist(sapply(c("perl","program","thomas"), function(re) grep(re, x)),
use.names=F)
[1] 3 3 4 2 3 4
> y <- table(unlist(sapply(c("perl","prog
c("x","y")
> data[mylist]
x y
1 1 4
2 2 5
3 3 6
> data[,mylist]
x y
1 1 4
2 2 5
3 3 6
>
I'd generally use the second form of subsetting above (i.e., data[,mylist],
because that will work with matrices as well).
hope this helps,
Tony Plate
At Thursday 01:22
7 0.00 0.27 NA NA
> all.equal(x1, x2)
[1] TRUE
>
hope this helps,
Tony Plate
At Monday 04:35 PM 8/2/2004, Jack Tanner wrote:
Wolski wrote:
What you can do is to extend the column (list) by an addtional
attribute attr(mydataframe[i],"info")<-names(mydataframe)[i] and store
they
st containing NULL is quite a different
object to NULL). E.g.:
> rep(NULL, 20)
NULL
> c(rep(list(NULL), 3), rep(list(0), 2))
[[1]]:
NULL
[[2]]:
NULL
[[3]]:
NULL
[[4]]:
[1] 0
[[5]]:
[1] 0
>
Tony Plate
But anyway, it works and saves a lot of memory for me. Thank you again.
Frank
Quot
;
So, for long vectors with relatively few different values, storage as
factors is far more memory efficient (this is because the character data is
stored only once per level, and each element is stored as a 4-byte
integer). (The above was done on Windows 2000).
-- Tony Plate
If any mathematical
what gets put on the R-project site might be willing to put it up
there, and a link to it from the posting guide would seem like a good idea.
Tony Plate
At Thursday 07:17 AM 8/19/2004, Gabor Grothendieck wrote:
I have a suggestion for the posting guide. One problem with some posts is
that
th
26
> xr <- sample(rownames(x), 1)
> length(xr)
[1] 1
> system.time(y <- x[xr, ])
[1] 2.22 0.00 2.30 NA NA
> system.time(y <- x[match(xr, rownames(x)), ])
[1] 0.09 0.00 0.09 NA NA
>
HTH
-- Tony Plate
My bad workaround solution so far has been to generate obj
y (a, 1, function(x) table(factor(x, levels=0:9)))
> b1
[,1] [,2] [,3] [,4]
00100
12112
21001
30100
40220
50011
6 1 001
71000
80010
90000
(which.max(table(x)))
[1] "2"
>
Note that this method returns the first max value in the case of ties.
hope this helps,
Tony Plate
At Tuesday 11:01 AM 8/24/2004, Jonathan Baron wrote:
On 08/24/04 13:50, Paolo Tommasini wrote:
>Hi my name is Paolo Tommasini does anyone know how to compu
ible to read data dumps from S-PLUS 5.x and 6.x written with
>data.dump(oldStyle=T).
-- Tony Plate
At Wednesday 10:29 AM 8/25/2004, Zachary Skrivanek wrote:
>Hello! I would like to be able to read in list data objects in R/S
>created in R/S. (Ie R->S or S->R.) I have tried 'dpu
oldStyle=T)
R> dget("junk1.dat")
Error in eval(expr, envir, enclos) : Object "g" not found
R> # with package "foreign" loaded
R> data.restore("junk2.dat")
Error in ReadSdump(TRUE, " ") : S mode "junk" (near byte offset 45) not
sup
use options(error=recover), e.g.:
> remove("x")
NULL
Warning message:
remove: variable "x" was not found
> (function() {x})()
Error in (function() { : Object "x" not found
> options(error=recover)
> (function(y=1) {x})(2)
Error in (function(y = 1) { : Object "x" not found
Enter a frame number, or 0
em i386, mingw32
status Under development (unstable)
major2
minor0.0
year 2004
month 09
day 13
language R
>
-- Tony Plate
At Tuesday 10:25 AM 9/14/2004, Prof Brian Ripley wrote:
On Tue, 14 Sep 2004, Francisco Chamu wrote:
> I have run this on both Windows 2000 and XP. Al
42 50 58
[3,] 35 43 51 59
[4,] 36 44 52 60
[,1] [,2] [,3] [,4]
[1,] 37 45 53 61
[2,] 38 46 54 62
[3,] 39 47 55 63
[4,] 40 48 56 64
>
hope this helps,
Tony Plate
At Wednesday 03:10 PM 9/15/2004, Rajarshi Guha wrote:
Hi,
I have a matrix of
they could
reproduce the behavior that bothered you, but didn't bother dig deeper
suggests it didn't bother them that much, which further suggests that you
are the person most motivated by this and thus the best candidate for
investigating it further...)
-- Tony Plate
At Wednesday 05
Try putting options(warn=1) at the start of your R code.
This should cause the warnings to be printed as they occur, instead of the
default of being saved up until the top-level command terminates.
See ?warning and ?option.
-- Tony Plate
At Thursday 08:52 AM 9/16/2004, Mag. Ferri Leberl wrote:
I
01" "11-Jan-01" "10-Jan-01" "9-Jan-01" "8-Jan-01" "5-Jan-01"
> as.Date(d, format="%d-%b-%y")
[1] "2001-01-12" "2001-01-11" "2001-01-10" "2001-01-09" "2001-01-08"
[6] "2001-01-05&
The trick to vectorizing
> asset <- numeric(T+1)
> for (t in 1:T) asset[t+1] <- cont[t] + ret[t]*asset[t]
is to expand it algebraically into a sum of terms like:
asset[4] = cont[3] + ret[3] * cont[2] + ret[3] * ret[2] * cont[1]
(where the general case should be reasonably obvious, but is more work
At Thursday 08:10 AM 10/7/2004, Bryan L. Brown wrote:
Sorry if these questions have been asked recently--I'm new to this list.
I'm primarily a Matlab user who is attempting to learn R and I'm searching
for possible equivalents of commands that I found very handy in
Matlab. So that I don't seem u
as a
framework to get things going?
If the existing R-docs are "dumped" into a wiki, won't the copy in the Wiki
quickly get out of date? How does one get around this problem?
-- Tony Plate
__
[EMAIL PROTECTED] mailing list
https://stat.
Maybe this does what you want:
> dm <- cbind(1:2,11:12,101:102)
> idx <- cbind(c(1,2),c(2,3))
> row(idx)
[,1] [,2]
[1,]11
[2,]22
> cbind(as.vector(row(idx)), as.vector(idx))
[,1] [,2]
[1,]11
[2,]22
[3,]12
[4,]23
> dm[cbind(as.vector(row(idx)
1 - 100 of 199 matches
Mail list logo