Displaying 20 results from an estimated 100 matches similar to: "stacking consecutive columns"
2013 Apr 22
2
subset dataframe
I can't understand what is happening. This is the code and results:
> agoa <- read.table(file = "C:/Users/HTPC/Documents/_Documents/Research/WithDidia/AGOAUSImports.txt", header = T, sep = "\t", dec = ".", na.strings = "NA", stringsAsFactors = T)#
> str(agoa); names(agoa)
'data.frame':109 obs. of 19 variables:
$ X : Factor w/ 39
2009 Jun 12
2
Sweave recode(car) and Lyx, compiling but not executing on Mac
I am just beginning to use Sweave with Lyx on a Mac (R2.8.1). I have
12 chunks of Sweave code that work fine, but this piece:
<<>>=
library(car)
2008 Jun 11
1
Barplot help
#I am having trouble figuring out this one. I have read the help and I am
at a loss. what am I missing
x <- structure(list(X = structure(c(6L, 5L, 9L, 2L, 10L, 8L, 7L, 3L,
13L, 12L, 11L, 4L, 1L, 1L, 1L), .Label = c("", "April", "August",
"December", "February", "January", "July", "June", "March",
2012 Jan 13
1
apply transformation
Hello All,
I have the following dataset:
Year 2006 2007
Jan Jan 0.0204 0.0065
Feb Feb 0.0145 0.0082
Mar Mar 0.0027 0.0122
> dput(d_tmp)
structure(list(Year = c("Jan", "Feb", "Mar"), `2006` = c(0.0204,
0.0145, 0.0027), `2007` = c(0.0065, 0.0082, 0.0122)), .Names =
c("Year",
"2006", "2007"), row.names = c("Jan",
2008 Jul 08
1
making zoo objects with zoo without format argument?
#this is a subset of a larger data frame and I am okay with subsetting it as
there are redundant time stamps, but I would like to create a zoo object out
of this and I am having a hard #time figuring out how to do this the date
structure is year and then month
x <- structure(list(Yearmonth = structure(c(12L, 24L, 1L, 13L, 14L,
3L, 15L, 4L, 16L, 5L, 17L, 6L, 18L, 7L, 19L, 8L, 20L, 9L, 21L,
2006 Oct 27
3
How to best divide table by table
Hi all,
how can I divide two tables of the same dimension so that all names are
preserved, ie do not become NA? I have "tab1" and "tab2", each having
names in the first column. I want "tab3" with the same names and values
"tab1/tab2".
Thanks,
Serguei
2009 Oct 19
2
how to get rid of 2 for-loops and optimize runtime
Short: get rid of the loops I use and optimize runtime
Dear all,
I want to calculate for each row the amount of the month ago. I use a matrix with 2100 rows and 22 colums (which is still a very small matrix. nrows of other matrixes can easily be more then 100000)
Table before
Year month quarter yearmonth Service ... Amount
2009 9 Q3 092009 A ...
2018 Mar 05
4
raster time series statistics
Hi List,
The following code returns an "Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format"
require(raster)
require(rts)
require(stringi)
r <- raster(ncol=100, nrow=100)
values(r) <- runif(ncell(r))
list(ID=seq(1:24),month=rep(str_pad(1:12, pad = 0,width = 2 , "left"),2),year=sort(rep(2016:2017,12)))->dt
2012 Nov 07
8
Aggregate data frame across columns
Folks,
I have a data frame with columns 200401, 200402, ..., 201207, 201208.
These represent years/months. What would be the best way to sum these columns by year? What about by quarter?
Thanks for your time,
KW
--
[[alternative HTML version deleted]]
2006 Apr 05
1
Comparing against values (e.g. date ranges)
Hi all,
I'm once again looking for search with date ranges. e.g. All entries
before a certain date.
I understand that Omega does this by adding keywords for each year,
month and day number separately and construcing a big OR query
year = 1980 or year = 1981 or year = 1982 .... or (year = 1983 and
(month =1 or month = 2 ...))
I think Olly said he was considering adding something to Xapian,
2008 Aug 17
1
Allocated Memory Warnings in Vista 32 bit with 4 GB (PR#12557)
Hello
I am running Windows Vista 32 with 4 GB (installed, though Windows of cours=
e only recognizes 3326 MB, as reported by Windows "My Computer")
I am running R 2.7.1
I was trying to read in a comma delimited single column CSV file, assign th=
at file to a variable ("data") and then extract a sample (assigned to "part=
ial"). I was getting memory allocation
2018 Mar 06
0
raster time series statistics
> On Mar 5, 2018, at 3:28 PM, <Alexander.Herr at csiro.au> <Alexander.Herr at csiro.au> wrote:
>
> Hi List,
>
> The following code returns an "Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format"
I'm unable to produce that error. Which function was being evaluated to produce the error? I don't see
2018 Mar 06
0
raster time series statistics
Hi Herry,
This is probably due to a call to strptime (or similar). No, it
doesn't accept %Y-%m as a valid format. Maybe add a constant day to
all the dates as that will work:
dt<-list(ID=seq(1:24),month=rep(formatC(1:12,flag=0,width=2),2),
year=sort(rep(2016:2017,12)))
timelst<-paste(unlist(dt['year']),unlist(dt['month']),"01",sep="-")
2018 Mar 06
2
raster time series statistics
Last line in the following (updated) code produces the error
require(raster)
require(rts)
require(stringr)
r <- raster(ncol=100, nrow=100)
values(r) <- runif(ncell(r))
stack(r)->s
r->rs
for(i in 1:23){
rs[]<-r[]*i
addLayer(s,rs)->s
print(nlayers(s))
}
dt<-list(ID=seq(1:24),month=rep(formatC(1:12,flag=0,width=2),2),
year=sort(rep(2016:2017,12)))
2023 Jan 05
1
R 'arima' discrepancies
Rob J Hyndman gives great explanation here
(https://robjhyndman.com/hyndsight/estimation/) for reasons why results
from R's arima may differ from other softwares.
@iacobus, to cite one, 'Major discrepancies between R and Stata for
ARIMA'
(https://stackoverflow.com/questions/22443395/major-discrepancies-between-r-and-stata-for-arima),
assign the, sometimes, big diferences from R
2010 Jan 10
1
scatterplot matrix with ggplot2
#I would like to use the below data to make a scatter plot matrix with
#code similar to that below the data
#conceptually this is the right approach I think
#thanks in advance
melt.gg <- structure(list(stream = c("Bonham Lower", "Bonham Lower",
"Bonham Lower",
"Bonham Lower", "Bonham Lower", "Bonham Lower", "Bonham Lower",
2024 Oct 04
1
Warning message: Removed 888 rows containing missing values or values outside the scale range (`geom_line()`)
Dear all,
I tried to rerun the examples given by Hyndman in otexts but keep on
getting errors and I have searched through google but no solution yet.
Thank you in advance for any help given.
library(fpp3)
library(lubridate)
library(xts)
library(fabletools)
library(ggplot2)
library(dplyr)
library(gridExtra)
> dput(head(new_us_retail_employment,100))structure(list(Month = structure(c(-11323,
2008 Aug 18
0
Allocated Memory Warnings in Vista 32 bit with 4 GB (PR#12560)
I see no bug here. R is telling you that you have insufficient memory
available: see also ?"Memory-limits".
See also rw-FAQ Q2.9.
Note that we don't have a reproducible example and in particular have no
idea of how many columns this data frame has.
The 'R Data Import/Export' manual gives you many hints on how to do this
more efficiently, and it is referenced from the
2010 Feb 09
2
Double Integral Minimization Problem
Hello all,
I am trying to minimize a function which contains a double integral, using
"nlminb" for the minimization and "adapt" for the integral. The integral is
over two variables (thita and radiusb)
and the 3 free parameters I want to derive from the minimization are
counts0, index and radius_eff.
I have used both tasks in the past successfully but this is the first time
2018 Mar 06
0
raster time series statistics
I can't test that at the moment as I don't have the libraries. Perhaps later.
Jim
On Tue, Mar 6, 2018 at 11:36 AM, <Alexander.Herr at csiro.au> wrote:
> Last line in the following (updated) code produces the error
> require(raster)
> require(rts)
> require(stringr)
> r <- raster(ncol=100, nrow=100)
> values(r) <- runif(ncell(r))
> stack(r)->s
>