Displaying 20 results from an estimated 2000 matches similar to: "summarizing daily time-series date by month"
2005 Jan 25
1
chron: parsing dates into a data frame using a forloop
I have one data frame with a column of dates and I want to fill another data
frame with one column of dates, one of years, one of months, one of a unique
combination of year and month, and one of days, but R seems to have some
problems with this. My initial data frame looks like this (ignore the NAs in
the other fields):
> mans[1:10,]
date loc snow.new prcp tmin snow.dep tmax
1
2005 Jan 31
2
coercing a list to a data frame, lists in foreloops
I have a set of time-series climate data with missing entries. I need to add
rows for these missing entries to this data set. The only way I know to do
this is unsing a foreloop, but this won't work on a list. I've tried to
convert the list to a data frame, but that won't happen, either.
I want to fill rows in this table:
> newtest[10:15,]
yrmos yearmo snow.sum snow.mean
2009 Oct 06
2
[LLVMdev] What opt pass attempts implements this optimization?
I have a very simple kernel that is generating very very bad code.
The basic kernel pseudo-code is as follows:
forloop(1 to n) {
forloop(0 to j) {
A
}
B
}
C
It is generating very ugly and inefficient code for a vector system
similar to the following pseudo-code:
if (n > 1) {
if (j) {
forloop(1 to n) {
forloop(0 to j) {
2009 Aug 25
2
allowing line wrap for long strip text in xyplot (lattice)
Hi. Am brand new to R and to mailing lists - have never posted anywhere
before, so hope I do this right.
Am using R 2.9.1 with lattice graphics (just installed, fully up to date).
Am doing trellis xyplot with y (emp=employment), x (yearmo=a time measure)
and conditioning variable (indf - factor describing industry) -- i.e., (emp
~ yearmo | indf), where all three variables are in a dataframe. The
2009 Oct 07
0
[LLVMdev] What opt pass attempts implements this optimization?
On Oct 6, 2009, at 4:28 PM, Villmow, Micah wrote:
> I have a very simple kernel that is generating very very bad code.
>
> The basic kernel pseudo-code is as follows:
> forloop(1 to n) {
> forloop(0 to j) {
> A
> }
> B
> }
> C
>
> It is generating very ugly and inefficient code for a vector system
> similar to the following pseudo-code:
> if (n >
2000 Nov 21
1
How do you construct a function from a list?
I'm trying to get a data.restore function to work on functions. One
thing I can't figure out: how do you construct a function from it's
component parts?
For example, I can construct a for loop as
forloop <-
as.call(list(as.name('for'),as.name('i'),1,as.call(list(as.name('junk')))))
which results in
for (i in 1) junk()
But how do I put that in a
2010 Oct 11
2
filled.contour: colour key decoupled from main plot?
Dear R colleagues,
I am trying to plot some geophysical data as a filled contour on a continent map and so far the guidance from the R-help archives has been invaluable. The only bit that still eludes me is the colour key (legend) coming with filled.contour:
I prefer to generate my own colour palette, mainly based on the quantiles of tenths of the data in order to capture the whole range (of
2004 Nov 22
2
variable object naming
Is it possible to give a temporary object a name that varies with each run of a
foreloop? For example, I want to fill a matrix every time I run a loop, and I
want a new matrix with each run, with an appropriate new name.
i.e.:
for(i in 1:5){... matrix.i<-some values ...}
so that in the end I would have:
matrix.1
matrix.2
matrix.3
matrix.4
matrix.5
Thanks,
Ben Osborne
--
Botany Department
2005 Mar 01
1
na.strings in readLines or is.na?
When reading a data set into R using readLines, na.strings="-99.99" is ignored.
Is there an equivalent command for readLines? Alternatively, either
immediately after reading into R or once the data set has been converted to a
data frame, what is the appropriate command (or appropriate use of is.na) to
convert my -99.99s to NAs?
Thanks,
Ben Osborne
--
Botany Department
University of
2005 Feb 16
5
scaling axes when plotting multiple data sets
1) When adding additional data sets to a plot using "plot" followed by "lines",
is there a way to automate the scaling of the axes to allow for all data sets
to fit within the plot area?
2) I attempted to solve this by setting
xlim=c(min(c(data1,data2,data3)),max(c(data1,data2,data3)))
however, there are some NAs and Infs in these data sets, and min(data1) and
max(data1) both
2009 Jan 03
2
R badly lags matlab on performance?
Here's a small R program:
---------------------------------------------------------------------------
a <- rep(1,10000000)
system.time(a <- a + 1)
system.time(for (i in 1:10000000) {a[i] <- a[i] + 1})
---------------------------------------------------------------------------
and here's its matlab version:
2004 Dec 04
1
AIC, AICc, and K
How can I extract K (number of parameters) from an AIC calculation, both to
report K itself and to calculate AICc? I'm aware of the conversion from AIC ->
AICc, where AICc = AIC + 2K(K+1)/(n-K-1), but not sure of how K is calculated
or how to extract that value from either an AIC or logLik calculation.
This is probably more of a basic statistics question than an R question, but I
thank
2005 Apr 18
1
R-squared in summary(lm...)
What is the difference between the two R-squareds returned for a linear
regression by summary(lm...)? When might one report multiple vs. adjusted
R-squared?
Thank you,
Ben Osborne
--
Botany Department
University of Vermont
109 Carrigan Drive
Burlington, VT 05405
benjamin.osborne at uvm.edu
phone: 802-656-0297
fax: 802-656-0440
2004 Oct 09
1
functions
Does anyone know of a list of functions that R already "knows?" I can't seem to
find this anywhere in the help documentation. For example, I want to count the
number of occurences of a certain value in a column of a data frame: What do I
have to do to tell R to "Count?"
Thanks,
Ben Osborne
--
Botany Department
University of Vermont
109 Carrigan Drive
Burlington, VT 05405
2004 Dec 13
1
AIC, glm, lognormal distribution
I'm attempting to do model selection with AIC, using a glm and a lognormal
distribution, but:
fit1<-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian(link="log"))
## gives the same result as either of the following:
fit1<-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian)
fit1<-lm(BA~Year,data=pdat.sp1.65.04)
fit1
#Coefficients:
#(Intercept) Year2004
# -1.6341
2012 Mar 19
3
Issue with asin()
Hello everyone,
I am working for a few days already on a basic algorithm, very common in
applied agronomy, that aims to determine the degree-days necessary for a
given individual to reach a given growth stade. The algorithm (and context)
is explained here: http://www.oardc.ohio-state.edu/gdd/glossary.htm , and
so I implemented my function in R as follows:
DD <- function(Tmin, Tmax, Tseuil,
2007 Oct 25
0
Error message from nlmer
Hi,
I have R 2.6.0 with updated lme4 and Matrix packages, and I am trying to
fit a nonlinear multilevel model. I get the following error message:
Error in nlmer(f ~ grModel(x, w, Tmin, Tmax, Topt, kopt, m) ~ kopt |
flat, :
gradient attribute of evaluated model must be a numeric matrix
and I wonder what this may indicate.
The nonlinear model I try to fit is as follows:
> grModel
2011 Jun 17
0
Inconsistent results from var.get.nc in RNetCDF
Hello -
I am having trouble extracting data from NetCDF data files using
RNetCDF. The data files each have 3 dimensions (longitude, latitude,
and a date) and 3 variables (latitude, longitude, and a climate
variable).
Here is some of the output from print.nc for clarity:
-----
dimensions:
month = UNLIMITED ; // (1368 currently)
lat = 3105 ;
lon = 7025 ;
variables:
float
2016 Apr 20
1
Use multiple cores on Linux
I am trying to run the following code in R on a Linux cluster. I would like
to use the full processing power (specifying cores/nodes/memory). The code
essentially runs predictions based on a GAM regression and saves the
results as a CSV file for multiple sets of data (here I only show two).
Is it possible to run this code using HPC packages such as
Rmpi/snow/doParallel? Thank you!
2000 Nov 22
0
How do you construct a function from a list? (PR#743)
On Wed, 22 Nov 2000 13:08:26 +0100, Kurt Hornik wrote:
.
>>>>> Duncan Murdoch writes:
>> I'm trying to get a data.restore function to work on functions. One
>> thing I can't figure out: how do you construct a function from it's
>> component parts?
...
>> forloop <-
>>