Displaying 20 results from an estimated 200 matches similar to: "use date as x-axis"
2013 Oct 16
7
Is there something wrong with R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"?
Hi,
pnorm(-1.53,0,1) under version 3.0.2 gives 0.05155075. I am pretty sure it
should be 0.063. Is there something wrong with this version of R?
I am using:
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: i686-pc-linux-gnu (32-bit)
--
Tom
[[alternative HTML version deleted]]
2008 May 09
1
Which gls models to use?
Hi,
I need to correct for ar(1) behavior of my residuals of my model. I noticed
that there are multiple gls models in R. I am wondering if anyone
has experience in choosing between gls models. For example, how
should one decide whether to use lm.gls in MASS, or gls in nlme for
correcting ar(1)? Does anyone have a preference? Any advice is appreciated!
Thanks,
--
Tom
[[alternative HTML
2008 Apr 29
2
function to generate weights for lm?
Hi,
I would like to use a weighted lm model to reduce heteroscendasticity. I am
wondering if the only way to generate the weights in R is through the
laborious process of trial and error by hand. Does anyone know if R has a
function that would automatically generate the weights need for lm?
Thanks,
--
Tom
[[alternative HTML version deleted]]
2007 Dec 31
3
stack charts right on top of each other
Hi,
I tried to stack two charts on top of each other using the following
R functions:
par(mfrow=c(2,1))
plot(rnorm(1:3),xaxt="n",xlab="")
plot(rnorm(1:3))
This created two charts, one on top of the other, but there is too much
space between them. Does anyone know how to elimiate the space in between
the charts?
Thanks,
--
Tom
[[alternative HTML version deleted]]
2006 Oct 21
2
how do I find the row index number, or row name, of a given value in a vector?
Hi,
I noticed that max(x) returns the maximum value of a vector, but the
function doesn't give the user the option of retrieving the row index number
instead. If I used max(x) to find the maximum value of vector x, then is
there a function I can use to find the index number, or row name, of the
maximum value?
Thanks,
Tom
[[alternative HTML version deleted]]
2007 Dec 01
2
R function for percentrank
Hi,
Does anyone know if R has a built-in function that is equvalent to Excel's
percentrank, i.e., returns the rank of a value in a data set as a percentage
of the data set?
Thanks,
--
Tom
[[alternative HTML version deleted]]
2008 Mar 09
2
format numbers into percentages
Hi,
I am currently using the following to formate numbers into percentages:
x=0.00112
paste(round(x*100,2),"%",sep="")
I am wondering if there is a built in R function that does the same. Does
anyone know?
Thanks,
--
Tom
[[alternative HTML version deleted]]
2008 Jan 04
2
question about scale() function
Hi,
The documentation for scale() states:"If center is TRUE then centering is
done by subtracting the column means (omitting NAs) of x from their
corresponding columns". But it seems that R is subtracting something else
instead of the column mean:
> x=c(2,4,3,4,5)
> mean(x)
[1] 3.6
> x-mean(x)
[1] -1.6 0.4 -0.6 0.4 1.4
> scale(x)
[,1]
[1,] -1.4032928
[2,]
2006 Nov 01
4
Problem with data type recognition and conversion
Hi,
I have a CSV file with two columns; the first column is date, second column
is numbers. I used read.csv() to load the file into the variable temp.
Somehow, R could not recognize my numbers as double. Instead, it thinks
these numbers are integer even though they all have decimal points (isn't
that strange?). The problem I ran into is that if I tried to convert the
numbers to double using
2008 May 07
2
cross-correlation lag.plot?
Hi,
Does anyone know if R has a function that is similar to lag.plot but instead
of auto-correlation, it plots cross-correlation with lags?
Thanks,
--
Tom
[[alternative HTML version deleted]]
2008 Apr 07
2
How to add background color of a 2D chart by quadrant
Hi,
I have a 2D chart that is divided into four quadrants, I, II, III, IV:
plot(1:10,ylim=c(0,10),xlim=c(0,10),type="n")
abline(v=5,h=5)
text(x=c(7.5,7.5,2.5,2.5),y=c(2.5,7.5,7.5,2.5),labels=c("I","II","III","IV"))
I would like to fill each quadrant with a background color unique to the
quadrant. Does anyone know how to do this in R?
Thanks,
--
2008 Jan 23
3
How to do more advanced cross tabulation in R?
Hi,
I am trying to reproduce some functionalities of Excel pivot table in R,
sadly, I couldn't figure out how to do it. I am wondering if this is even
possible in R. Does anyone know?
Here is an example:
year=rep(2003,16)
quarter=rep(1:4,each=4)
sales=1:16
company=rep(c("a","b","c","d"),4)
df=data.frame(year,quarter,sales,company) #this is the
2007 Apr 12
2
Construct time series objects from raw data stored in csv files
Hi,
I have time series data stored in csv files (see below for an example of the
data). I understand that in order to analyze my data in R, I need to first
transform it into a ts object. Howeve, I could not find an example on how
exactly to do that. Is ts the only function I need? What are the steps that
I need to go through to build a time series object from raw data like this?
Thanks,
Tom
2006 Oct 16
2
help with plot()
Hi,
I am new to R and I have been trying it out. I ran into a problem with the
plot() function. Below is my code:
> d <- read.table("c:/test/sp.txt",header=0)
> spval <- d[,2]
> plot(spval,type="l")
Warning messages:
1: graphical parameter "type" is obsolete in: plot.window(xlim, ylim, log,
asp, ...)
2: graphical parameter "type" is
2007 Dec 16
2
question about the aggregate function with respect to order of levels of grouping elements
Hi,
I am using aggregate() to add up groups of data according to year and month.
It seems that the function aggregate() automatically sorts the levels of
factors of the grouping elements, even if the order of the levels of factors
is supplied. I am wondering if this is a bug, or if I missed something
important. Below is an example that shows what I mean. Does anyone know if
this is just the way
2008 Jan 21
2
how to extract data by specific months from a monthly ts object
Hi,
I am trying to extract data from a ts object by month, e.g., extract Jan,
Feb, and Aug data from a monthly ts object. I tried the following but it
didn't work:
> xa=1:50
> ta=ts(xa,start=c(1990,1),frequency=12)
> ta[cycle(ta)==c(1,2)] # this method works but it's not what I want
[1] 1 2 13 14 25 26 37 38 49 50
> ta[cycle(ta)==c(1,2,8)] # this method doesn't work,
2006 Oct 21
2
object(s) are masked from package - what does it mean?
Hi,
Sometime when I attach a dataset, R gives me the following
message/warning:"The following object(s) are masked from package:datasets:
column_name". Does anyone know what it means? Since it seems that the
dataset was attached and I could manipulate the data from the dataset
without problems, I am wondering what was R trying to tell me.
Thanks,
Tom
[[alternative HTML version
2008 Jan 24
2
plot help
Hi,
Suppose I already have two plots on the same screen, and I want to draw
lines in each of them. Is that possible in R? It seems that once you have
two plots on the screen, you can only draw lines in the the last plot, never
the 1st. Here is what I mean:
#some data
y1=rnorm(1:3)
y2=rnorm(1:3)
#draw two plots on the same screen
par(mfrow=c(2,1),oma = c(6, 0, 5, 0))
par(mar=c(0, 5.1, 0, 5.1))
2007 Nov 28
6
How to create data frame from data with unequal length
Hi,
I have two sets of data that I would like to put into a data frame. But
since they have different length, I am not sure how to do this. Here is an
example of my data:
data set one:
date growth
1/1/2007 10
1/2/2007 10.2
1/3/2007 10.4
1/4/2007 10.6
data set two:
date growth
1/1/2007 22
1/2/2007 22.5
1/4/2007 22.4
I would like to combine the two data sets and
2006 Oct 19
4
Question about random sampling in R
Hi,
I looked up the help file on sample(), but didn't find the info I was
looking for.
When sample() is used to resample from a distribution, e.g., bootstrap, how
does it do it? Does it use an uniform distribution, e.g., runif(), or
something else? And, when the help file says:"sample(x) generates a random
permutation of the elements of x (or 1:x)", would I be correct if I