Displaying 20 results from an estimated 4000 matches similar to: "write.csv and header"
2008 Nov 05
2
Simple rep() question duplicating times and dates.
I want to create a data.frame of time and date for a year. I started with the idea of simply producing two vectors (time and date)
The first part ( time) is easy.
rep(1:24, 365)
But how do I get a series of 24 dates for O1 January 2005 and repeat this to 31 December 2005.
It should be easy but I don't see it.
Thanks
2009 Feb 11
3
Generating Numbers With Certain Distribution in R
Dear all,
Is there a way to generate K numbers of integer (K = 10^6).
The maximum value of the integer is 200,000 and minimum is 1.
And the occurrences of this integer follows
a lognormal distribution.
- Gundala Viswanath
Jakarta - Indonesia
2010 Jun 03
2
moving average on irregular time series
Hi all,
I wonder if there is any way to calculate a moving average on an
irregular time series, or use the rollapply function in zoo?
I have a set of dates where I want to check if there has been an event
14 days prior to each time point in order to mark these timepoints for
removal, and can't figure out a good way to do it.
Many thanks in advance!
Gustaf
Example data:
2008 May 23
2
Preparing high quality figures with tiff as end result
Hi all,
I'm currently preparing some figures that will be submitted to PloS One.
In their guidelines they state that they will only accept figures in
tiff or eps format, with the warning that eps figures will be
converted to tiff format ( see
http://www.plosone.org/static/figureGuidelines.action ).
Because of this conversion, I figured I'd generate tiff-format figures
from the beginning.
2007 Sep 28
2
Is there a model like that in R?
Hi to everyone,
I am starting to work with a model that is not familiar to me.
The model would be like that:
y = . - a*max(Q(i) - Q(0), 0) + .
where Q(i) is the accumulated effect of a variable at time i and Q(0) a
threshold above it there is effect on y. The value of Q(i) could be
estimated as:
Q(i+1) = Q(i) + b*max(s(i) - s(0), 0) + c*min(s(i) - s(0), 0) + .
Where s
2008 Dec 11
3
getting ISO week
Hi all,
Is there a simple function already implemented for getting the ISO
weeks of a Date object?
I couldn't find one, and so wrote my own function to do it, but would
appreciate a pointer to the "default" way. If a function is not yet
implemented, could the code below be of interest to submit to CRAN?
Best Regards,
Gustaf
--------------------
2008 Apr 08
1
Change the position of panel strips in a lattice plot.
Hi all,
In lattice plots, is there any option to position the panel strips
with text below each subgraph, instead of above?
i.e. in:
Depth <- equal.count(quakes$depth, number=8, overlap=.1)
xyplot(lat ~ long | Depth, data = quakes)
,is there any way to make "Depth" appear below the subgraphs, instead of above?
I've been looking through the lattice documentation and the list
2010 May 02
2
Set encoding when load()-ing workspaces?
Hi all,
I hope that there is someone that can help me out here.
I am trying to load() a workspace on os x (R 2.11.0) that was saved in
windows XP (R 2.9). In that workspace, there's a data.frame with names
that contain swedish characters. These characters become garbled,
which is a major problem.
>From the R windows FAQ, I read:
"Note though that character data in a workspace will be
2007 Oct 10
2
download.file not working
Hi all,
I'm trying to download a file from the net, and the download.file
command leaves it corrupted, i.e excel cannot open it. It seems as if
it's going ok, however.
Does anyone have an idea of what's going on?
regards,
Gustaf Rydevik
----
>download.file(url="http://www.who.int/entity/whosis/whostat2006_demographics.xls",destfile="whodem.xls")
trying URL
2009 Jan 20
1
two-sample test of multinomial proportion
Hi all,
This is perhaps more a statistics question than an R question, but I
hope it's OK anyhow.
I have some data (see below) with the number of tests positive to
subtype H1 of a virus, the number of tests postive to subtype H3, and
the total number of tests. This is for two different groups, and the
two subtypes are mutually exclusive.
What is the best way to test if the proportion of H1
2007 Sep 14
3
x-axis order
Hi all,
I have a time series which contain data collected weekly from week 26
to week 25 the following year. How do I plot this data, so that the
x-axis is displaying the week numbers, ordered as in the data?
Thanks in advance,
Gustaf
---
x<-c(26:52,1:25)
y<-rnorm(52)+1:52
plot(x,y) ## How do I get the x axis to be ordered by the current
ordering of x?
--
Gustaf Rydevik, M.Sci.
tel:
2007 Oct 10
3
as.dist with diagonal unequal zero
Hello and sorry that I still haven?t found a solution for my problem.
I need to extract the lower and upper triangle from a square matrix
including the diagonal. This diagonal is not zero in that special case.
I tried with as.dist
w<-as.dist(w, diag = TRUE)
> w
1 2 3 4 5
1 0
2 2 0
3 3 8 0
4 4 9 14 0
5 5 10 15 20 0
but found no way to keep the diagonal that is in the
2009 Jan 16
2
data frames with å, ä, and ö (=non-ASCII-characters) from windows to mac os x
Hi,
I ran into this issue previously and managed to solve it, but I've
forgotten how and am getting frustrated...
I have a data frame (see below) with scandinavian characters in R
(2.7.1) running on a Win Xp-computer. I save the data frame in an
RData-file on a usb stick, and load() it in R (2.8.0) running on OS X
10.5. Now the name of the data frame and all factor labels with
scandinavian
2007 Sep 19
2
function on factors - how best to proceed
Sorry about this one being long, and I apologise beforehand if there
is something obvious here that I have missed. I am new to creating my
own functions in R, and I am uncertain of how they work.
I have a data set that I have read into a data frame:
> gctable[1:5,]
refseq geometry X60_origin X60_terminus length kingdom
1 NC_009484 cir 1790000 773000 3389227 Bacteria
2
2008 Oct 24
1
Automatically adjust text size in plot
Hi all,
I'm writing a function that will automatically generate a report based
on answers to a questionnaire. The exact questions and answers to the
questionnaire can vary. One of the question types is in a "matrix"
format, where the agreement to several statements can be indicated on
a scale.
I'm planning to plot this on a multilevel barplot, and only labeling
each "bar
2008 Oct 29
4
How to get the duplicated elements from a vector?
Dear all,
How can I get the duplicated elements from a vector? For example,
x <- c("yes", "no", "yes", "yes", "no", "not sure"), how can I filter
out all the elements which occured >=2 times?
Thanks for any help!
Regards,
Leon
2010 Mar 31
2
Simplifying particular piece of code
Hello, everyone
I have a piece of code that looks like this:
mrets <- merge(mrets, BMM.SR=apply(mrets, 1, MyFunc, ret="BMM.AV120",
stdev="BMM.SD120"))
mrets <- merge(mrets, GM1.SR=apply(mrets, 1, MyFunc, ret="GM1.AV120",
stdev="GM1.SD120"))
mrets <- merge(mrets, IYC.SR=apply(mrets, 1, MyFunc, ret="IYC.AV120",
2008 Oct 07
1
FW: Reading Data
Rahul Agarwal
Analyst
Equities Quantitative Research
UBS_ISC, Hyderabad
On Net: 19 533 6363
hi let me explain you the problem
we have a database which is in this format
Stocks 30-Jan-08 28-Feb-08 31-Mar-08 30-Apr-08
a 1.00 3.00 7.00 3.00
b 2.00 4.00 4.00 7.00
c 3.00 8.00 655.00 3.00
d 4.00 23.00 4.00 5.00
e 5.00 78.00 6.00 5.00
and we have a query
2008 Oct 02
3
function in R
Dear ALL,
Does anyone know how to get the complete code program for any build-in function
in R, e.g. when I tape mean in the R-console, I get the following:
mean
function (x, ...)
UseMethod("mean")
<environment: namespace:base>
but I need the full mean function.
Thank in advance,
Alphonse.
[[alternative HTML version deleted]]
2008 Jul 23
1
[Fwd: Re: Coefficients of Logistic Regression from bootstrap - how to get them?]
I think the argument supporting the use of bootstrap to determine
coefficients, as opposed to just running linear regression on the whole
dataset, is the comparison of Rsq and prediction errors between these
two approaches - page 1502. There's a substantial difference in favor of
the bootstrap approach.
--
Michal J. Figurski
Gustaf Rydevik wrote:
> The url for the mentioned paper is