Displaying 20 results from an estimated 8000 matches similar to: "exclude columns with at least three consecutive zeros"
2011 Nov 19
3
reshape data.frame
A late friday afternoon coding question. I'm having a hard time thinking
of the correct search terms for what I want to do.
If I have a df like this:
a <-
data.frame(name=c(rep('a',10),rep('b',15)),year=c(1971:1980,1971:1985),amount=1:25)
name year amount
1 a 1971 1
2 a 1972 2
3 a 1973 3
4 a 1974 4
5 a 1975 5
6 a 1976
2017 Sep 15
7
require help
hello to all. I am working on macroeconomic data series of India, which in
a yearly basis. I am unable to convert my data frame into time series.
kindly help me.
also using zoo and xts packages. but they take only monthly observations.
'data.frame': 30 obs. of 4 variables:
$ year: int 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
$ cnsm: num 174 175 175 172 173 ...
$ incm:
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
2017 Sep 16
2
require help
You can just use the same code that I provided before but now use your
dataset. Like this
df <- read.csv(file="data2.csv",header=TRUE)
dates <- as.Date(paste(df$year,"-01-01",sep=""))
myXts <- xts(df,order.by=dates)
head(myXts)
#The last command "head(myXts)" shows you the first few rows of the xts
object
year cnsm incm wlth
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),
2017 Sep 16
0
require help
oky.. thank you very much to all of you
On Sat, Sep 16, 2017 at 2:06 PM, Eric Berger <ericjberger at gmail.com> wrote:
> You can just use the same code that I provided before but now use your
> dataset. Like this
>
> df <- read.csv(file="data2.csv",header=TRUE)
> dates <- as.Date(paste(df$year,"-01-01",sep=""))
> myXts <-
1999 Jan 18
1
Program advice
Hi
Starting to use R as a serious tool, I have come across a programming
problem that I can't see the answer too yet. Can someone advise me plese.
The problem is that I want to plot a series of lines which represent short
term growths. All the data is in a single vector and I can indicate
the index via a second vector. In GLIM, if the second vector is a factor,
a single $GRA Size Year
2017 Sep 16
0
require help
> On 15 Sep 2017, at 11:38, yadav neog <yadavneog at gmail.com> wrote:
>
> hello to all. I am working on macroeconomic data series of India, which in
> a yearly basis. I am unable to convert my data frame into time series.
> kindly help me.
> also using zoo and xts packages. but they take only monthly observations.
>
> 'data.frame': 30 obs. of 4 variables:
2004 Mar 09
1
vector extraction
Hello,
I could need some help on this one:
>From the data.frame "Test.dataset2" below (TSCS data for 151
"countries.to.map" for "year" 1973-95; each "country.to.map" is described by
a unique code), I would like to extract a vector "color" that for each
"country.to.map" takes on the value of "dv" (a categorical variable with
2017 Sep 22
2
require help
Assuming the input data.frame, DF, is of the form shown reproducibly
in the Note below, to convert the series to zoo or ts:
library(zoo)
# convert to zoo
z <- read.zoo(DF)
# convert to ts
as.ts(z) #
Note:
DF <- structure(list(year = c(1980, 1981, 1982, 1983, 1984), cnsm = c(174,
175, 175, 172, 173), incm = c(53.4, 53.7, 53.5, 53.2, 53.3),
with = c(60.3, 60.5, 60.2, 60.1, 60.7)),
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
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
2009 Jan 14
1
publication statistics from Web of Science
Dear list,
This is a bit of an off-topic question, but I'm hoping to get some
advice from more experienced people. I've used the website "Web of
Science" to manually collect publication counts responding to several
keywords as a function of date, since the 1960s.
http://apps.isiknowledge.com/RAMore.do?product=UA&search_mode=&SID=P1g9lFJp9 at
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
>
1999 Feb 11
2
An idea for something better than read.table
I was recently converting some datasets for use in an R package and it
occurred to me that there really is no "neat" way to input a data
frame if it is to contain factor variables.
One can use dput()/source or dump() after massaging data into the
right format, of course, but there isn't really anything which allows
you to store the input instructions with the data beyond the simple
2005 Aug 13
1
How to make a lagged variable in panel data?
Suppose we observe N individuals, for each of which we have a
time-series. How do we correctly create a lagged value of the
time-series variable?
As an example, suppose I create:
A <- data.frame(year=rep(c(1980:1984),3),
person= factor(sort(rep(1:3,5))),
wage=c(rnorm(15)))
> A
year person wage
1 1980 1 0.17923212
2 1981
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
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,
2010 Jan 11
3
interpolation
Dear R-users,
I have a complex line by xy-values (ordered by z).
And I would like to get interpolated y-values on the positions of x = 0:600.
How do I get the correct points?
x=c(790,790,790,790,790,786,783,778,778,766,763,761,761,761,715,628,521,350,160,134,134,129,108,101,93,111,161,249,288,243,139,45,7)
2017 Sep 15
0
require help
> On 15 Sep 2017, at 12:38, yadav neog <yadavneog at gmail.com> wrote:
>
> hello to all. I am working on macroeconomic data series of India, which in
> a yearly basis. I am unable to convert my data frame into time series.
Do you really need to convert your data to time series/xts/zoo? I don?t know you try what kind of an analysis but perhaps you don?t have to.
> kindly