Displaying 20 results from an estimated 300 matches similar to: "Descriptive Statistics of time series data"
2016 Apr 24
0
Dividing rows in groups
This will handle all the columns; it assumes the ones you want to start
with are in column 2 through the end:
> library(dplyr)
> df1 <- read.table(text = "ID A B
+ 1 1 2
+ 1 0 3
+ 2 5 NA
+ 2 1 3
+ 3 1 4
+ 4 NA NA
+ 4 0 1
+ 4
2016 Apr 24
0
Inserting a blank row to every other row
Hi Saba,
I don't know how to do what you want and I also cannot see why.
If you describe what you hope to achieve there might be a different
solution.
Best wishes
Ulrik
Saba Sehrish via R-help <r-help at r-project.org> schrieb am So., 24. Apr.
2016 14:04:
> Hi
>
> I need to insert a blank row after every row in R data frame. I have
> achieved it through:
>
>
>
2016 Apr 22
0
Finding Highest value in groups
Assuming your dataframe is in a variable x:
> require(dplyr)
> x %>% group_by(ID) %>% summarise(maxVal = max(Value,na.rm=TRUE))
On Fri, 2016-04-22 at 13:51 +0000, Saba Sehrish via R-help wrote:
> Hi
>
>
> I have two columns in data frame. First column is based on "ID" assigned to each group of my data (similar ID depicts one group). From second column, I
2016 Apr 24
0
Inserting a blank row to every other row
Oh, sorry, I just realized that I messed up the indicing. Here is the
correct way:
> z <- data.frame(a=1:3,b = letters[1:3])
> i <- seq_len(nrow(z))
> z<-z[rep(i,e=2),]
> z[2*i, ] <- matrix(NA, nr=nrow(z),nc=ncol(z))
> z
Still doubt that this is a good idea, though.
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
2016 Apr 24
2
Inserting a blank row to every other row
Well, something like this would work (there may be slicker solutions):
> z <- data.frame(a=1:3,b = letters[1:3])
> i <- seq_len(nrow(z)) *2
> z <-rbind(z,z)
> z[i, ] <- matrix(NA, nr=nrow(z),nc=ncol(z))
> z
a b
1 1 a
2 NA <NA>
3 3 c
4 NA <NA>
5 2 b
6 NA <NA>
But I agree with you that there is probably a way to handle the
underlying
2016 Apr 06
1
Descriptive Statistics of time series data
Hi
I have four variables and the time series data for each variable consists of values for past 10 years on monthly basis. I want to get descriptive stats for these four variables separately (mean, median, sd, min, max).
The data I import to R consists of different columns, where each column gives values for one month of a particular year (e.g. March 31st, 2010). Right now R gives descriptive
2007 Mar 24
2
Two Problems while trying to aggregate a dataframe
Hello!
Given is an Excel-Sheet with actually 11,000 rows and 9 columns. I want
to work with the data in R. The contents are similar to my following
example.
I have a list with ID-number, personal name and two kinds of
loan-values. I want to aggregate the list, that for each person only one
row remains and where the loan-values are added.
First I tried some commands with tapply but had no
2009 Mar 24
1
Problem with new Samba 3.2.3 Ubuntu install: "INTERNAL ERROR 6 in pid XXXX"
I'm setting up a new Samba install on a fresh Ubuntu install. Samba is
3.2.3.
When I try to list shares, that works:
---------
stew@saba:/etc/samba$ smbclient -L saba
Enter stew's password: <accepts correct password here>
Domain=[MYDOMAIN] OS=[Unix] Server=[Samba 3.2.3]
Sharename Type Comment
--------- ---- -------
Library Disk
2016 Apr 24
2
Inserting a blank row to every other row
Hi
I need to insert a blank row after every row in R data frame. I have achieved it through:
df[rep(1:nrow(df),1,each=2),]
But it inserts a row with name of previous row, while i want a complete blank row without any name/title.
Please guide me
Regards
Saba
2007 Nov 28
2
extracting year an month from ts data set
I have an ascii data set of monthly observation starting in Jan 1946 with a
header.
hstarts
57
65
95
103
103
97
94
.
.
.
Which I read with the following code
tab6.1<-ts(read.table(fname, header=TRUE),frequency=12,start=c(1946,1))
I would like to run a time series model with dummy variables for each month.
If I had a variable which take values from 1 to 12 indicating the month I
could use
2016 Apr 10
1
working with unequal rows
Hi
I have a data frame with rows specifying companies (codes are assigned to companies) and columns specify months (monthly data). The data is based on male (M) and female (F) information for each month. Following is an example of how my data looks like:
01 02 03 04
001 M M M na
001 F M M M
002 M na F F
003 F F F M
003 F F M na
003 M
2016 Apr 22
2
Finding Highest value in groups
Hi
I have two columns in data frame. First column is based on "ID" assigned to each group of my data (similar ID depicts one group). From second column, I want to identify highest value among each group and want to assign the same ID to that highest value.
Right now the data looks like:
ID Value
1 0.69
1 0.31
2 0.01
2 0.99
3 1.00
4 NA
4
2008 Jan 03
1
R procedure similar to STATA heckprob?
Is anyone aware of an R procedure similar to STATA's "heckprob" procedure?
"Heckprob" fits maximum likelihood probit models correcting for sample
selection bias.
Thanks,
Richard Saba
Department of Economics
Auburn University
Email: sabaric@auburn.edu
[[alternative HTML version deleted]]
2008 Mar 21
1
tseries(arma) vs. stats(arima)
Hello,
The "arma" function in the "tseries" package allows estimation of models
with specific "ar" and "ma" lags with its "lag" argument.
For example: y[t] = a[0] + a[1]y[t-3] +b[1]e[t-2] + e[t] can be estimated
with the following specification : arma(y, lag=list(ar=3,ma=2)).
Is this possible with the "arima" function in the
2016 Apr 24
3
Dividing rows in groups
Hi
I have two data frames as shown below (second one is obtained by aggregating rows of similar IDs in df1.). They both have similar number of columns but rows of df2 are lesser than rows of df1.
df1:
ID A B
1 1 2
1 0 3
2 5 NA
2 1 3
3 1 4
4 NA NA
4
2009 Mar 05
2
Overriding contributed package functions
The "tsdiag" function in the TSA package overrides the "tsdiag" function in
the "stats" package. There are a few annoying bugs in the TSA's version of
the function so I would like to use the "stats" function but still have
access to other TSA functions. I have tried using stats::tsdiag( ) but as
long as the TSA package is attached the function from
2011 Aug 15
1
Read variable column width data
Reading data with variable column widths.
Here are several lines of a txt data set I would like to read.
The number of variables is fixed at 13 . The problem is how to read the
first variable when it can contain blank space-- for example " Alabama
(Seasonally Adjusted)" , "St. Clair", etc.
Alabama (Seasonally Adjusted) 2,168,870 2,162,604 2,122,787 1,954,895
1,956,026
2008 Feb 12
2
Formulae for R functions
Can someone direct me to a resource or resources that list the formulae used
by R functions (i.e. predict.lm ) to calculate the statistic reported. I
am not a programmer and studying the r code is extremely slow going. I
have searched r-project.org and all the function help files without
success. For example I have attempted to replicate by hand the se.fit
calculation from a lm object
2013 Feb 26
1
problem with nested loops
Each of the data sets contains monthly observations on price indices for 7 countries. I use the fitted values from reg1 in the reg2 model. The interior loop executes without error as long as I explicitly specify the data set, i.e. data=dat70. However the code fails to execute if I specify the model in the form of the commented line, i. e reg1 <-dynlm(form1,data=Dnames[j])
I get the following
2010 Feb 07
2
Reading hierarchical data
I would like to read the following hierarchical data set. There is a family
record followed by one or more personal records.
If col. 7 is "1" it is a family record. If it is "2" it is a personal
record.
The family record is formatted as follows:
col. 1-5 family id
col. 7 "1"
col. 9 dwelling type code
The personal record is formatted as follows:
col.