search for: dayofyear

Displaying 17 results from an estimated 17 matches for "dayofyear".

2008 Aug 27
1
Updating a list.
I have a list that is generated from the resape package function 'cast'. It consists of three columns, Sku, DayOfYear, variable it is generated like: r2007 <- cast(m2008, DayOfYear ~ variable | Sku, sum) Now DayOfYear can range from 1:365 but there are not necessarily that many rows in the list. What I want to do is make every row in the list of lenght 365 and have the values correspond to the sum of the DayO...
2008 Aug 09
1
Reshape set operations?
I have mange to use the library reshape to give me data structures that I want. Specifically: m2008 <- melt(t2008, id.var=c("DayOfYear","Category","SubCategory","Sku"), measure.var=c("Quantity")) m2007 <- melt(t2007, id.var=c("DayOfYear","Category","SubCategory","Sku"), measure.var=c("Quantity")) r2008 <- cast(m2008, DayOfYear ~...
2008 Aug 05
1
RESHAPE cast help.
I have a set of data that is basically sales figures for a given year. It has columns for Yeaqr, Day Of Year, Sku, SubCatetory, and Category. The first few lines of data look like: Year DayOfYear Sku Quantity CatId Category SubCategory 1 2007 1 100091 1 10862 HOLIDAY Christmas 2 2007 1 100138 1 11160 PET COSTUMES Famous (Licensed) 3 2007 1 100194 1 10749 HATS, WIGS & MASKS Wigs - Women's 4 20...
2009 Mar 11
1
Reshape question.
This hopefully is trivial. I am trying to reshape the data using the reshape package. First I read in the data: a2009 <- read.csv("Total2009.dat", header = TRUE) Then I trim it so that it only contains the columns that I have interested in: m2009 <- melt(a2009, id.var=c("DayOfYear","Category","SubCategory","Sku"), measure.var=c("Quantity"), na.rm=TRUE) Then I start to formulate the data that I will process: c2009 <- cast(m2009, DayOfYear ~ variable | Category, sum) Finally I aggregate the data: t2009 <- cast(m2009, DayOf...
2008 Jul 26
1
Simple vector question.
I have some data that I read in via read.csv: sales2007 <- read.csv("Total2007.dat", header=TRUE) The data looks like: > sales2007[1:605,] Year DayOfYear Sku Quantity CatId Category SubCategory 1 2007 1 100091 1 10862 HOLIDAY Christmas 2 2007 1 100138 1 11160 PET COSTUMES Famous (Licensed) 3 2007 1 100194 1 10749 HATS, WIGS & MASKS Wigs - Women's 4 20...
2008 Aug 11
3
Exporting a list of lists
I have a list List(Sku=" ", Shape=1, Scale=3, DayOfYear=daylist) Note: picture daylist as c(2,3,4,3) it is a list with variable length. Then I have a list of lists al <- c(al, List(List(Sku=" ", Shape=1, Scale=3, DayOfYear=daylist)) Note: same comment on daylist as above. So far this creates a list of lists just how I want it. If I do al...
2008 Jul 26
4
Data length mismatch.
...two vectos (list) that represent a years of data. Each "row" is represented by the day of year and the quantity that was sold for that day. I would like to form a new vector that is the difference between the two years of data. A sample of A (and similarly B) looks like: > A[1:5,] DayOfYear x 1 1 1429 2 2 3952 3 3 3049 4 4 2844 5 5 2219 > D <- A - B This works just fine if A and B are both the same length. How is the best way to handle the situation where A and B are of different lengths? If the day of year exists in both vectors (li...
2008 May 15
1
lattice histogram problem with integers values and nint
...of two adjacent bins. Want to know if this is a familiar problem, and what the recommended work-around is. Also want to know how to get the bin count from the lattice histogram object, as I would with hist$count. Thanks in advance. Detail I have a dataset of approximately 170,000 rows, with a DayOfYear field. I want a histogram of the number of rows in each day of the year. I set up breaks from 0:365, and use this with hist, and the lattice histogram, e.g. histogram(dfTemp$DayOfYear,breaks=breaklist,type="count") If I use hist to display this, all values are under 600, everything is...
2008 Aug 07
1
Where is the archive? Calling a function within a function.
...ng up before so I decided to look at the archive and realized that I didn't know where it was. Is there a searchable archive for this list? Thank you. My question is calling a function from within a function. I have smerge <- function(d1,d2) { temp <- merge(d1,d2,all=TRUE,by.x="DayOfYear",by.y="DayOfYear") return (xmerge(temp)) } But I get an error message indicating that xmerge could not be found when it is defined just above. Thank you. Kevin
2008 Aug 08
1
write.csv writing the "index"
I have a simple command to export a data.frame: write.csv(output, "TotalPredicted2008.dat") The structure of the data.frame can be seen with: > head(output) DayOfYear Sales 1 1 1429 2 2 3952 3 3 3049 4 4 2844 5 5 2219 6 6 2340 But it seems that the index is getting written out to the file. The first few lines look like: "","DayOfYear","Sales" "1",1,1429 "2",...
2008 Aug 08
2
Length of data.frame column
I have a beginner question. After I finally get the data to a data.frame that I can work with I have the following a data frame that is fairly long: > length(r2007) [1] 17409 If I look at the first element: > r2007[1] $`100009` DayOfYear Quantity 1 66 1 2 128 1 3 137 1 4 193 1 Now how do I get the length of this list (actually it is another data.frame)? I have tried: > length(r2007[1]) [1] 1 Not right. And: > length(r2007[1]$DayOfYear) [1] 0 Also not right the length...
2012 Mar 27
1
Convert day of year back into a date format.
...'2008-01-14','2008-01-15', '2008-01-16','2008-01-17','2008-01-18','2008-01-19','2008-01-20','2008-01-21','2008-01-22','2008-01-23') ## this is then converted into a number corresponding to the day of the year like so: dayofyear <- strptime(date, format="%Y-%m-%d")$yday + 1 ## Now my question is how do I get back to a date format (obviously omitting the year). ## The end result is that I'd like to be able to have axis labels as something like "Month-Day" or just "Month" ## instead of j...
2012 Oct 07
2
gam error message: matrix not +ve definite
...inux machine to take advantage of the much larger computing capacity. The version of mgcv(1.7-21) and R (2.15.1) is the same on both machines. The data set to which the model if fitted is too large to post here but it contains 2209 observations, and the model is of the form: gam(Response~Year + s(Dayofyear,k=5,bs='cc') + s(Longitude,Latitude,k=4) + s(Coast_distance,k=4), family=Gamma('log'), data=dat, gamma=1.4) I realize this is a very particular question, but any help would be really appreciated. Thanks, Dan. -- View this message in context: http://r.789695.n4.nabble.com/gam-err...
2008 Jul 12
1
Assoociative array?
I have search the archive and I could not find what I need so I will try to ask the question here. I read a table in (read.table) a <- read.table(.....) The table has column names like DayOfYear, Quantity, and Category. The values in the row for Category are strings (characters). I want to get all of the rows grouped by Category. The number of unique category names could be around 50. Say for argument sake the number of categories is exactly 50. Can I somehow get a vector of length 50 co...
2011 Jul 07
3
How to make matrix missing data 0
Dear All, I am trying to analysis traffic data with one timestamp column and speed column. This data set contains six years data; for each year, I want to make a matrix in (day of the year) * (hour) 0 1 2 . . . 23 1 2 . . 365 However random day's record is missing(e.g. there are 40 missing records in 2005 data set), when I tried to use tapply function, matrix came out is
2009 Jan 22
1
convergence problem gamm / lme
...e to lon and lat, modelled the density instead of using a count with model offset, and we normalized the explanatory variables. We also changed several settings (see models below). Interestingly, we do manage to fit a more complex model: gamm2<-gamm(count~offset(offsetter)+ s(lat,lon,year,dayofyear), random=list(code_tripnr=~1),family="poisson", correlation = corGaus(0.1, form=~lat + lon)) The models are fitted using mgcv 1.4-1 and R 2.7.1 on a 64Bits Debian OS. So there seems to be a convergence problem, correct? And does someone have an idea what might cause this? Secondl...
2009 Jan 28
2
t.test in a loop
Hi All, I've been having a little trouble with creating a loop that will run a a series of t.tests for inspection, Below is the code i've tried, and some checks i've looked at. I've used the get(paste()) idea as i was told previously that the use of the eval should try and be avoided. I've run a single syntax to check that my systax is correct and works without any problems