Displaying 20 results from an estimated 2000 matches similar to: "plot multiple data sets on same axis"
2009 Jul 01
2
?max (so far...)
Hi,
I have a data.frame that is date ordered by row number - earliest
date first and most current last. I want to create a couple of new
columns that show the max and min values from other columns *so far* -
not for the whole data.frame.
It seems this sort of question is really coming from my lack of
understanding about how R intends me to limit myself to portions of a
data.frame. I get the
2009 Jun 30
2
Using functions to change values in a data.frame
I'm having trouble with something that looks easy. (And I'm sure it
will be easier within about 1 minute of receiving my first response.)
Thanks in advance.
I have a collection of data frames that I need to add columns, do some
calculations and then fill in the new columns. Since I have a large
number of similar data frames I want to do this with functions to make
the code more readable
2009 Jul 01
1
running count in data.frame
Hi,
I need to keep a running count of events that have happened in my
data.frame. I found a document called usingR that had an example of
doing this for random coin flips and I tried to modify it. It seems to
sort of work in the beginning, but then it stops and I don't
understand why. I'm trying to duplicate essentially the Excel
capability of =SUM($A$1:$A(Row number))
The example
2012 Sep 26
2
average environmental data if AnimalID and Time is duplicated
Hello,
I tried for about three hours now to solve this problem but I can't figure
it out. I am sure someone knows how do it. At least I hope so.
I have a data frame somewhat like this:
myframe <- data.frame (ID=c("Ernie", "Ernie", "Bert", "Bert"),
Timestamp=c("24.09.2012 09:00", "24.09.2012 09:00", "24.09.2012 10:00",
2011 Mar 30
2
summing values by week - based on daily dates - but with some dates missing
Dear everybody,
I have the following challenge. I have a data set with 2 subgroups,
dates (days), and corresponding values (see example code below).
Within each subgroup: I need to aggregate (sum) the values by week -
for weeks that start on a Monday (for example, 2008-12-29 was a
Monday).
I find it difficult because I have missing dates in my data - so that
sometimes I don't even have the
2017 Aug 19
0
My very first loop!! I failed. May I have some start-up aid?
Thank you for providing the example code... for the request of running it
multiple times it would have helped if you could have confirmed that the
example ran through without errors... there were a lot of mistakes in it.
Look into using the reprex package to check your example next time.
I don't do this kind of analysis... I really don't know what to expect
from the functions. The
2010 Aug 13
3
transforming dates into years
Hello!
If I have in my data frame MyFrame a variable saved as a Date and want
to translate it into years, I currently do it like this using "zoo":
library(zoo)
as.year <- function(x) as.numeric(floor(as.yearmon(x)))
myFrame$year<-as.year(myFrame$date)
Is there a function that would do it directly - like "as.yearmon" -
but for years?
Thank you!
--
Dimitri
2012 Nov 09
3
if between 500-600 give 550
I have a data frame somewhat like this:
myframe <- data.frame (ID=c(2,3,4,5), Hunger =c(415,452,550,318 ))
myframe
Now I would like to add a column to the right which summarizes the values
for Hunger somewhat to reduce the number of values: If the values for Hunger
are between
300-400 I would like to insert the number 350,
between
400-500 insert 450
between
500-600 insert 550
Does
2012 Oct 25
2
mean of a value of the last 2 hours
Hello,
I have a data frame somewhat like that:
myframe <- data.frame (ID=c("Ernie", "Ernie", "Ernie", "Bert", "Bert",
"Bert"), Timestamp=c("24.09.2012 09:00", "24.09.2012 10:00", "24.09.2012
11:00"), Hunger=c(1,1,1,2,2,1) )
myframestime <- as.POSIXct (strptime(as.character(myframe$Timestamp),
2010 Jan 12
3
How to get minimum value by group
I'd like to get a long data set of minimum values from groups in another data
set.
The following almost does what I want. (Note, I'm using the word factor
differently from it's meaning in R; bad choice of words)
myframe = data.frame(factor1 = rep(1:2,each=8), factor2 =
rep(c("a","b"),each=4, times=2), factor3 = rep(c("x","y"),each=2, times=4),
2012 Nov 27
5
loop with date
Hello,
I tried to construct my very first loop today and completly failed :-(
Maybe someone can help me?
I have a dataframe somewhat like this one:
myframe <- data.frame (Timestamp=c("24.09.2012 09:00", "24.09.2012 10:00",
"24.09.2012 11:00",
"25.09.2012 09:00", "25.09.2012 10:00",
"25.09.2012
2017 Aug 19
4
My very first loop!! I failed. May I have some start-up aid?
Dear all,
I have a data similar to this:
myframe<- data.frame (ID=c("Ernie", "Ernie","Ernie","Ernie"),
Timestamp=c("24.09.2012 08:00", "24.09.2012 09:00", "24.09.2012 10:00",
"25.09.2012 10:00"), Longitude=c("8.481","8.482","8.483","8.481"),
2010 Jul 12
1
S4 class extends "data.frame", getDataPart sees "list"
R-Devel:
When I get the data part of an S4 class that contains="data.frame", it gives
me a list, even when the "data.frame" is the S4 version:
> d<-data.frame(x=1:3)
> isS4(d)
[1] FALSE # of course
> dS4<-new("data.frame",d)
> isS4(dS4)
[1] TRUE # ok
> class(dS4)
[1] "data.frame"
2017 Aug 19
0
My very first loop!! I failed. May I have some start-up aid?
[answers inline]
On 18 August 2017 at 20:08, Dagmar <Ramgad82 at gmx.net> wrote:
>
> myframe<- data.frame (ID=c("Ernie", "Ernie","Ernie","Ernie"),
> Timestamp=c("24.09.2012 08:00", "24.09.2012 09:00", "24.09.2012 10:00",
> "25.09.2012 10:00"),
2012 Jul 02
2
Constructing a list using a function...
Hi All
I have a dataframe:
myframe<-data.frame(ID=c("first","second"),x=c(1,2),y=c(3,4))
And I have a function myfun:
myfun<-function(x,y) x+y
I would like to write a function myfun2 that takes myframe and myfun
as parameters and returns a list as below:
mylist
$first
[1] 4
$second
[2] 6
Could you please help me with this? Doesn't seem like the
2002 Jul 18
3
Oddity with names
Hi all,
I'm using R 1.5.1 on Windows 2000. The following snippet of code doesn't
seem to do anything - no error is reported, and there is no name change.
names(myFrame[,c(1:3)]) <- c("name1", "name2", "name3")
This code however works nicely:
names(myFrame)[c(1:3)] <- c("name1", "name2", "name3")
Can anyone suggest why
2008 Mar 31
2
Mouse motion example - help
Hi,
I am trying out this example adapted from the wxpython book, but the
mouse motion event does not seem to be captured right. What am I doing
wrong?
Thanks
warrior
# code below
require ''wx''
class MyFrame < Wx::Frame
def initialize
super(nil, -1, "My Frame", :size => [300,300])
@my_panel = Wx::Panel.new(self, -1)
evt_motion(){ |event|
2005 Apr 03
4
BusyCursor probs in 0.6
The new block version of BusyCursor doesn''t work for me -- some
actions in between the { braces } do not get carried out.
To illustrate, I have taken the nothing.rbw sample app, and added a
couple of lines to it, so the full code now reads:
require ''wxruby''
include Wx
class MyFrame < Wx::Frame
def initialize(title)
super(nil, -1, title)
end
end
class
2012 Dec 17
2
calculate a "rolling mean" including standard deviation
Hello everyone,
I have a data frame somewhat like this one:
myframe <- data.frame (Timestamp=c( "24.09.2012 06:00", "24.09.2012 07:00",
"24.09.2012 08:00",
"24.09.2012 09:00", "24.09.2012 10:00",
"24.09.2012 11:00",
"24.09.2012 12:00",
2010 May 19
1
export dataframe's column classes to a list
Hi Folks,
I want to export a dataframe's column classes to a list so that I can
reinstantiate the dataframe from a CSV file in the future. (I know
about save(), which I'm using in addition to this).
what I want to do is the following:
write.csv(myframe);
col_classes = get_col_classes(myframe);
write.csv(col_classes, "column_classes")
... time passes, R gets