Displaying 20 results from an estimated 1000 matches similar to: "using "aggregate" when variable names contain spaces"
2011 Jul 14
2
cbind in aggregate formula - based on an existing object (vector)
Hello!
I am aggregating using a formula in aggregate - of the type:
aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata)
However, I actually have an object (vector of my variables to be aggregated):
myvars<-c("var1","var2","var3")
I'd like my aggregate formula (its "cbind" part) to be able to use my
"myvars" object. Is it
2011 Apr 04
2
merging 2 frames while keeping all the entries from the "reference" frame
Hello!
I have my data frame "mydata" (below) and data frame "reference" -
that contains all the dates I would like to be present in the final
data frame.
I am trying to merge them so that the the result data frame contains
all 8 dates in both subgroups (i.e., Group1 should have 8 rows and
Group2 too). But when I merge it it's not coming out this way. Any
hint would be
2011 Jan 26
1
aggregate(as.formula("some formula"), data, function) error when called from in a function
I'm having a problem with aggregate.formula when I call it in a function and the function is converted from a string in the funtion
I think my problem may also only occur when the left hand side of the formula is cbind(...)
Here is example code that generates a dataset and then the error.
The first function "agg2" fails
> agg2(FALSE)
do agg 2
Error in m[[2L]][[2L]] : object
2009 Oct 06
2
Extracting year from a date object
Hi all,
this one left me a bit puzzled, as I don't seem to find a function to
perform this easily. I must have overlooked the obvious, so sorry in
advance.
I have a list of dates in numerical format (i.e. 34576), defined as
the number of days that passed since january 1st 1900. So I apply the
function :
> MyDate <-as.Date(34576,origin="1900-01-01")
> MyDate
[1]
2006 May 21
1
POSIX, time zone and Windows
Dear Listers,
Apologize to pile up on the 'tz' issue in POSIX objects. I have a
'simple' thing on which I must make up my mind but cannot do it from the
existing R-help threads. I am currently working on dog telemetry in
China, and download time information from GPS collars. I would like to
set up the corresponding POSIXxx variables in R to a given time zone. Eg
Pekin
2011 Mar 01
2
Does POSIXlt extract date components properly?
I would like to use POSIX classes to store dates and extract components of
dates. Following the example in Spector ("Data Manipulation in R"), I
create a date
> mydate = as. POSIXlt('2005-4-19 7:01:00')
I then successfully extract the day with the command
> mydate$day
[1] 19
But when I try to extract the month
> mydate$mon
[1] 3
it returns the wrong month. And
2013 Apr 02
2
Create a vector without using an external 'if statement'
Dear R-users,
suppose I have three dataframes like these
df1:
mydate min_temp
31032013 12
01042013 8
02042013 -999
df2:
mydate min_temp
31032013 10
01042013 11
02042013 14
df3:
mydate min_temp
31032013 4
01042013 3
02042013 5
where -999 means that the temperature data is not available (at the moment I cannot change it to NA because I am not the db administrator);
suppose also that oggi is
2011 Oct 27
1
plotting large time series
hello,
I got a problem with plotting large time series, since I want to store
the results in a .PDF file (I want to store several pages of plots). The
PDF files get too large to be handled (> 10MB, one was even 200MB big).
So I wonder, if there would be a possibilty to either
- reduce the file size of the PDF
- change the way the plot is generated to reduce the plot size?
I use:
2009 Aug 28
2
new data.frame summed by date
Hi,
I wonder if someone can suggest how to create a new data.frame Y
from X where X$PL_Pos is summed by each unique X$MyDate. Y should end
up with two (or more) columns Y$MyDate and Y$PL_Sum with its value
being the cumsum of all the values in X for that date. - a 'daily
cumsum'.
Thanks,
Mark
TStoDate = function (TSDate) {
X = strptime(TSDate + 19e6L, "%Y%m%d")
2011 May 19
1
Creating a "shifted" month (one that starts not on the first of each month but on another date)
Hello!
I have a data frame with dates. I need to create a new "month" that
starts on the 20th of each month - because I'll need to aggregate my
data later by that "shifted" month.
I wrote the code below and it works. However, I was wondering if there
is some ready-made function in some package - that makes it
easier/more elegant?
Thanks a lot!
# Example data:
2020 Mar 10
2
Fwd: Windows upssched does not work
Hi,
I have problem with upssched on windows. Upssched is not executed. I
have 2 scripts, 1 for notification in upsmon and second for scheduling
in upssched. Monitoring is working fine, script write to log. I'm
using binary windows installer 2.6.5-6 from NUT.
Here are my configs:
--- nut.conf
MODE=netclient
--- upsmon.conf
MONITOR ups_1000 at 192.168.3.95 1 <user> <password> slave
2011 Aug 24
2
data manipulation and summaries with few million rows
I have a data set with about 6 million rows and 50 columns. It is a
mixture of dates, factors, and numerics.
What I am trying to accomplish can be seen with the following
simplified data, which is given as dput output below.
> head(myData)
mydate gender mygroup id
1 2012-03-25 F A 1
2 2005-05-23 F B 2
3 2005-09-08 F B 2
4 2005-12-07 F B 2
2009 Mar 11
1
Is this a documentation bug? Spss dates import
Hello R-user
bug seekers are needed!
In order to perform these simple tasks you have to use a copy of SPSS
and obviously R.
The problem is that date conversion of data coming from SPSS
gives wrong results, if we follow ?as.POSIXct
## SPSS dates (R-help 2006-02-17)
z <- c(10485849600, 10477641600, 10561104000, 10562745600)
as.Date(as.POSIXct(z, origin="1582-10-14",
2009 Jan 21
1
finding row and column indices of date in multiple columns of a data frame
Hi,
I have a data.frame SAMPLES with columns:
Site Site# Season Day1 Day2 Day3
Day1, Day2, Day3 are class "Date", the other columns are numeric or
factor.
I have a date "mydate" that may or may not be listed in my data.frame
and I need to find that out.
If "mydate" is there, I want to get the number of the data.frame row
where it occurs.
2007 Aug 20
2
library(fCalendar) timeDate("12.03.2005",format="%d.%m.%Y")
Dear R users,
I have problem with the library fCalendar.
I am not using the US standard format notations. It seems like it is not
possible to have different format than the US standards.
Anyone how knows a way to go around this problem?
Here is the code I enter:
myDate = "12.03.2005"
timeDate(myDate, format = "%d.%m.%Y")
And I get following error message:
Error in if
2011 Sep 13
1
Deleting Rows based on Factor and Time Period
Hi All!
I have been messing around with this problem for about a week but to no
avail! The following data has been cut down in order to make my question
reproducible. The alldat data frame includes 2 columns: 1 date column and 1
factor column (equity names)).
2008 Sep 17
3
Dates in C api
r-devel,
I've been trying to write a C plugin for R, and I'm struggling to
understand how dates are represented.
I can create a date in R:
> mydate<-as.Date(1, origin="1900-01-01") mydate
[1] "1900-01-02"
When I pass my date to a plugin, though, it's type is that of a real.
There doesn't seem to be a date type in Rinternals.h, is there a way to
2007 Jun 13
5
Confusion with sapply
Hi,
I have 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 <-
2009 May 04
1
how to remove ( ) ? when using write.csv(chron.object)
Hello all,
I don' like to have ( ) around my datetime, when send the csv file to somebody.
How to remove it?
>library(chron)
>mydate <- c("2009-05-03","2009-06-07")
>mytime <- c("10:30:00","10:20:00")
>mydatetime <- chron(dates=mydate,times=mytime,format=c("y-m-d","h:m:s"))
>write.csv(mydatetime)
2005 Oct 14
2
events after sort
hi,
i''ve just started use prototype.js et al, i am currently creating a sortable
list with:
Sortable.create(''id'', { onChange: myFunc });
but what i really want is an event that occurs after the li''s have been
reordered and settled into the new list order.
how would i do that?
i know i can do for exampe:
Event.observe(''id'',