Displaying 20 results from an estimated 300 matches similar to: "apply pairs function to multiple columns in a data frame"
2011 Mar 24
2
Help with creating a ts (time series) object with daily sampling values
Hi All,
I have a data set of daily measurements of river flow. I would like to
create a "ts" object from this data.
Here's a sample data set:
date <- as.Date(c(1:300), format="%Y")
year=as.numeric(format(date, format = "%Y"))
month=as.numeric(format(date, format = "%m"))
julianday=as.numeric(format(date, format = "%j"))
2012 May 29
1
Extract time from irregular date and time data records
Hello,
I am having a problem making use of some data outputted from an
instrument in a somewhat weird format. The instrument outputs two
columns - one called JulianDay.Hour and one called Minutes.Seconds. I
would like to convert these columns into a single column with a time.
So I was using substr() and paste to extract that info. This works
fine for the JulianDay.Hour column as there are always
2010 Mar 24
2
translating SQL statements into data.table operations
I've recently stumbled across data.table, Matthew Dowle's package. I'm
impressed by the speed of the package in handling operations with large
data.frames, but am a bit overwhelmed with the syntax. I'd like to express
the SQL statement below using data.table operations rather than sqldf (which
was incredibly slow for a small subset of my financial data) or
import/export with a
2008 Jul 15
1
code reduction (if anyone feels like it)
# I am sure that I could be more efficient than this but how? Thanks in
advance.
#GPS in Decimal Degrees in the form longitude latitude
RM215 <- matrix(c(-82.1461363, 33.5959109), nrow=1)
SC <- matrix(c(-82.025888, 33.606454), nrow=1)
RM202 <- matrix(c(-81.9906723, 33.5027653), nrow=1)
RM198 <- matrix(c(-81.926823, 33.4634678), nrow=1)
HC <- matrix(c(-81.920505, 33.46192), nrow=1)
2011 Feb 07
3
Loop to find dates whithin dates
Hello to all,
I have two dataframes, the first with two columns sunrise and sunset (for 10
years). Each of these columns is formatted for date time (ex: 01-Jan-2010
15:37:00)
In the second data frame I have GPS information and also a date time column
(same format ).
What I would like to do is a subset of all the rows from the second
dataframe that occurred in day time only so between sunrise
2004 Jun 21
2
sunrise, sunset calculation
Are there any functions available to calculate sunrise and sunset times
for given latitude,longitude and dates?
If not, I'll appreciatte any pointers to C code I could use/port.
Thanks,
Angel
2008 Nov 09
1
maptools sunrise sunset function
##This is a function that I am trying to write to calculate sunrise
and sunset and works "mostly", but returns nonsensical values. What
am I #missing? Thanks in advance.
###remember to include maptools as dependence###
library(maptools)
sunrise.set <- function(lat, long, date, timezone="UTC", num.days=1){
#this needs to be long lat#
lat.long <- matrix(c(long, lat),
2013 Jun 10
1
modify and append new rows to a data.frame using ddply
Hi,
I have a data.frame that contains a variable act which records the duration (in seconds) of two states (wet-dry) for several individuals (identified by Ring) over a period of time. Since I want to work with daytime (i.e. from sunrise till sunset) and night time (i.e. from sunset till next sunrise), I have to split act from time[i] till sunset and from sunset until time[i+1], and from time[k]
2009 Jan 19
1
maptools, sunriset, POSIX timezones
Hi ...
I wonder if anyone can provide some insight into why the first three
examples using the sunriset function (appended below, with results) give
the correct answer, but the fourth generates and error.
The first two use ISOdatetime with and without a time zone attribute,
and the sunriset function returns the correct sunset time.
The third and fourth adds 10 seconds to the ISOdatetime
2012 Nov 03
1
Violin plot of categorical/binned data
Hi,
I'm trying to create a plot showing the density distribution of some
shipping data. I like the look of violin plots, but my data is not
continuous but rather binned and I want to make sure its binned nature (not
smooth) is apparent in the final plot. So for example, I have the number of
individuals per vessel, but rather than having the actual number of
individuals I have data in the
2012 Oct 23
4
daylight
hi there,
does anyone know how to calculate the amount of daylight on every day of the
year in R? I mean the time between sunrise and sunset.
thanks
--
View this message in context: http://r.789695.n4.nabble.com/daylight-tp4647213.html
Sent from the R help mailing list archive at Nabble.com.
2008 Nov 10
1
TimeZone Help - Finding TimeZone codes
I have looked at
?as.POSIXct
?POSIXct
and many of the references that are on those pages.
I am bewildered with timezones. Is there a way to get what would go
into tz="" for making a function that uses POSIXct to be able to be
used in all of the timezones in just the united states? This is for
both windows and mac...
this is the function that I am wanting to use it with
2010 Aug 20
3
rollmean help (or similar function)
I am working on a simple pilot project comparing the capability of SQL,
SAS and R to perform a rolling mean per the following instructions. I
have completed the SQL and SAS analysis, so now it's R's turn.
Calculate mean values of x (x=count) for each date in the dataset where
mean = the average count of days [t-9] through day [t-3] for each
date/illness combination.
Dataset aggpilot
2010 Mar 04
1
extracting values conditonal on other values
Dear R helpers,
I have a dataframe (test1) containing the time of sunrise and sunset for each day of the year
for 3 years. I have another dataframe (test2) containing measurements that are taken every
15 minutes, 24/7. I would like to extract all rows from test2 that occur between sunrise and
sunset for the appropriate date. Can you suggest a good vectorized way to do this? Keep in
mind
2009 Nov 03
10
programación básica
Necesito algo de programación básica para resolver un problema, un
inconveniente es que intente "if", cuándo se lo aplico digamos a x <-
5 no hay drama, pero si es a leche$litros me dice que solo se toma el
primer elemento. Como pueden ver estoy re perdido.
Mi problema: los datos están en un data.frame como el siguiente
animal inicio fin control idlactancias
2021 Jan 21
3
RHEL changes
On 1/21/21 8:53 PM, Alfredo Perez wrote:
> Is this good news for the "Centos" family?
>
There is no CentOS "family". CentOS clone is dead and will be now
replaced with no-cost RHEL, so in market share (over time) CentOS will
be replaced with RHEL.
CentOS Stream will be used solely by developers and and entities like
Facebook (as a base for their own in house solution).
2008 Jul 15
2
POSIXct extract time
RM215.sp <- SpatialPoints(RM215, proj4string=CRS("+proj=longlat
+datum=WGS84"))
d060101 <- as.POSIXct("2006-01-01", tz="EST")
study_seq <- seq(from=d060101, length.out=761, by="days")
up.215 <- sunriset(RM215.sp, study_seq, direction="sunrise",
POSIXct.out=TRUE)
down.215 <- sunriset(RM215.sp, study_seq, direction="sunset",
2010 Feb 11
2
Find each time a value changes
Dear List,
I am trying to find each time a value changes in a dataset. The numbers are variables for day vs. night values, so what I am really getting is the daily sunrise and sunset.
A simplified example is the following:
x<-seq(1:100)
y1<-rep(1,10)
y2<-rep(2,10)
y<-c(y1,y2,y1,y1,y1,y2,y1,y2,y1,y2)
xy<-cbind(x,y)
I would like to know each time the numbers change.
Correct
2012 Apr 30
1
Subtract days to dates in POSIXct format
Hello,
I'm having problems working with date values in POSIXct format. Here is what I got (eg.lig attached):
x <- read.table("eg.txt", sep = ',', col.names=c("ok","time","secs","lig")) # it gives time as factor
z <- cbind(x,colsplit(x$time, split="\\s", names=c("date", "clock")))
2008 Jul 15
1
sunrise sunset calculations
Does anyone know if there is a sunrise sunset calculator for R?
--
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.
-K. Mullis
[[alternative HTML version deleted]]