search for: smurray444

Displaying 20 results from an estimated 67 matches for "smurray444".

2010 Sep 09
3
Alignment of lines within barplot bars
Dear all, I have a barplot upon which I hope to superimpose horizontal lines extending across the width of each bar. I am able to partly achieve this through the following set of commands: positions <- barplot(bar_values, col="grey") par(new=TRUE) plot(positions, horiz_values, col="red", pch="_", ylim=c(min(bar_values), max(bar_values))) ...however this results
2008 Sep 05
2
Use of colour in plots
Dear all, I have 3 datasets all of which share the same longitude and latitude values, which I'm looking to plot onto a scattergraph. The third dataset has values which can only be either '1' or '2'. So to incorporate all three datasets onto two axes, I'm wondering if I can plot dataset1 and dataset2 as normal, but then use colour to determine whether these points are
2009 Aug 17
3
Replacing NA values in one column of a data.frame
Dear all, I'm trying to replace NA values with -9999 in one column of a data frame. I've tried using is.na and the testdata[testdata$onecolumn==NA] <- 9999 approach, but whilst neither generate errors, neither result in -9999s appearing - the NAs remain there! I'd be grateful for any advice on what I'm doing wrong or any other suitable approaches. Many thanks, Steve
2009 May 04
4
Producing a legend successfullly
Dear all, I'm attempting to insert a legend into a line graph. I've sorted out the positioning, but I'm unable to display the sample line and associated colour to go within the legend box. Instead, under the variable names, the numbers 1, 2, 2, 3 are displayed in a column (with '2' repeated twice). This is the code I'm using: legend(80,1150, c("Simulation",
2009 May 18
8
Simple plotting errors
Dear R Users, I have 12 data frames, each of 12 rows and 2 columns. e.g. FeketeJAN MEAN SUM_ AMAZON 144.4997874 68348.4 NILE 5.4701955 1394.9 CONGO 71.3670036 21196.0 MISSISSIPPI 18.9273250 6511.0 AMUR 1.8426874 466.2 PARANA 58.3835497 13486.6 YENISEI 1.4668313 592.6 OB 1.4239179 559.6 LENA 0.9342164
2010 Feb 09
2
Resampling a grid to coarsen its resolution
Dear all, I have a grid (data frame) dataset at 0.5 x 0.5 degrees spatial resolution (720 columns x 360 rows; regular spacing) and wish to coarsen this to a resolution of 2.5 x 2.5 degrees. A simple calculation which takes the mean of a block of points to form the regridded values would do the trick. Values which should be excluded from the calculation are -9999 (unless all points within a block
2008 Sep 07
3
Averaging 'blocks' of data
Dear all, I have a large dataset which I hope to reduce in size, to make it more useable. I hope to do this by taking an average of each 60 x 60 blockof values and forming a new data frame out of the averaged values. How would I go about taking averages of 60 x 60 'blocks' in R, and cycling through the whole dataset, recording each calculated value in a new table/data frame? Many thanks
2009 Oct 09
4
Trendline for a subset of data
Dear all, I am using abline(lm ...) to insert a linear trendline through a portion of my data (e.g. dataset[,36:45]). However, I am finding that whilst the trendline is correctly displayed and representative of the data portion I've chosen, the line continues to run beyond this data segment and continues until it intersects the vertical axes at each side of the plot. How do I display the
2010 Jan 25
4
R Output and ArcGIS
Dear all, I've been using R on a Mac to process some data for export to ArcMap GIS (which only runs on Windows). ArcMap seems to require tab-delimited data (my data are in 3 columns), so I've been using the sep="\t" argument. However, this resulted in strange end-of-line characters when displayed on a PC. I looked in the write.table help file to find that eol="\r\n"
2009 Aug 17
3
Reshape package: Casting data to form a grid
Dear R Users, I'm trying to use the 'cast' function in the 'reshape' package to convert column-format data to gridded-format data. A sample of my dataset is as follows: head(finalframe) Latitude Longitude Temperature OrigLat p-value Blaney 1 -90 -38.75 NA -87.75 17.10167 NA 2 -90 135.75 NA -87.75 17.10167 NA 3 -90 80.25
2009 Mar 25
4
Manual sort in a for loop
Dear all, I am trying to manually re-sort rows in a number of tables. The rows aren't sorted on any particular values but are simply ordered by user choice (as shown by the row numbers in the code). I have been able to carry out each re-arrangement without the use of the 'for' loop, but cannot seem to successfully execute the statements when incorporated into the loop. The code I have
2010 Feb 01
1
Isolating a column within a loop
Dear all, I am trying to calculate the mean of one column for many data frames. The code I am using is as follows: > for (i in seq(nrow(index))) { ??? ??? assign(paste(model, "_mean_",index$year[i], index$month[i], sep=''), ????????????? mean(get(paste(model, index$year[i], index$month[i], "[,3]", sep='')))) ???????? } Error in get(paste(model,
2009 Mar 26
1
Column name assignment problem
Dear all, I'm trying to assign a name to the fourth column whilst using 'assign', but keep encountering errors. What have I done wrong?! > assign(colnames(c(paste("arunoff_",table_year, sep="")[4]), "COUNT")) Error in if (do.NULL) NULL else if (nc> 0) paste(prefix, seq_len(nc), : argument is not interpretable as logical Hope someone is able
2009 Mar 31
1
Reshape: 'melt' numerous objects
Dear R Users, I'm trying to use the reshape package to 'melt' my gridded data into column format. I've done this before on individual files, but this time I'm trying to do it on a directory of files (with variable file names) - therefore I have to also use the 'assign' command. I have come up against a couple of problems however and am therefore seeking advice... >
2009 Apr 28
1
Finding rows common to two datasets
Dear all, I have 2 data frames, both with 14 columns of data and differing numbers of rows. The first two columns are 'Latitude' and 'Longitude'. I want to find the pairs of Latitude and Longitude coordinates which are common to both datasets, and output a new data frame which is composed of these coincident rows. I tried using the 'unique' command, but had difficulties
2008 Aug 02
2
Iterative Averages
Dear all, I have a data frame of 2160 rows and 4320 columns, which I hope to condense to a smaller dataset by finding averages of 6 by 6 blocks of values (to produce a data frame of 360 rows by 720 columns). How would I go about finding the mean of a 6 x 6 block, then find the mean of the next adjacent 6 x 6 block, and so on, until the whole data frame has been covered? One slight twist is that
2008 Sep 04
1
Plotting using 'if' statements
Dear all, I have a dataset of four columns, and I wish to plot (as a scatter graph) the values of the third column where the values are greater than zero, and the fourth column. I tried doing this via the plot command itself, but got into a bit of a mess (resulting in errors!). My dataframe is called 'January': > plot(January[3(>0):4]) Error: unexpected '>' in
2008 Jul 26
1
Coarsening the Resolution of a Dataset
Dear all, I have gridded data at 5' (minutes) resolution, which I intend to coarsen to 0.5 degrees. How would I go about doing this in R? I've had a search online and haven't found anything obvious, so any help would be gratefully received. I'm assuming that there will be several 'coarsening' techniques available - I'm after something fairly simple, which for example,
2009 May 01
1
Problems with 'valid columns' when using merge
Dear all, I am trying to use 'merge' within a loop, however, I receive an error relating to the 'by' argument of the command, as follows: > merge_year <- 1986 > > for (i in 1:10) { # Number of file pairs + assign(paste("merged_arunfek_", merge_year, sep=""), merge(x=paste("arunoff_",start_arunoff, sep=""),
2009 Apr 30
1
Using 'aggregate' when dependent on row value increments
Dear all, I have a data frame of three columns, which I have sorted by Latitude as follows: > test2[60:80,] Latitude Longitude Sim_1986 61948 85.25 -29.25 2.175345 61957 85.25 -28.75 8.750486 61967 85.25 -28.25 33.569305 61977 85.25 -27.75 23.702572 61988 85.25 -27.25 26.488602 62000 85.25 -26.75 23.915724 62012 85.25 -26.25 25.055082 62027