Displaying 20 results from an estimated 700 matches similar to: "Reading hierarchical data"
2004 Feb 24
3
Calculate Distance and Aggregate Data?
Hi all,
I've been struggling learning R and need to turn to the list again.
I've got a dataset (comma-delimited file) with the following fields: recid, latitude, longitude, population, dwelling and age. For each observation, I'd like to calculate the total number of people and dwellings and average age within 2 k.m. Distance could be Euclidean, however, a proper distance
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
2008 Mar 30
2
convert weekly time series data to monthly
I have weekly time series data with year, month, day, and price variables.
The input data set for the weekly series takes the following form:
Year month day price
1990 8 20 119.1
1990 8 27 124.5
1990 9 3 124.2
1990 9 10 125.2
1990 9 17 126.6
1990 9 24 127.2
1990 10 1 132.1
1990 10 8 133.3
1990 10 15 133.9
1990 10 22 134.5
1990 10 29 133.9
.. ... ... ...
... ... .... ....
2008 3 3 313.7
2008
2008 Apr 30
2
Bug? in summary( ) function base package
There seems to be an error in the summary() function when applied to "ts"
class objects. The results of a call to summary( ), on the R "ts" data set
USAccDeaths , reports the wrong value for Max. The value reported by the
summary function is 11320. The max( ) function returns the correct value
11317, the July 1993 value. Coercing the data to a data.frame and calling
summary
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
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
2010 Apr 08
1
reshape panel data
I have a data set with observations on 549 cities spanning an 18 year
period. However, some of cities did not report in one or more of the 18
years. I would like to implement the procedure suggested by Wooldridge
section 17.1.3 in his "Econometric analysis of cross section and panel data"
to correct for attrition. For example the table below indicates that the 3rd
and the 7th cities in
2007 Dec 05
1
Working with "ts" objects
I am relatively new to R and object oriented programming. I have relied on
SAS for most of my data analysis. I teach an introductory undergraduate
forecasting course using the Diebold text and I am considering using R in
addition to SAS and Eviews in the course. I work primarily with univariate
or multivariate time series data. I am having a great deal of difficulty
understanding and working with
2008 Apr 11
1
Read text file subsetting rows
Hi All,
Can anyone direct me to a read function in R that will allow me to only
read in rows of a text file that begin with a particular value such as
the data below. I would read the entire file in and then limit, but the
files were constructed such that the first two letters determine how
many variables are in the row (different letters mean different numbers
of columns and different
2006 May 03
5
Listing Variables
How does one create a vector whose contents is the list of variables in a
dataframe pertaining to a particular pattern?
This is so simple but I cannot find a straightforward answer.
I want to be able to pass the contents of that list to a "for" loop.
So let us assume that one has a dataframe whose name is Data. And let us
assume one had the height of a group of people measured at
2013 Nov 20
3
Invalid VA => ptr conversion with xc_dom_* API after XSA-55 fox
Hi list,
Jeff and FastIce pointed out a regression between Xen 4.1.2 and 4.1.6
when starting NetBSD domU; the kernel syms table gets slightly corrupted
[1].
After dwelling into libxc code, FastIce noticed that changing back the
return value to "ptr + offset" (instead of just "ptr") for
xc_dom_vaddr_to_ptr() makes it work again.
According to [2] while fixing XSA-55, Ian
2013 Mar 03
4
Help searching a matrix for only certain records
Let me start by saying I am rather new to R and generally consider myself to be a novice programmer...so don't assume I know what I'm doing :)
I have a large matrix, approximately 300,000 x 14. It's essentially a 20-year dataset of 15-minute data. However, I only need the rows where the column I've named REC.TYPE contains the string "SAO " or "FL-15".
My
2008 Jan 11
1
question about xreg of arima
Hi,
I am trying to understand exactly what xreg does in arima. The documentation
for xreg says:"xreg Optionally, a vector or matrix of external regressors,
which must have the same number of rows as x." What does this mean with
regard to the action of xreg in arima?
Apparently somehow xreg made the following two arima fit equivalent in R:
arima(x, order=c(1,1,1), xreg=1:length(x))
is
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
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
2004 Feb 26
1
Distance and Aggregate Data - Again...
I appreciate the help I've been given so far. The issue I face is
that the data I'm working with has 53000 rows, so in calculating
distance, finding all recids that fall within 2km and summing the
population, etc. - a) takes too long and b) have no sense of progress.
Below is a loop that reads each recid one at a time, calculates the
distance and identifies the recids that fall within 2
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
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 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:
>
>
>