Displaying 20 results from an estimated 500 matches similar to: "Creating time series (ts) object"
2013 Mar 12
5
extract values
Hello all!
I have a problem to extract values greater that for example 1820.
I try this code: x[x[,1]>1820,]->x1
Please help me!
Thank you!
The data structure is:
structure(c(2.576, 1.728, 3.434, 2.187, 1.928, 1.886, 1.2425,
1.23, 1.075, 1.1785, 1.186, 1.165, 1.732, 1.517, 1.4095, 1.074,
1.618, 1.677, 1.845, 1.594, 1.6655, 1.1605, 1.425, 1.099, 1.007,
1.1795, 1.3855, 1.4065, 1.138, 1.514,
2012 Dec 17
1
subset handling
Dear Rui and UseRs,[a text file has also been attached, in case the format of my email is difficult to get]I am extremely sorry that I am bothering you once again, but I?ll have to get to the bottom of it. The following command
sp <- lapply(split(agg, agg$st), function(x) x[order(x$year, x$month), ])
gave me an output with monthly mean of population(as under). i am not able to apply
2012 Dec 17
3
mean of each month in data
Dear R users,
[in case the format of email is changed or you dont finf it easy to understand, i have attached a text file of my question]
i have the data in the following format and i want to convert it in the
format given at the end.
Ta ans Sa are the names of certain cities. there are 69 cities in my
data.
column 1 is representing station name (i am writing the data of only
two cities for
2008 Mar 26
3
Loop problem
Dear all, I have a problem with a loop, if anyone has any knowledge on
these things I would appreciate some comments. The code below is
designed to allow me to extract the top record of the data frame, and
them remove rows from the data frame which have an index close to the
extracted top record.
topstorm<-subset(rankeddataset[1,]) ## Extracts the top storm
2013 Mar 14
1
ggplot2 problem
Hello all!
I have a problem with ggplot2 library. I want to do an heat map and the y
variables are the year months. If I use the following code, he y values are
in alphabetical order, but I want it in month order.
The code is:
library(reshape)
library(ggplot2)
library(scales)
p <- ggplot(data.m, aes(variable, Month)) + geom_tile(aes(fill = value),
2009 Aug 21
1
applying summary() to an object created with ols()
Hello R-list,
I am trying to calculate a ridge regression using first the *lm.ridge()*
function from the MASS package and then applying the obtained Hoerl
Kennard Baldwin (HKB) estimator as a penalty scalar to the *ols()*
function provided by Frank Harrell in his Design package.
It looks like this:
> rrk1<-lm.ridge(lnbcpc ~ lntex + lnbeerp + lnwinep + lntemp + pop,
subset(aa,
2017 Jul 05
4
Help with reshape/reshape2 needed
Hi all:
I'm struggling with getting my data re-formatted using functions in
reshape/reshape2 to get from:
1957 0.862500000
1958 0.750000000
1959 0.300000000
1960 0.287500000
1963 0.675000000
1964 0.937500000
1965 0.025000000
1966 0.387500000
1969 0.087500000
1970 0.275000000
1973 0.500000000
1974 0.362500000
1976 0.925000000
1978 0.712500000
1979 0.337500000
1980 0.700000000
1981 0.425000000
2006 Jul 25
3
Overplotting: plot() invocation looks ugly ... suggestions?
Hi WizaRds,
I'd like to overplot UK fuel consumption per quarter over the course of five years.
Sounds simple enough?
Unless I'm missing something, the following seems very involved for what I'm trying to do. Any suggestions on simplifications?
The way I did it is awkward mainly because of the first call to plot ... but isn't this necessary, especially to set limits for the
2009 Nov 22
1
Metaplot Axis Annotation
Hello,
We are looking to adjust the font size of the axis annotation on the graph
that results from use of the metaplot() function. Metaplot seems to respond
to cex and cex.lab to change those graphical parameters, but it doesn't
respond to cex.axis. Is there a way to work around this by creating a
customized x-axis, and if so, how?
Thanks for all your help. Syntax is below.
Best,
Dawn
2017 Jul 05
0
Help with reshape/reshape2 needed
This does not use reshape/reshape2, but it is pretty straightforward. Assuming X is your example data:
> Y <- split(X[, 2], X[, 1])
> vals <- sapply(Y, length)
> pad <- max(vals) - vals
> Y2 <- lapply(seq_along(Y), function(x) c(Y[[x]], rep(NA, pad[x])))
> names(Y2) <- names(Y)
> X2 <- do.call(cbind, Y2)
> X2[, 1:6]
1957 1958 1959
2017 Jul 05
0
Help with reshape/reshape2 needed
The reason it doesn't work easily with reshape/reshape2 is that the
order of the rows is not determined. Your answer could be
1957 1958 ... 1985 1986
0.8625000 0.7500000 ... 0.7307692 0.23750000
0.0733945 0.6435644 ... NA 0.05769231
0.5096154 NA ... NA 0.65137615
or
1957 1958 ... 1985 1986
0.0733945 0.6435644 ... NA
2017 Jul 05
1
Help with reshape/reshape2 needed
Hi Tom,
Or perhaps:
#assume the data frame is named "tadf"
library(prettyR)
stretch_df(tadf,1,2)
Jim
On Thu, Jul 6, 2017 at 6:50 AM, Ista Zahn <istazahn at gmail.com> wrote:
> The reason it doesn't work easily with reshape/reshape2 is that the
> order of the rows is not determined. Your answer could be
>
> 1957 1958 ... 1985 1986
>
2008 Nov 04
1
perform Kruskal-Wallis test without using the built-in command in R
Hi,
again i am stuck in my presentation, and i have never learn R before in my
life but need this to be done, so please help me out for a favour:
http://www.nabble.com/file/p20333155/kew.dat kew.dat
run this in R and these comes up:
Month Year Rain
1 Jan 1900 74.400000
2 Feb 1900 80.500000
3 Mar 1900 23.600000
4 Apr 1900 23.600000
5 May 1900 25.100000
6
2005 Jun 08
1
logistic regression (glm binary)
Hi
I am looking for a couple of pointers using glm (family = binary).
1. I want to add all the products of my predictive features as
additional features (and I have 23 of them). Is there some easy way to
add them?
2. I want to drop each feature in turn and get the most significant,
then drop two and get the next most significant, etc. Is there some
function that allows me to do this?
2011 Dec 12
2
Colours for sunflowerplot
Dear fellow R users,
I would like to draw a "sunflowerplot" because I have data (decade by
month) that plots multiple times on the same x-y co-ordinates. Further I
would like to colour each of the points/sunflower leaves on the plot
according to the group they belong to (i.e. which type of event each
represents within that decade and month). I thought that this would be
relatively
2008 Oct 16
1
lmer for two models followed by anova to compare the two models
Dear Colleagues,
I run this model:
mod1 <- lmer(x~category+subcomp+category*subcomp+(1|id),data=impchiefsrm)
obtain this summary result:
Linear mixed-effects model fit by REML
Formula: x ~ category + subcomp + category * subcomp + (1 | id)
Data: impchiefsrm
AIC BIC logLik MLdeviance REMLdeviance
4102 4670 -1954 3665 3908
Random effects:
Groups Name Variance
2012 Nov 12
5
Matrix to data frame conversion
I have a matrix which I wanted to convert to a data frame. As I could not
succeed and resorted to export to csv and reimport it again. Why did I fail
in the attempt and how can I achieve what I wanted without this
roundabouts?
The original matrix:
> str(comb_model0)
num [1:90, 1:4] 3.5938 0.0274 0.0342 0.0135 0.0207 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:90]
2007 Sep 17
3
data frame
Hi everybody,
If I've a data frame like this:
dataframe a
X0 X2 X4 X6 X8 X10 X12 X14 X16
1957 0 0 0 0 0 0 0 0 0
1958 0 0 0 0 0 0 0 0 0
1959 831 0 0 0 0 0 0 0 0
1960 544 282 0 0 0 0 0 0 0
1961 446 365 0 0 0 0 0 0 0
1962 442 473 0 0 0 0 0 0 0
1963 595 468 0 0 0 0 0 0 0
1964
2007 Dec 03
3
restore NAs in residuals
Dear All,
I have two vectors:
tt = c(6.87, 7.43, 6.4, 4.5, 5.5, 5.87, NA, NA, NA, 7.7)
year = 1966:1975
Residuals
lm(tt~year)$res
do not contain NAs for the three years of missing temperature tt. Is there a
simple way to get these NAs back into the residual's vector?
Thank you,
Sorama
[[alternative HTML version deleted]]
2006 Apr 25
2
School Years/Teams listing problem
People,
I have tables years and teams and I have the years listing like:
1965
1966
1967
.
.
I want to be able to click on the year and ONLY list teams for that
year. At first I thought the following was working until I started
populating the table with teams for more than one year.
For views/years/list.rhtml:
<% for year in @years %>
<tr>
<td>
<%= link_to