Displaying 20 results from an estimated 1000 matches similar to: "data frame row statistics (mean)?"
2010 Jun 23
2
Unique Data Frame Name?
Hello,
I am trying to create a data frame with a unique name, based on indexing
of for loop. I was wondering if there is a way to do this, I keep
running into errors when I try to do this. Below is a brief example, I
am trying to get two data frames (name1 and name2).
Any suggestions are appreciated.
Thanks,
Doug
# Example
for (i in 1:2) {
x=c(1,2,3,4)
y=c(10,20,30,40)
2008 Oct 30
3
Save a function existing library
Hello all,
I am fairly new to R and I have created a function that I use quit
frequently. I was wondering if there is away to save this function in
an existing library so I can call it by using the function name once the
library is loaded?
Thanks,
Doug
--
---------------------------------
Douglas M. Hultstrand, MS
Senior Hydrometeorologist
Metstat, Inc. Windsor, Colorado
voice:
2010 Jun 14
1
Times series data file?
Hello,
I currently splitting a file into individual files (time series each
separated into one file), the file I read in skips the first four lines
and extracts the data columns I need. I was wondering if there is a way
for R to automatically scan and separate the files based on the head
information?
The header delineates the observation with a 254 space time space day
space month space
2010 Feb 04
3
Legend symbol?
Hello,
I am creating a plot/image using different data and a couple fit lines
(see attached image). In the legend, I want the Default and Exponential
symbol to be a line. I am using the pch command, I tried to use "-" to
represent a line but does not work so I currently have set as a "1".
Any thoughts or suggestions would be greatly appreciated.
Below are the commands
2010 Jan 05
3
R matching lat/lon pairs from two datasets?
Hello,
I am trying to match lat/lon from one dataset with the lat/lon from a
second dataset and use that rows data for calculations. I am using
match, but this is finding the first match and not comparing the pair,
how can I determine if the lat/lon are the same? See example below. Is
there a better way to determine to a matching pair of lat/lon values?
Example Datasets:
> data2
2009 Dec 01
3
paste name in for loop?
Hello,
I am trying to create subsets of grouped data (by area size), and use
the area size as part of the output name. The code below works for area
(xout) 1 and 50, the other files are given NA for an area.
A simple example:
xout <- c(1,5,10,25,50,100)
for(i in xout) { print(paste("Areal_Ppt_",xout[i],"sqmi.txt", sep="")) }
[1] "Areal_Ppt_1sqmi.txt"
2009 Oct 15
2
Data frame search and remove questions
Hello,
I have a couple questions about removing rows from a data frame and
creating a new data frame with the removed values. I provided an
example data frame (d) below.
Questions:
1) How can I search for "-999.000" and remove the entire row from data
frame "d"? (all -999 values will be in sd_diff)
2) Can I create a new data frame "d.new" that only contains the
2010 Jan 20
2
Plot frame border to start at zero?
Hello,
I am creating plots of hourly precipitation and accumulated
precipitation (on different axis, see attached image). I was wondering
how can I have the plot frame (black border) start at zero, it looks
like it is plotted less than zero?
The code I use to create the png files is below:
CairoPNG(PNG_file,width=1000, height=600, pointsize=14, bg="white")
opar <-
2008 May 20
3
R for loop question
Hello,
I am trying to assign a variable name (x1,x2,x3...) in a loop statement
that is based on a counter (counter is based on the number of hours
within the datafile). The x1,x2 data will later be called for plotting
the data. Below is a clip of the for loop I am using, any suggestions?
k = 1
for (i in 1:length(stats$hour)) {
"x(i)" = dataset[k,(3:15)]
k = k+1
}
Thanks,
2009 Oct 22
1
Cairo package, png files within for loop are black?
Hello,
I am generating .png images using the Cairo package in a for loop
(looping on the number of zones, number of zones equals the number of
plots to create based on different zone data). When I run the R
script the .png files are created but they are all black? If I comment
out the for loop and force my zones to equal one the png file is created
correctly? Is there an issue with
2009 Nov 13
2
data frame subsets?
Hello,
I am trying to create data frame subsets based on binned temperature
data. I have code working to create the bins (d.1 and d.2), but it
takes two steps, I was wondering if I could merge into one step. See Below
d
n year mo da hr t td tw rh kPa
1 1 1945 3 1 0 1.1 0.0 0.6 92 101.7
2 2 1945 3 1 1 2.8 -1.1 1.1 76 101.8
3 3 1945 3 1 2 2.2 -1.7 0.6 75 101.9
4 4
2009 Sep 01
1
Read multiple files into dataframe?
Hello,
I am fairly new to R programming and am stuck with the following problem.
I am trying to read in multiple files (see attached file or at end of
email), the files all have the same general header information and
different precipitation (avgppt) and area (areasqmi) values. Some times
the number of records are different in the files.
I want to read in all files (.stdsummary), and create
2009 Mar 24
3
Display Equation on plot
Hello,
I am using the lm to fit a linear model to data, I was wondering if
there is a way to display the equation on a plot using the extracted lm
coefficients? I am using the plot() function to create the plot/.png.
Example:
lm_mod <- lm(data1~data2)
intercept = 48.54
slope = 0.4856
I want to display equation on a plot as y=0.4856x+48.54
Any thoughts or suggestions are appreciated.
2013 Jan 29
2
Netcdf and Raster Package Questions, Need .asc File for GIS
Hello R-Group,
I am new working with netcdf files and the raster package in R.I am
trying to read in a netcdf file using the package "ncdf".I am able to
get the lat, lon and parameter I need and can plot using
fill.contour.Ultimately, I am trying to create a .asc file to reafd into
GIS.I am using the package "raster" to read the parameter.When I read in
with
2012 May 15
1
Error in eval(expr, envir, enclos) : object 'Rayos' not found???
Hi R-listers,
I am trying to make a trellis boxplot with the HSuccess (y-axis) in each
Rayos (beach sections) (x-axis), for each Aeventexhumed (A, B, C) - nesting
event. I am not able to do so and keep receiving:
Error in eval(expr, envir, enclos) : object 'Rayos' not found
Please advise,
Jean
require(plyr)
resp <- read.csv("ABC Arribada R File Dec 12 Jean
2012 May 21
1
select part of files from a list.files
Hi everyone.
I'm working on a list of files (about 50 files). I've listed them thanks to
the function: list.files.
Each of my files contains 35000 lines of data. These files may also contain
some missing values NA (sometimes till 10 000 NAs following each other).
The aim is to do some correlation matrices between these files (I already
have the script). But as I have often missing values,
2012 May 02
2
Problem with 'nls' fitting logistic model (5PL)
Dear R-Helpers,
I'm working with immunoassay data and 5PL logistic model. I wanted to
experiment with different forms of weighting and parameter selection,
which is not possible in instrument software, so I turned to R.
I am using R 2.14.2 under Win7 64bit, and the 'nls' library to fit the
model - I started with the same model and weighting type (1/y) as in the
instrument to see
2009 Oct 27
1
New vector based on if/else statement within for loop?
Hello,
I am trying to create a new vector (w) that is based on comparing two
vectors (P and Z). The compaison is simple (I created a for loop that
reassigns w based on if statement), all Z values >= 24 and P values <=1,
w=88 else w=77. I am not getting the correct results for w, see
example code below. Any thoughts or suggestions on the correct method.
Thank you,
Doug
P <-
2009 Nov 16
1
lmomco package and confidence limits?
Hello,
I am using the lmomco package (lmom.ub and pargev) to compute the GEV
parameters (location, scale, and shape), which are used to estimate
return values. I was wondering how/if I can calculate upper and lower
confidence (CI_u, CI_l) intervals for each return frequency using the
GEV parameters to fill-in the table below?
Xi (location) = 35.396
Alpha (scale) = 1.726
Kappa (shape) =
2012 May 12
1
masked by GlobalEnv ???
Hi R Listers,
I am trying to upload a data file and I received this message. It seems that
I am still able to make graphs and Aeventexhumed still works in the
analysis. Can I ignore this message or do I need to do something about this?
Jean
> require(plyr)
Loading required package: plyr
> turtlehatch <- read.csv(file.choose())
> attach(turtlehatch)
The following object(s) are