Displaying 20 results from an estimated 300 matches similar to: "Problems with a specific calculate."
2010 May 18
2
Function that is giving me a headache- any help appreciated (automatic read )
note: whole function is below- I am sure I am doing something silly.
when I use it like USGS(input="precipitation") it is choking on the
precip.1 <- subset(DF, precipitation!="NA")
b <- ddply(precip.1$precipitation, .(precip.1$gauge_name), cumsum)
DF.precip <- precip.1
DF.precip$precipitation <- b$.data
part, but runs fine outside of the function:
days=7
2011 Feb 17
3
summing 15 minute precip data to daily
Hi all,
i'm sure there is an easy way to do this, but i'm stumped, so any help would
be appreciated.
i have a single column of data for precipitation every 15 minutes over a
year. i want to sum the precip to daily data.
so the first 96 records = the first day, the second 96 records = the second
day, and so on....
is there a way to write a for loop that would sum the data to daily, and
2012 Oct 04
3
R combining vectors into a data frame but without a continuous common variable
Hello,
I have two different files which I'd like to combine to make one data frame
but I've no idea how to do it! The first file has two columns; one is the
date, the following is a binary code for debris flow events. Then my other
file has also two columns; the date and then precipitation data.
The thing is, is that the two date columns don't all contain the same dates.
The binary
2011 Mar 13
4
readMat - how to retrieve the variables
Hello
I have a matlab MAT file that contains one single variable: a. The
structure of a is as follows:
a.river1.flow (flow values)
a.river1.date_flow (date)
a.river1.precip (precipitation values)
a.river1.date_precip
a.river2.flow
a.river2.date_flow
a.river2.precip
a.river2.date_precip
I have used readMat to load the variable a in R, however I have no idea how
readMat translates a. I managed
2013 Apr 18
1
Arranging two different types of ggplot2 plots with axes lined up
Hi all,
I want to arrange two ggplot2 plots on the same page with their x-axes
lined up - even though one is a boxplot and the other is a line plot. Is
there a simple way to do this? I know I could do this using facetting if
they were both the same type of plot (for example, if they were both
boxplots), but I haven't been able to figure it out for two different types
of plots.
Below is my
2007 Sep 10
1
overlay lattice histograms with goodness-of-fit pdfs
Hello,
I am new to R exploratory data analysis and plotting. Is anyone aware of a way
to overlay a set of conditional histograms with conditional PDFs? Below, I
generate a lattice plot of precipitation histograms based on different months
and stations, given a subset of the dataset:
histogram(~ data | month * station,
data = sta.stack[sta.stack[,"type"]=="precip" &
2006 May 18
2
matrix transformation into 3 columns II.
Dear R-users
Sorry for posting the previous message too soon before I have finished it.
I have matrix (mprecip) with headers:
> dim(mprecip)
[1] 6268 170
> mprecip
date GilzeRijen Eindhoven Volkel ZuidLimburg Arcen Ubachsberg
1 01/01/1978 NA 0.0 NA 0.1 NA NA
2 01/02/1978 NA 0.0 NA 0.0 NA NA
3
2018 Apr 18
3
How to replace numeric value in the column contains Text (Factor)?
Hi R user,
Would you mind to help me on how I can change a value in a specific column
and row in a big table? but the column of the table is a factor (not
numeric).
Here is an example. I want to change dat[4:5,3]<-"20" but it generated NA>
do you have any suggestions for me?
dat<-structure(list(Sites = structure(1:5, .Label = c("Site1", "Site2",
2008 Sep 04
2
using complete.cases() with nested factors
Hello,
This maybe a newbie question. I have a dataframe that looks like the sample
at the bottom of the email. I have monthly precipitation data from several
sites over several years. For each site, I need to extract years that have
a complete series of 12 monthly precipitation values, while excluding that
year for sites with incomplete data. I can't figure out how to do this
gracefully
2018 Apr 18
0
How to replace numeric value in the column contains Text (Factor)?
The simplest would be to convert precip to character and then back to a factor if you really want it to be a factor. This will also remove the levels that no longer exist.
str(dat)
# 'data.frame': 5 obs. of 3 variables:
# $ Sites : Factor w/ 5 levels "Site1","Site2",..: 1 2 3 4 5
# $ temp : num 14 15 12 12.5 17
# $ precip: Factor w/ 5 levels
2005 Nov 15
1
combination xyplot and barchart?
Dear R community,
I am having trouble determining how to create the graph I want
utilizing my relatively limited knowledge of R. So far I have been
using the lattice library to create most of what I need.
The dataset (enviro) consists of 2 variables (Temp and Precip) for each
Day of a 2-yr period (Year). I wish to display Temp and Precip along
the y axis plotted by Day on the x axis to allow
2006 Jan 16
1
label of second y-axis in xyplot (lattice)
Dear group,
First I provide you with an example, I found in the newsgroup. Then I'd like to explain my problem to you by means of the output.
enviro <-
data.frame(Year = rep(2001:2002, each = 365),
Day = rep(1:365, 2),
Precip = pmax(0, rnorm(365 * 2)),
Temp = 2 + 0.2 * rnorm(365 * 2))
xyplot(Precip + Temp ~ Day | Year,
2010 Apr 15
1
Alignment of x-axis labels
Dear all,
I'm having trouble getting the correct spacing between x-axis labels on a barplot. This is the command I'm using to generate the plot:
temp <- barplot(precip, beside=TRUE, xaxt="n", las=1, xpd=FALSE, col="grey28", ylim=c(0, max(precip)))
Here is the structure of temp:
> str(temp)
?num [1:96, 1] 0.7 1.9 3.1 4.3 5.5 6.7 7.9 9.1 10.3 11.5 ...
And here
2024 Nov 06
1
Using multiple dat files
"It seems therefore that there is no other way than read in individually >
100 weather tables using read.tables., right? Using file.choose() doesn't
change the work."
Yes. With that many files, file.choose() does not make sense. However, I
still do not understand what is the problem with using lapply() on the
character vector of file names with read.table() as you did in your
2010 Nov 17
3
stacking consecutive columns
I have a file, each column of which is a separate year, and each row of each column is mean precipitation for that month. Looks like this (except it goes back to 1964).
month X2000 X2001 X2002 X2003 X2004 X2005 X2006 X2007 X2008 X2009
1 1.600 1.010 4.320 2.110 0.925 3.275 3.460 0.675 1.315 2.920
2 2.960 3.905 3.230 2.380 2.720 1.880 2.430 1.380
2011 Dec 09
3
ggplot with geom_tile
Dear R-users,
I am trying to make a plot with ggplot-geom_tile(), but cannot remove some unwanted (white) lines through my plot.
Below a reproducible example:
#####
library(ggplot2)
tot=as.data.frame(rep(seq(-50,50,5),each=21))
names(tot)="precip"
temp=rep(seq(-5,5,0.5),21)
tot$temp=temp
disc=array(dim=c(21,21))
for(i in 1:21){
for(y in 1:21){
temp<-
2009 Jul 12
1
variance explained by each predictor in GAM
Hi,
I am using mgcv:gam and have developed a model with 5 smoothed predictors
and one factor.
gam1 <- gam(log.sp~ s(Spr.precip,bs="ts") + s(Win.precip,bs="ts") + s(
Spr.Tmin,bs="ts") + s(P.sum.Tmin,bs="ts") + s( Win.Tmax,bs="ts")
+factor(site),data=dat3)
The total deviance explained = 70.4%.
I would like to extract the variance explained
2005 Nov 07
2
how to export density_function output?
Dear all,
quite a naive question: I have a data frame and I computed "the kernel
density estimate" with density on each column.
Now I'd like to export in a txt file the density function output for each
column, but, when if I use write.table, I get a message "Error in
as.data.frame.default(x[[i]], optional = TRUE) : can't coerce class
"density" into a
2009 Jul 27
1
Creating new data frame using loop
Hi all,
I sent a request round last week asking for help with using a "for" loop to read and separate a large dataset. The response I got worked great, but now I have another problem with using my loop.
Basically I have a number of different files containing columned data. There are 132 datasets, named such that I have something in the form...
precip_colxxx.txt
...where xxx is a
2009 Oct 06
1
ggplot2 applying a function based on facet
Look at the bottom of the message for my question
#here is a little function that I wrote
USGS <- function(input="discharge", days=7){
library(chron)
library(gsubfn)
#021973269 is the Waynesboro Gauge on the Savannah River Proper (SRS)
#02102908 is the Flat Creek Gauge (ftbrfcms)
#02133500 is the Drowning Creek (ftbrbmcm)
#02341800 is the Upatoi Creek Near Columbus (ftbn)
#02342500 is