Displaying 20 results from an estimated 6000 matches similar to: "looking for a plot function"
2005 Jun 08
2
get level combinations from "by" list
Dear useRs,
Given this code I end up with a list of class "by":
a <- sample(1:5,200,replace=TRUE)
b <- sample(c("v1","v2","v3"),200,replace=TRUE)
c <- sample(c(11,22,33),200,replace=TRUE)
data <- runif(200)
grouped <- by(data,list(a,b,c),function(x) {c(min=min(x),max=max(x),
median=round(median(x),digits=2),mean=round(mean(x),digits=2))})
2004 Dec 23
3
combination of scatterplot and image graph
Dear R users,
I'm interested in a combination of a scatterplot and an image graph.
I have two large vectors. Because in the scatterplot some areas are
sparsely and others densely populated, I want to see the points, and
I also want their color to be changed based on their density (similar
to a heat map). Is there a function that can do that?
Thank you,
b.
2005 Jan 11
5
global objects not overwritten within function
Dear useRs,
I have a function that creates several global objects with
assign("obj",obj,.GlobalEnv), and which I need to run iteratively in
another function. The code is similar to
f <- function(...) {
assign("obj",obj,.GlobalEnv)
}
fct <- function(...) {
for (i in 1:1000)
{
...
f(...)
...obj...
rm(obj) #code fails without this line
}
}
I don't understand
2004 Oct 11
5
read "4-jan-02" as date
Dear R users,
I have a column with dates (character) in a data frame:
12-Jan-01 11-Jan-01 10-Jan-01 9-Jan-01 8-Jan-01 5-Jan-01
and I need to convert them to (Julian) dates so that I can
sort the whole data frame by date. I thought it would be
very simple, but after checking the documentation and the
list I still don't have something that works.
1. as.Date returns the error below. What am I
2004 Oct 13
4
incomplete function output
Dear R users,
I have a function (below) which encompasses several tests.
However, when I run it, only the output of the last test is
displayed. How can I ensure that the function root(var)
will run and display the output from all tests, and not
just the last one?
Thank you,
b.
root <- function(var)
{
#---Phillips-Perron
PP.test(var, lshort = TRUE)
PP.test(var, lshort = FALSE)
2004 Nov 13
3
density estimation: compute sum(value * probability) for given distribution
Dear R users,
This is a KDE beginner's question.
I have this distribution:
> length(cap)
[1] 200
> summary(cap)
Min. 1st Qu. Median Mean 3rd Qu. Max.
459.9 802.3 991.6 1066.0 1242.0 2382.0
I need to compute the sum of the values times their probability of
occurence.
The graph is fine,
den <- density(cap, from=min(cap),
to=max(cap), give.Rkern=F)
2005 Feb 10
3
question about sorting POSIXt vector
Dear useRs,
How come the first attempt to sort a POSIXt vector fails (Error:
non-atomic type in greater), while the second succeeds? (Code inserted
below.) The documentation says that POSIXt is used to allow operations
such as subtraction, so I'd expect sorting to work. Is this perhaps an
OS issue? (I run R 2.0.1 on Win xp.)
Thank you,
b.
#------------code
test <- c("2005-02-08
2005 Mar 18
6
Basic questions about RMySQL
Hello,
Please forget me if I am asking something that is well documented. I have read documentation but there are points that are not clear for me. I am not expert in R nor Databases, but if someone direct me to a tutorial, I will appreciate it..
1. In my understanding, I can install and use RMySQL withouth having to install MySQL in my PC, to have access to and to create new tables . Is this
2005 Jun 20
2
how to make R faster under GNU/Linux
Dear useRs,
I timed the same code (simulation with for loops) on the same box
(dual Xeon EM64T, 1.5 Gb RAM) under 3 OSs and was surprised by the
results:
Windows XP Pro (32-bit): Time difference of 5.966667 mins
64-bit GNU/Linux (Fedora Core 4): Time difference of 6.966667 mins
32-bit GNU/Linux (FC4): Time difference of 9.2 mins
(R 2.1.0 binaries downloaded from CRAN)
I searched the
2009 Jul 12
1
Booting problem with memdisk + Thinkpad + USB
Hi,
I encountered a booting problem with memdisk 2.83, USB and IBM Thinkpad
T61, apparently the same issue as described here:
http://syslinux.zytor.com/archives/2008-April/009850.html
The boot process always stops after "Loading boot sector... booting...".
With debug tracers enabled, the last few output lines are:
Loading boot sector... FR<p>Dbooting...
2005 Jul 21
3
Rprof fails in combination with RMySQL
Dear R community,
I tried to optimized my R code by using Rprof. In my R code I'm using MySQL
database connections intensively. After a bunch of queries R fails with the
following error message:
Error in .Call("RS_MySQL_newConnection", drvId, con.params, groups, PACKAGE = .MySQLPkgName) :
RS-DBI driver: (could not connect mylogin@mydatabase on dbname "myDB"
2007 Dec 27
1
A function for random test based on longest run (UNCLASSI FIED)
Classification: UNCLASSIFIED
Caveats: NONE
Thanks for your quick response. The program you mentioned below available
from R is based on number of runs (up or down) not based on a longest length
of runs of same events. To be more specific, for example, from a series,
HHTHTTTTHHH, the number of runs are 5, and the longest length of runs of the
same events is 4. I'll check for the website you
2002 Oct 24
3
model.matrix (via predict) (PR#2206)
Full_Name: Glenn Stone
Version: 1.5.1 and 1.6.0
OS: win2000
Submission from: (NULL) (168.140.227.9)
The following code produces incorrect fitted values in version 1.5.1 and an
error in 1.6.0
Error in "contrasts<-"(*tmp*, value = "contr.treatment") :
contrasts apply only to factors
In addition: Warning message:
variable ihalf is not a factor in:
2004 Dec 12
2
errors when trying to rename data frame columns
Dear R users,
I need to rename the columns of a series of data frames. The names of
the data frames and those of the columns need to be pulled from some
vectors. I tried a couple of things but only got errors. What am I
missing?
#---create data frame
dframes <- c("a","b","c")
assign(dframes[2],data.frame(11:20,21:30))
#---rename the columns
cols <-
1997 Apr 08
1
R-alpha: User friendly functions
A loose idea for *post*-0.50 development
I've been giving a some (but not all that many) thoughts to whether
some of the conceptual difficulties facing newcomers could be avoided
by having simplified functions for common operations. We already have
parts of this, e.g. in Kurts ctest routines. Specifically, I was
thinking about data frames: How about
2004 Nov 08
3
misleading output after ordering data frame
Dear R users,
I have a data frame which I create with read.csv and then order by
date:
d <- na.omit(read.csv(...))
d <- d[order(as.Date(as.character(d$Date), format="%d-%b-%y"),
decreasing=F, na.last=F),]
My problem is that even though the data frame is ordered as
requested, the old row numbers are preserved. For example:
* Before sorting:
> d[1:3,]
Date Amt
1
2010 Oct 04
2
i have aproblem --thank you
dear professor:
thank you for your help,witn your help i develop the nomogram successfully.
after that i want to do the internal validation to the model.i ues the bootpred to do it,and then i encounter problem again,just like that.(´íÎóÓÚerror to :complete.cases(x, y, wt) : ²»ÊÇËùÓеIJÎÊý¶¼Ò»Ñù³¤(the length of the augment was different))
i hope you tell me where is the mistake,and maybe i have
2005 Mar 31
2
how to simulate a time series
Dear useRs,
I want to simulate a time series (stationary; the distribution of
values is skewed to the right; quite a few ARMA absolute standardized
residuals above 2 - about 8% of them). Is this the right way to do it?
#--------------------------------
load("rdtb") #the time series
> summary(rdtb)
Min. 1st Qu. Median Mean 3rd Qu. Max.
-1.11800 -0.65010 -0.09091
2007 May 18
4
Simple programming question
Hi R-users,
I have a simple question for R heavy users. If I have a data frame like this
dfr <- data.frame(id=1:16, categ=rep(LETTERS[1:4], 4),
var3=c(8,7,6,6,5,4,5,4,3,4,3,2,3,2,1,1))
dfr <- dfr[order(dfr$categ),]
and I want to score values or points in variable named "var3" following this
kind of logic:
1. the highest value of var3 within category (variable named
2004 Dec 30
2
coplot with png: disappearing grid lines
Dear useRs,
When I use coplot() and output to png/jpeg/bmp, the grid lines from
the scatter plots disappear. If I output to pdf() the grid lines are
there, however I can't use it - I have many points, and the resulting
PDF file is large and very slow to open and scroll through. (By the
way, if I click File-Save As-png/jpeg/bmp from Rgui.exe, the grid
lines are preserved - but I need to use