Displaying 20 results from an estimated 10000 matches similar to: "get plot in a window when running R in the shell"
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
2005 Mar 11
3
XML to data frame or list
Dear useRs,
I have a simple/RTFM question about XML parsing. Given an XML file,
such as (fragment)
<A>100</A>
<B>23</B>
<C>true</C>
how do I import it in a data frame or list, so that the values (100,
23, true) can be accessed through the names A, B and C?
I installed the XML package and looked over the documentation...
however after 20 minutes and a couple of
2005 Apr 06
3
looking for a plot function
Dear useRs,
I have a data frame and I want to plot all rows. Each row is
represented as a line that links the values in each column. The plot
looks like this:
dfr <- data.frame(A=sample(1:50,10),B=sample(1:50,10),
C=sample(1:50,10),D=sample(1:50,10))
xa <- 10*1:4
plot(c(10,40),c(0,50))
for (i in 1:nrow(dfr)) {
lines(xa,dfr[i,],pch=20,type="o")
}
Things get more complicated
2004 Nov 01
1
plot time series / dates (basic)
Dear R users,
I'm having a hard time with some very simple things. I have a time
series where the dates are in the format 7-Oct-04. I imported the
file with read.csv so the date column is a factor. The series is
rather long and I want to plot it piece by piece. The function below
works fine, except that the labels for date are meaningless (ie
9.47e+08 or 1098000000 - apparently the number of
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
2006 May 04
3
SQL like manipulations on data frames
Is there a cheat-sheet anywhere that describes how to do SQL-like
manipulations on a data frame?
My knowledge of R is rather limited. But from my experience it seems
as though one can think of data frames as being similar to tables in
a database: there are rows, columns, and values. Also, one can
perform similar manipulations on a data frame as one can on a table.
For example:
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
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"
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
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 <-
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 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 Sep 01
4
Linux Standalone Server Suggestions for R
Hi All,
My group is looking for any suggestions on what to purchase to
achieve the most powerful number crunching system that $50k can buy.
The main application that will be used is R so input on what hardware
benefits R most will be appreciated. The requirements are that it be
a single standalone server (i.e. not a cluster solution), and it that
must be able to run unix/linux. If
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 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
2005 Oct 10
1
decreasing performance of for() loop
Dear useRs,
I'm wondering why the for() loop below runs slower as it progresses.
On a Win XP box, the iterations at the beginning run much faster than
those at the end:
1%, iteration 2000, 10:10:16
2%, iteration 4000, 10:10:17
3%, iteration 6000, 10:10:17
98%, iteration 196000, 10:24:04
99%, iteration 198000, 10:24:24
100%, iteration 200000, 10:24:38
Is there something that can be done about
2010 Jul 16
2
Can I set default parameters for the default graphics device?
I'm completely new to R, and I'd like to do something like this:
> x=c(1,2,3)
> plot(x,x)
At this point, R creates a file "Rplots.pdf", since the default device is
PDF and the default filename is "Rplots.pdf". I know I can set the default
device like this:
> options(device="png")
But is there a way to set the default device's
2005 Mar 25
4
Gmail invitation
Hello R users!
I just found out that I have 49 invitations for Gmail (gmail.google.com).
I have been using it now for a while and is really nice. Don't forget
1 GB for free.
I will invite those who respond to this mail by FIFO.
--
Lep pozdrav / With regards,
Gregor Gorjanc
------------------------------------------------------------------------
University of Ljubljana
Biotechnical