similar to: Replacing NA values in one column of a data.frame

Displaying 20 results from an estimated 9000 matches similar to: "Replacing NA values in one column of a data.frame"

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
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 14
4
Assigning values based on a separate reference (lookup) table
Dear R Users, I have a data frame of 360 rows by 720 columns (259200 values). For each value in this grid I am hoping to apply an equation to, to generate a new grid. One of the parts of the equation (called 'p') relies on reading from a separate reference table. This is Table 4 at: http://www.fao.org/docrep/s2022e/s2022e07.htm#3.1.3%20blaney%20criddle%20method (scroll down a little).
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
2005 Apr 13
1
How to plot Contour with NA in dataframe
Dear friends, I am trying to produce Contour Plot with R, but there are some NA in my data matrix. After I ran the following R script, I got the error message:"no proper `z' matrix specified". Does anybody know how to plot contour chart with R for the non-strict matrix? Thank you in advance!!!
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
2015 Aug 05
1
Samba4 not able to write to group writeable folder???
Hi... With samba4 I sometimes feel like a bloody beginner even I use samba since ages. Miracle of the day: Users connecting using samba4 cannot write to group writeable folders even they should be able to. I upgraded one 3.6 fileserver to 4.2.3. PDC is always a samba 4.2.3 instance. I am using samba4 in classic PDC mode for a couple of reasons. On my fileserver I have a folder called
2010 Aug 13
1
Bug in t.test?
Hello all, due to unexplained differences between statistical results from collaborators and our lab that arose in the same large proteomics dataset we reevaluated the t.test() function. Here, we found a weird behaviour that is also reproducible in the following small test dataset: Suppose, we have two vectors with numbers and some missing values that refer to the same individuals and that
2012 Mar 20
2
Reshaping data from long to wide without a "timevar"
Hello All, I was wondering if it's possible to reshape data from long to wide in R without using a "timevar". I've pasted some sample data below along with some code. The data are sorted by Subject and Drug. I want to transpose the Drug variable into multiple columns in alphabetical order. My data have a variable called "RowNo" that functions almost like a
2005 Apr 22
1
Need help arranging the plot in different fashion than the default format
I want to change the way the plot is appearing in the barchart .. testdata <-
2003 Sep 23
2
confusion about what to expect?
In playing around with data.frames (and wanting a simple, cheap way to use the variable and case names in plots; but I've solved that with some hacks, yech), I noticed the following behavior with subsetting. testdata <- data.frame(matrix(1:20,nrow=4,ncol=5)) names(testdata) ## expect labels, get them names(testdata[2,]) ## expect labels, get them names(testdata[,2]) ## expect labels, but
2005 Apr 25
1
Need help with panel.segment..
Hi All, For the following code, I'm not sure why the error bars are appearing horizontal. Can someone please tell me how to fix the problem. testdata <-
2007 Sep 20
1
Bug with Cor(..., method='spearman") and by() (PR#9921)
I posted this on R help, and a few others responded indicating they too were able to replicate the error as a function of missing data. I believe this should not be the case and hence and reporting it here. ### Code provided on R-Help by Ivar Herfindal # Simulate data testdata <- cbind.data.frame(gr=3Drep(letters[1:4], each=3D5), = aa=3Drnorm(20), bb=3Drnorm(20)) # Introduce some missingness
2005 May 05
6
Need some quick help with lattice - barchart
For the following code below, the x-axis ticks are 1,2,3,4,5,6,7 when I was expection them to be 1,2,8,9,10,11,12. Please help me figure out where is the mistake. library(lattice) testdata <- as.data.frame(t(structure(c( 1,2005,9.24,6.18,634, 2,2005,8.65,6.05,96, 8,2004,6.81,6.51,16, 9,2004,9.0,7.29,8, 10,2004,8.84,6.18,524, 11,2004,8.54,6.35,579, 12,2004,9.97,6.3,614, 12,2005,8.75,5.84,32,
2007 May 13
2
extracting text contained in brackets ("[ ... ]") from a character string?
I have a text string that contains text within two brackets. e.g. "testdata[3]" "testdata[-4]", "testdata[-4g]", I wish to "extract" the string enclosed in brackets? What is a good way to do this? e.g. fun(testdata[3]) = '3' fun(testdata[-4g]) = '-4g' --------------------------------- Moody friends. Drama queens. Your life?
2010 Mar 12
1
Length as fun.aggregate in cast function of reshape package: unexpected error
Dear Everyone, I am having problems with use of the reshape package's cast function using length as an aggregating function. Unexpectedly, I receive the error: 2 arguments passed to 'length' which requires 1 I don't understand this at all - the data I'm using is very simple, and appears almost identical to that used in the ChickWeight example in the package. The problem can
2012 Mar 30
3
Adding text for written comments to bottom of graphs
Hello All, Recently developed the code below for graphing patterns of chemotherapy administration. As someone just starting to use R in their work, I managed to figure out some parts of the code but needed help with others. setwd("N:/Regimen Coding/0906/Plots Test") getwd() TestData <- structure(list(profile_key = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3), line = c(1, 1,
2005 Apr 21
3
Need help with R date handling and barchart with errorbars
Hi All.. Have a question.. For the following r code testdata <- as.data.frame(t(structure(c( "1/1/04","LV1",3.8,2,87, "2/1/04","LV1",3.2,3,28, "3/1/04","LV1",3.4,3,88, "4/1/04","LV1",3,2,26, "5/1/04","LV1",3.8,2,87, "6/1/04","LV1",3.2,3,28,