Also
spDists
spDistsN1 Euclidean or Great Circle distance between points
In the sp package.
(and in my personal opinion, the sp package would be a good place to start,
since its part of a group of packages I view as Rs core packages for working
with spatial data)
-Don
On 11/19/10
As Nick suggested, you're confusing the name of an object with the name(s)
of its elements.
Study this example:
lamda - 0.2
lamda
[1] 0.2
lamda - c(g=0.2)
lamda
g
0.2
lamda - c(1,3,4)
lamda
[1] 1 3 4
lamda - c(g=1, x=3, foo=4)
lamda
g x foo
1 3 4
lamda is now a
As in this example:
seq(as.Date(2000/1/1), as.Date(2003/1/1), by=mon)
On 7/12/10 11:25 AM, Bogaso Christofer bogaso.christo...@gmail.com
wrote:
Hi all, can anyone please guide me how to create a sequence of months? Here
I have tried following however couldn't get success
You need to understand the difference between a variable and a value.
In your case that doesn't work, you are supplying a value, trait.value.
but you have no file named trait.value.
In the case that does work you are supplying a variable, trait.value, and
the value contained in that variable is
Here is an example of how I would do it. Just replace my indx with the values
in your first column.
indx - 1:13
t0 - as.POSIXct('2009-01-01 00:00')
tms - t0 + (indx -1 )* 3 * 60 * 60
tms
[1] 2009-01-01 00:00:00 PST 2009-01-01 03:00:00 PST
[3] 2009-01-01 06:00:00 PST 2009-01-01 09:00:00
Youre working too hard. Use this:
tms - as.POSIXct(strptime(v, %a %b %d %H:%M:%OS %Y))
Take note of the fact that there are two types of datetime objects: POSIXct
and POSIXlt.
Your unlist() gave what seemed a strange result because you used on an lt
object. Had you given it a ct
The key is in the help page for apply. It says (in part):
In all cases the result is coerced by Œas.vector¹ to one of the
basic vector types before the dimensions are set, so that (for
example) factor results will be coerced to a character array.
So although as.polynomial()
Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of MacQueen, Don
Sent: Wednesday, 6 October 2010 1:23 PM
To: Raznahan, Armin (NIH/NIMH) [E]; r-help@r-project.org
Subject: Re: [R] Using as.polynomial() over a matrix
The key is in the help page
How about
data[ , colnames]
Or
data[ , colnames[1]]
data[ , colnames[2]]
-Don
On 7/9/10 11:27 AM, Jonathan Flowers jonathanmflow...@gmail.com wrote:
Hi
I want to extract columns from a data frame using a vector with the desired
column names.
This short example uses the select
While you study the documentation as others suggested, may I suggest that you
take a look at the
file.exists()
function. Here is an example of using file.exists().
tmpfile - define()
if (file.exists(tmpfile)) {
## read the file
} else {
## tell the user to try again
}
On Jul 24, 2011, at
While I think David's suggestion is better, because it's more readable,
this should also work:
dat - read.table(file.name - file.choose(), header = FALSE)
Note the assignment inside the function call.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Possibly something similar to
abline(v=seq(long.min, long.max, length=3)
abline(h=seq(lat.min, lat.max, length=3)
?
The above will add vertical and horizontal lines to an existing plot, and
assumes that the plot is in long/lat coordinates. Of course, this ignores
the fact that long/lat is
The help pages for identical() and all.equal() have information that will
make it clear why they don't do what you want.
In the meantime, I tend to use a construct such as:
length(unique(x))==1
But be careful if x is not a vector.
No doubt there are other ways.
-Don
--
Don MacQueen
See below:
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
-Original Message-
From: Jeremy Miles jeremy.mi...@gmail.com
Date: Fri, 15 Apr 2011 14:17:13 -0700
To: Shane Phillips sphill...@lexington1.net
Cc:
The filenames can be done within a loop, like this:
for (id in 1:1000) {
## the filename
fname - paste('sample', formatC(id,width=4,flag='0'),'.tsv',sep='')
## more stuff
}
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
I suspect, but have not tested, that your src$date element has class
POSIXlt, which is internally a list, in which case splitting by it might
not work properly, and might be the cause of your out of bounds error
message.
One of these might do the job:
src$date -
Even though it's not needed, here's a small followup.
I usually use this
split(x, paste(x$let,x$g))
But since
split(x, list(x$let,x$g))
works, so does
split(x, x[,c('let','g')])
all.equal( split(x, x[,c('let','g')]) , split(x,list(x$let,x$g)))
[1] TRUE
As to which is the best, hard
Steve,
Just below are some examples that I hope will help.
With regard to what you've tried, I don't see any reason for using with(),
or the select argument to subset(). They both look unnecessary to me.
## examples of subsetting date-time values
## create fake data
tmp -
Spreadsheets have cells, but R does not. So you will have to be much more
specific.
The closest I can come would be like this example:
If you want to copy the value that is in the 3rd row, 2nd column to the
4th row, 1st column, then
mydata[4,1] - mydata[3,2]
But that is a copy, not a move (and
Not that anything more needs to be said ... it doesn't, not really ...
But I think that in cases like this it is helpful to use the digits arg to
print().
It probably would have shown in a simple way that the two numeric versions
aren't really equal
-- and demonstrated a little about R's default
It's probably not a sensible thing to do, but I'm going to guess.
With a name like days_to_tumor_recurrence, I might expect numeric
(integer) values. But null and numeric don't mix.
as.numeric(c('24','null',23')) will return 24, NA, 23.
There may have been such a conversion in the preparation
Just a minor aside; I would have done
my.slopes - numeric(100)
Note that:
class(numeric(5))
[1] numeric
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 9/16/11 12:37 PM, Luke Miller mille...@gmail.com wrote:
As far as I know, you must convert your main program into a subroutine.
In my experience, this consist mostly if not entirely of converting user
input from prompts to subroutine arguments.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
Are you absolutely certain that the data must be stored in Excel?
In the long run I believe you will find it easier if the data is stored in
an external database, or some other data repository that does not require
you to read so many separate files.
Probably the best you can hope for as it is
Since you found readOGR, you might want to look at writeOGR.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 2/22/12 3:43 PM, gztourek gztou...@gmail.com wrote:
Hi,
I am new to R and am a very basic user. I'm
I also find that POSIXct is generally the most useful, and only use
POSIXlt in special cases.
But have you considered as.POSIXct() instead of strptime()? It works for
me, and I can't remember the last time I had to use strptime() for
converting character to date/time. (But I mostly don't work
I've never heard of a an SQL de-select, but if there is such a thing it
shouldn't be too hard to find via some web searches.
In the meantime, I would probably just do a select * to get all the fields
from the database tables, and then drop the unwanted ones afterwards in R.
I think this will give
I'd like to make the distinction between the purpose of factors, i.e.,
what they are intended for, and how that purpose is accomplished.
Their purpose is for use in statistical models. The simplest example is
analysis of variance, where predictors are commonly referred to as
factors. Factors in R
Try
A[[1]] - NA
(It is of course up to you to do the tests, presumably using if(), to
decide when to assign NA to the list element.)
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 3/31/12 7:53 PM, michaelyb
To expand on Duncan's answer, you haven't replaced it. The following
should make that clear:
## starting in a fresh session
c
function (..., recursive = FALSE) .Primitive(c)
find('c')
[1] package:base
c - 1
find('c')
[1] .GlobalEnv package:base
c
[1] 1
rm(c)
find('c')
[1] package:base
Have you run
genclntsh
and/or
genclntst
In ORACLE_HOME/bin
?
I dont recall very well where I learned about this, or how it is documented...
But it does something to some files in $ORACLE_HOME/lib that is needed in order
for Roracle to build.
lib[598]% nm libclntsh.so | grep sqlprc
John,
The first thing I would do is create a simpler example, i.e., to help isolate
the issue. Heres a simple example:
The contents of a file are:
#! /usr/bin/Rscript
pdf('test1.pdf')
plot(1:10)
dev.off()
pdf('test2.pdf')
plot(10:1)
dev.off()
Not sure exactly what you mean by, writing a table with several rows per
file.
If what you want to do is write output to an external file, adding to it as
your loop progresses, then look at the functions
sink()
cat()
And their file and append arguments.
If what you want to do is
In addition to which, R-sig-geo would be better place to ask.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 10/26/11 10:39 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:
On 26/10/2011 1:11 PM, Mark Newcomb wrote:
And to further the example, length() of matrix is not equal to the number
of rows either.
mm - matrix(1:6, ncol=2)
length(mm)
[1] 6
dim(mm)
[1] 3 2
Also, NROW() and nrow() are different; I'd be cautious about using NROW
without making sure I understood the difference.
NROW
function (x)
if
The various suggestions seem kind of complex to me, at least on a
unix-like system (including Mac OS X).
This is what I do:
sink('tmp.txt')
cat('This is the body of the message\n')
sink()
system('cat tmp.txt | mail -s A test email macque...@llnl.gov')
One could probably avoid the
I would suggest starting by taking a look at the overlay() function in the
sp package.
(also suggest follow up questions to to R-sig-geo)
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 11/16/11 11:30 AM, Peter Maclean
One option would be, after you have converted one of your date/time
variables (V2 I would assume) to POSIXct class, you can use the interp()
function in the akima package for linear interpolation between adjacent
time points.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000
To add to what David suggests, and since you're new to R, something like
this:
plot(x,y, yaxt='n')
yticks - pretty(y)
axis(2, at=yticks, labels=sprintf(%1.2f,yticks))
See the help page for par
?par
and look for the entry for 'xaxt' to see what the 'yaxt' arg to plot does.
--
Don MacQueen
Here is an example that could probably be described as adding a year:
dates - c('2008-01-01','2009-03-02')
tmp - as.POSIXlt(dates)tmp$year - tmp$year+1
dates2 - format(tmp)
dates
[1] 2008-01-01 2009-03-02
dates2
[1] 2009-01-01 2010-03-02
## to begin to understand how it works, give the command
There is no single command to do all of what you want.
Read the posting guide for advice on how to ask questions that are more
likely to receive helpful answers.
The mean() function is a command for combining certain number of data
into their average value.
The write.csv() function will create
And even more for the heck of it... this kind of thing is also
device-dependent.
(this is *not* a controlled test; some variation could be due to other
processes running on the machine)
-Don
x11(type='Xlib')
system.time(plot(runif(1e6),runif(1e6)))
user system elapsed
0.712 0.165
The function crossing.psp() in the spatstat package might be of use.
Here's an excerpt from its help page:
crossing.psp package:spatstat R Documentation
Crossing Points of Two Line Segment PatternsDescription:
Finds any crossing points between two line segment patterns.
First of all, it's R, not r, and on this mailing list people care about
this kind of thing.
Second, you will need to provide more information in order to get better
help. Please read the posting guide.
There are a number of introductory level documents available via CRAN,
please pick one and
There is also a windrose (though not with that name) function in the
openair package.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 12/12/11 1:20 PM, Adrienne Wootten amwoo...@ncsu.edu wrote:
Greetings!
I'm having an
Or:
require(xlsx)
test - function(x){
+a - data.frame(A=c(1,2),B=c(10,11))
+write.xlsx(a,file=a.xlsx)
+ }
test()
list.files(patt='xlsx')
[1] a.xlsx
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 12/19/11
Something like the following may be what you are looking for.
try.out - try(dmt(y[,j],new$mu[,,4],sigij,ceiling(new$nu[4])),silent=TRUE)
if (class(try.out) == 'try-error'} ) {
out - NaN
} else { out - try.out
}
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave.,
I usually do this kind of thing like this:
variable3 - rep(1,length(variable1.fac))
variable3[ variable1.fac == 0 variable2.num = 1 ] - 2
variable3[ variable1.fac == 1 variable2.num == 0 ] - 3
variable3[ variable1.fac == 1 variable2.num = 1 ] - 4
This approach is easy to read and understand,
Look at the documentation for whatever function you are using to write
data to the file.
It should be pretty obvious (look for an append argument).
Otherwise you'll have to provide more information, such as a short simple
example of what you have tried.
-Don
--
Don MacQueen
Lawrence Livermore
What's wrong with rpoispp in spatstat? It can simulate over a polygon,
which can of course be used to closely approximate a circle. There is also
spsample in the sp package.
I'd also suggest asking this question on r-sig-geo.
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East
Something like this (not tested)?
df$diffP - c(NA, NA, diff(df$P,2))
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/6/12 6:39 AM, ikuzar raz...@hotmail.fr wrote:
Hello,
I created a data.frame which contains two
For me, this example runs in a fraction of a second:
t1 - data.frame(matrix(rnorm(3e6),ncol=3))
t2 - data.frame(matrix(rnorm(3e6),ncol=3))
t3 - cbind(t1,t2)
dim(t3)
[1] 100 6
Maybe it takes longer if your data frames have other classes of objects in
them.
If some of your data frame
See suggestion inserted below.
It assumes and requires that every input IP address has the required four
elements.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/8/12 5:11 AM, Enrico Schumann enricoschum...@yahoo.de
My best guess is that you are misunderstanding what the c() function does.
I'd suggest reading the help page for c, obtained by typing
?c
Note that if you supply c() with objects of different types (as you have),
the results will probably not be what you wanted.
Given what c() does, your output
Here is a solution that works for your small example.
It might be difficult to prepare your larger data sets to use the same
method.
db -rbind(d1,d2)
aggregate(subset(db,select=-c(subject,trt)),
by=list(subject=db$subject),mean)
## or, for example,
aggregate(subset(db,select=-c(subject,trt)),
It's a pretty simple formula, according to the sources I found.
Here's a function that looks right to me, but I have no independent
calculation with which to check it.
(no guarantees!)
Hb - function(ns) {
N - sum(ns)
(lfactorial(N) - sum(lfactorial(ns)))/N
}
ns - c(3,5,2,8)
Hb(ns)
[1]
It's a nice idea, but I wouldn't be optimistic about it happening:
Each of these public databases no doubt has its own more or less unique
API, and the people likely to know the API well enough to write R code to
access any particular database will be specialists in that field. They
likely won't
As Sarah said, you have a path problem.
Are you saying that RawData is a sub-folder (sub-directory) of
SampleProject?
And you are running the script with the working directory set to
SampleProject?
[check using getwd() as Sarah suggested]
If so, it looks like it would work if you use
Also spDistsN1() and spDists() in package sp, a perhaps more basic
starting point for working with spatial data in R.
See also the r-sig-geo mailing list, as well as the CRAN spatial task view.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA
Does this do what you want?
sasf - c('31.12.1959','1.1.1960','1.2.1960')
dt - as.Date(sasf, format='%d.%m.%Y')
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/27/12 7:45 AM, Fischer, Felix
Not tested, but this might be a case for the sqldf package.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/26/12 9:29 AM, maxbre mbres...@arpa.veneto.it wrote:
This is my reproducible example (three data frames: a,
handle the sql 'as' statement
a_b-sqldf(select a.*, b.* from a left join b on a.date=b.date)
a_b_c-sqldf(select a_b.*, c.* from a_b left join c on a_b.date=c.date)
bye
max
- Original Message -
From: MacQueen, Don macque...@llnl.gov
To: maxbre mbres...@arpa.veneto.it; r-help@r
R has several packages for epidemiology. Maybe one of them has it. Take a
look.
To name just two: Epi and epitools
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/27/12 9:01 PM, Dominic Comtois
I would suggest asking this question on r-sig-geo.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 2/3/12 6:59 AM, Bjørn Økland o...@skogoglandskap.no wrote:
Imagine that I have a large number of points (given by
I can't reproduce your error in R 2.14.1 on an OSX 10.6.8 box.
However, your example doesn't start with a graphics device specification.
Did you start the graphics device with x11() before your first plot()
command?
If by R on a terminal you mean in Terminal.app, then you wouldn't
normally get
I suggest you ask this question on r-sig-geo.
And it would be best if you could create a small self-contained example.
For example, what class of object is dataset2?
Is there any reason to expect that the coordinates of the sample will be
exactly the same as any of the coordinates in dataset2?
(apologies in advance for the stupid line-wrapping that I expect my email
software to force upon us)
If I understand correctly what you want, I would
(1) in both data frames, combine date and time into a single column
(variable) that is class POSIXct
(2) use the merge() function
This assumes
I think you must have given the path to the file wrong.
Assuming you are using R.app, try
infile - file.choose()
And then give infile to the read.csv() function.
Then print the value of infile to find out what the path really is.
Probably, you wanted
Try something similar to this:
## unchanged
full - read.table(March_15.dat, sep=,,row.names=NULL,
as.is=TRUE,skip=1,header=TRUE)
## then convert TIMESTAMP to a date-time class
full$TIMESTAMP - as.POSIXct(full$TIMESTAMP)
## now you can use subset()
atimeframe - subset(full,
TIMESTAMP =
I once knew someone who thought that a 1-sided upper 99% confidence limit
for the mean with n=7 was calculated by multiplying the standard error of
the mean by pi.
-Don
On 5/30/11 6:00 PM, Bentley Coffey bentleygcof...@gmail.com wrote:
Pi is an irRATIOnal number, meaning that it is not equal to
Yes, R is a different language, and has different syntax and different
built-in functions, so, yes it works differently.
If you want to do it the same way in R as in that other language, you have
to use a different method for constructing the variable names inside the
loop. Here's an example,
Perhaps
split(mydf, paste(mydf$month,mydf$day))
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/14/13 5:57 AM, condor radonniko...@hotmail.nl wrote:
I have a very dataset which I want to put in new dataframes according
You find the element of clustering_tail that indicates which which point
is in which cluster (the help page for kmeans tells you). Then you use
that element to subset your input data (1.tsv). Then you save each subset
to a separate folder.
By save to a folder I would assume you mean write a tsv
After you get that message, use
conflicts()
(and read the help page for the conflicts function)
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/23/13 10:04 PM, Fumie Sugahara fumie.sugah...@gmail.com wrote:
Hi
Works for me, so you will have to provide more information.
x11()
hist(rnorm(100))
dev.copy2pdf(file='mytest.pdf')
X11
2
list.files(patt='mytest')
[1] mytest.pdf
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On
You haven't given any y values to plotCI.
Try, for example,
plotCI(xx, (lower+upper)/2, ui=upper, (etc)
What you got was in effect
plot( seq(along=xx), xx )
which is standard behavior for plot() when no y values are supplied.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
My sense is that even if this were possible (which I doubt), it would be
outside the scope of what would be considered appropriate in R (assuming I
understand the question). After all, it's someone else's package, theirs
to control and maintain, etc. What if it's an installation of R on a
cron does work just fine on the Mac, and will work the same way as in
Linux, except (almost certainly) for the path to R itself.
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 2/11/13 11:16 AM, Bhupendrasinh Thakre
You say, Š use the R output file in Fortran Š
I guess that means that R is writing an output file which will then be
used as an input file for a fortran program.
In that case, you need to go back to how R is writing the output file,
find out why it is writing blank lines, and correct it. As far
plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n')
par()$usr
[1] 0.88 4.12 8.80 41.20
The x axis range is from 0.88 to 4.12, so tick labels at 0, 100, 200, 300
makes no sense.
Any axis() command where the 'at' values are within the range of the x
axis will work. Even, for example,
In my experience, error messages that include the word closure almost
always mean that I have tried to do something with a function that isn't
supposed to be done with a function (undoubtedly not a technically correct
statement, but it works for me).
I think that applies here, since time is a
I think you can probably specify the base level using the contrMat()
function, which has a 'base=' argument.
Disclaimer:
This is a fragment from something I did recently, and is not intended to
be reproducible by anyone else. Rather, it is intended to provide a hint
as to how to use the
I suppose you have your filenames stored in a character vector, which I
will name myfiles. (Within R, it is not a list; lists have a special
structure).
There is no such thing as a tab separated matrix in R. tab separated
would refer to the file, I presume.
for (nm in myfiles) {
tmpdat -
Yes, it can cause problems. And speaking for myself, I'd say it's not
worth the risk, because it's easy enough to find alternative variable
names that are close enough to the notation of your formulas that
remembering should be no problem. For example, tt, cc, and mmatrix
might do it.
-Don
--
What Jim said separately is correct, and I would suggest following his
advice.
But there are some points worth looking at in your method.
See this example:
item1 - item2 - item3 - item4 - 1:4
matrix1-cbind(item1, item2, item3, item4)
z - c(TRUE,TRUE,FALSE,TRUE)
matrix2 -
Hi Rich,
Immediately after you see one of those messages, do, e.g.,
find('cor')
It should tell you that you have more than one object named 'cor' in your
search path, and where they all are. Then you can decide if it's what you
want (probably not, but can't say from here).
-Don
--
Don
Here is one way. There will be many ways to do it; I offer this one
because it is very general.
-Don
tmp - split(testdata, testdata$personId)
myfun - function(df) {
dfo - df
if (any(df$law=='SVG')) dfo$svg - 1 else dfo$svg - 0
dfo
}
tmpo - lapply(tmp,myfun)
testout - do.call('rbind',
Daniel,
Looking at CRAN, the following might be useful:
memiscTools for Management of Survey Data, Graphics, Programming,
Statistics, and Simulation
questionr Functions to make surveys processing easier
surveyanalysis of complex survey samples
surveydataTools to
I don't know about justify as an arg to print, but the following should
qualify as a hint.
format(c('a','aa','aaa'), justify='left')
[1] a aa aaa
tmp - data.frame(a=c('a','aa','aaa'))
print(tmp,justify='left')
a
1 a
2 aa
3 aaa
tmp$b - format(c('a','aa','aaa'),justify='left')
Instead of
subset(table, select=list1)
try
table[, list1]
However, I suspect you have other problems.
Particularly, i is not defined when you use i %in% namelist.
You may have wanted
i in namelist
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
The select argument to subset() is supposed to name the columns you want
to keep.
So is the syntax I gave, table[,list1], and it is the correct way when
list1 is a character vector (which it is).
Your error message says that at least one of the values in list1 is not
the name of a column in your
You could try the Cairo() device from the Cairo package. It's my
understanding (from a time when I was using Xvgb for the same reason) that
Cairo does not depend on X Windows.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
This does tend to look like homework, but...
If you want them in one vector, then that vector will have length 225*100,
of course. So rt(225*100,225) would do it. Or you could use the matrix()
function to convert this to a matrix. See ?matrix.
-Don
--
Don MacQueen
Lawrence Livermore National
Here's one way.
(not including the conversion to factor)
wdf - data.frame(Date=seq(as.Date(2000/10/1), as.Date(2003/9/30),
days))
wdf$wyr - as.numeric(format(wdf$Date,'%Y'))
is.nxt - as.numeric(format(wdf$Date,'%m')) %in% 1:9
wdf$wyr[ is.nxt ] - wdf$wyr[is.nxt]-1
## and you can do some
And I'd like to add, just for the purpose of learning about R ... even if
wishes to use the loop version, there appears to be a misunderstanding of
R syntax.
The expression
1:225*100
does not produce 22500 numbers to put into the matrix, as apparently
expected.
Compare:
1:3*5
[1] 5 10
As I recall, there is a package that can be used to create interactive svg
files. I don't remember its name, but I seem to recall it was fairly easy
to find on the CRAN packages page.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
As far as recall (it's been a while),
install.packages('xlsx')
worked for me, on a 10.6 system.
You'll have to provide more information.
And probably it would be better to take this to R-sig-mac.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore,
I'm using mtext() to annotate a plot. I would like, if possible, to have
the individual characters formatted with an outline or border, with a
contrasting fill color inside the borders.
I'd appreciate suggestions or pointers toward a way to do this.
The reason is because I'm creating a graphic
/control-font-thickness-without-
changing-font-size
and
http://stackoverflow.com/questions/10686054/outlined-text-with-ggplot2
which refers to a base graphics version.
HTH,
b.
On 20 June 2012 07:58, MacQueen, Don macque...@llnl.gov wrote:
I'm using mtext() to annotate a plot. I would like
Here is an example to use as a starting point for what that error message
means.
x - 1:6
x[1:5] - 1:2
Warning message:
In x[1:5] - 1:2 :
number of items to replace is not a multiple of replacement length
The expression
x[1:5] -
means that we are about to replace the first five elements
1 - 100 of 554 matches
Mail list logo