Displaying 20 results from an estimated 24000 matches for "months".
2007 Jun 13
5
Confusion with sapply
...some confusion in applying a function over a column.
Here's my function. I just need to shift non-March month-ends to March
month-ends. Initially I tried seq.dates, but one cannot give a negative
increment (decrement) here.
return(as.Date(seq.dates(format(xdate,"%m/%d/%Y"),by="months",len=4)[4])
)
Hence this simple function:
> mydate <- as.Date("2006-01-01")
>
> # Function to shift non-March company-reporting dates to March.
> Set2March <- function(xdate){
+ # Combines non-March months into March months:
+ # Dec2006 -> Mar2007
+ # Mar2006...
2010 Mar 26
3
Help with assigning a value based on existing numbers
Hi All
I have a column/variable called time difference. It has a whole list of
numbers from 0 through to the hundreds eg 236. I want to assign a
corresponding "name" to each variable from a predefined list: Month or
less, 1 -2 months, 2-3 months etc
So the result would look something like:
Time Difference Month
1 Month or less
365 1-2 years
52 2-3 months
Etc
I have tried using if...
2011 Jun 02
2
shading in overlap between two ranges
I have 2 datafiles 'target' and 'observed' as shown below (I will gladly
email these 2 small files to whomever). X25. And X75. Indicate the
value of 25th and 75th-percentile of the target ('what should be') and
the observed ('what is'). The i.value is simply the month.
> target
X i.value X25. X75.
1 one.month 1 10.845225 17.87237
2
2010 Jul 23
1
Error produced by read.zoo: "bad entries"
Hello!
I have a data set similar to the data set "monthly" in the example below:
monthly<-data.frame(month=c(20090301,20090401,20090501,20100301,20100401,20090301,20090401,20090501,20100301,20100401),monthly.value=c(100,200,300,101,201,10,20,30,11,21),market=c("Market
A","Market A", "Market A","Market A", "Market A","Market
2009 Mar 04
10
total per user
so I am trying to sum month over month the amount that a user has
posted. So for example:
User 1: Jan $3000 Feb $4000 March $1500, etc. I can get this to work
if I sum totals (aggregate of all users) but just not by user.
Here is my code in the controller:
def index
@users = User.find :all, :order => ''name ASC''
@deal_groups = Deal.find(:all).group_by {|t|
2010 Oct 13
3
Matrix subscripting to wrap around from end to start of row
Perhaps it is just that I don't even know the correct term to search for,
but I can find nothing that explains how to wrap around from the end to a
start of a row in a matrix.
For example, you have a matrix of 2 years of data, where rows are years, and
columns are months.
month.data = matrix(c(3,4,6,8,12,90,5,14,22, 8), nrow = 2, ncol=5)
I would like to take the average of months 5:1 for each year (for row 1
=12.5). However, I am passing the start month (5) and the end month (1) as
variables.
I would like to do something like
year.avg = apply(month.data[, start...
2012 Dec 17
3
mean of each month in data
..., as i wrote, i have 69 cities
and the actuall table runs down very deep.)
Column 2 represnts the year for which the data is given (Actuall data
for each station is of different length but atleast of 24 years).
Column 3 and 4 reprent the month and the day of the data. obviously
each year has 12 months and each month as different number of days, but
to make table easily understable only 3 months and 3 days of each month
are considered. febrary for leap years should also be considered.
col5 represents population of that city
st. year month day population in million
Ta 1966 1 1 2.4
Ta 1966 1 2...
2007 Sep 11
2
Function to get a sequence of months
Hi all,
I am looking for a function for following calculation.
start.month = "July"
end.month = "January"
months = f(start.month, end.month, by=1)
* f is the function that I am looking for.
Actually I want to get months = c("July", "August",.............."January")
If start.month = 6 and end.month = 1 then I could use (not properly) seq()
function and then I would get month as...
2009 Jun 02
3
montly mean temp plot
Dear all
i got a problem in monthly mean temperature. here i am attaching the data set as well as the plot i got with the following command
plot(month,type='n')
plot(month,X1999)
this command gave the plot where the month names are in alphabetic order, i want the plot in monthly sequence
could you please suggest me how can i solve my problem?
thanking you
regard
madan
2017 Apr 12
3
"table(droplevels(aq)$Month)" in manual page of droplevels
The last line of the example in droplevels' manual page seems to be incorrect to me. I think it should read: "table(droplevels(aq$Month))". Amazingly (I don't understand) both variants seem to produce the same result (R 3.3.3):
---
> aq <- transform(airquality, Month = factor(Month, labels = month.abb[5:9]))
> aq <- subset(aq, Month != "Jul")
>
2010 Apr 12
1
N'th of month working day problem
...>> construct a function that isolates the n'th working day of each month for
>> zoo object (time series) to create monthly data from daily observations.
>>
>> I found out that the code works fine except for the 29 till 31st dates of
>> each month as it skips some months (February for example).
>>
>> If you could help me isolate the problem I would be grateful as I can not
>> find a way to explain to R to keep the last working day of month if I
>> choose the 29th, 30th or 31st dates...
>>
>> I enclose a working version of the...
2011 May 27
2
help with barplot
...ave a data.frame with 3 columns. The first column represents an
"incident" type
The second column represents a "month"
The third column represents a "time"
Code for a sample data.frame
incidents <- rep(c('a','b','d','e'), each =25)
months <- rep(c(1,2), each =10)
times <-rnorm(100)
# make my sample data
DF <-
data.frame(Incidents=as.factor(incidents),Months=as.factor(months),Time=times)
# now calculate a mean for the "by" groups of incident type and month
pivot <-
aggregate(DF$Time,by=lis...
2013 Jun 15
2
Plotting two y-axis vs non-numeric x-axis
Hi dear all, the following code is correct. but I want to use non-numeric
x-axis, for example
if I replace time <- seq(0,72,6) by
month <-
c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Pag")
Ofcourse I use factor(month) instead of
2009 Jun 25
4
Using by() and stacking back sub-data frames to one data frame
Dear all,
I have a code where I subset a data frame to match entries within
levels of an factor (actually, the full script uses three difference
factors do do that). I'm very happy with the precision with which I can
work with R, but since I loop over factor levels, and the data frame is
big, the process is slow. So I've been trying to speed up the process
using by(), but I got stuck at
2006 Feb 28
5
Getting number of days in a month
In PHP, there was an argument you could pass to the Date function to
get the number of days in the current month:
echo date("t"); // Outputs "28" for February
I don''t see anything like this in Ruby/Rails. Right now, I''m using a
very ugly line to pull the last day of the month:
@number_of_days = (Date.strptime(Date.today.strftime("%Y-%m-01"))
2008 Dec 01
3
Failure to subset in R v 2.8.0
Hello,
I've been using a pre-release version of R v 2.8.0 for Windows for the last couple months. I think that there have been consistent problems with subsetting data sets, but I had usually been able to find work-arounds or was unable to confirm this as a bug. I think now I have, and would love advice on what to do if I've made some error.
The data set in question ("c") has...
2006 Jan 16
8
[newbie] This Month / Next Month / The One After That
...;d like code that prints out the name of this month (January) the next
month (February) and the one after that (March)
I''ve been able to print this month:
<% t = Time.now %>
<%= t.strftime(" This Month is: %B") %>
But I can''t figure out how to get the next months to print out!
--
Posted via http://www.ruby-forum.com/.
2005 Oct 11
6
adding 1 month to a date
Within an R dataset, I have a date field called “date_”. (The dates are in the format “YYYY-MM-DD”, e.g. “1995-12-01”.)
How can I add or subtract “1 month” from this date, to get “1996-01-01” or “ “1995-11-01”.
---------------------------------
[[alternative HTML version deleted]]
2007 May 10
3
Getting the last day of the month.
Hi,
Given a date, how do I get the last date of that month? I have
data in the form YYYYMM, that I've read as a date using
> x$Date <-
as.Date(ISOdate(substr(x$YearEnd,1,4),substr(x$YearEnd,5,6),1))
But this gives the first day of the month. To get the last day of the
month, I tried
> as.Date(as.yearmon(x$Date,frac=0))
But I don't get the last day of the month here. (Tried
2007 May 08
3
plotting a point graph with data in X-axis
Um texto embutido e sem conjunto de caracteres especificado associado...
Nome: n?o dispon?vel
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070508/1c7def0a/attachment.pl