Displaying 20 results from an estimated 8000 matches similar to: "Adding row name to dataframe"
2010 Oct 11
2
(no subject)
Dear List,
I am trying to plot date vs. time, but am having problems getting my y-axis
labels how I want them.? When left on its own R plots time at 6 hour intervals
from 03:00 to 23:00.? I am wanting 6 hour intervals from 2:00 to 22:00.? I
realize yaxp doesn't work in plot(), so I am trying to get it to work in par().?
However, now I get the ticks where I want them but the time is output
2010 Sep 26
2
Changing x-axis on boxplot
Dear List,
?
I am creating a boxplot with two subsets, very similar to the example by Roger
Bivand at ?boxplot (reproduced below).? I am trying to change the labels on the
x-axis to have one number to cover both subsets.? I can do this in other plots
by using axis=FALSE followed by a separate axis() command.? I have also tried
variations in the names= argument but can't get it to work.?
2010 Nov 11
1
Count continuous dates
Dear List,
I have a series of dates and I am needing to know the greatest length of
continuous dates - i.e. the number of dates before a break in the series.? For
example, below there are three continuous series of dates with lengths 4, 6, and
8.? How can I count the number of continuous dates?? rle() will do it for
constant integers, but I can't figure a way to modify it for continuous
2010 Dec 12
4
legend not appearing in Word document
I need help with using graphics in Word 2007 that will later be converted into a
pdf document.? I have tried several formats and found that?I get the best
quality of graphics using .wmf, .eps format, but when I convert it to .pdf I get
a bunch of lines across the figures.? I also tried .tiff and .png but they give
me much lower quality.? The best quality that converts to pdf appears to be
2010 Jul 18
1
Reading files with varying number of columns
Dear R list,
I am trying to read files with a varying number of columns and can't figure out
how to get them in the proper format.? Some rows have five value and some have
seven.? Is there a way to read them in so that two empty columns are added to
every row that has only five values?? An example of the data follows.? Thanks!?
Tim
>46,B,00301,2004-02-03,11:59:16
2010 Oct 12
2
Memory limit problem
Dear List,
I am trying to?plot?bathymetry contours around the Hawaiian Islands using the
package rgdal and PBSmapping.? I have run into a memory limit when trying to
combine two fairly small objects using cbind().? I have increased the memory to
4GB, but am being told I can't allocate a vector of size 240 Kb.? I am running R
2.11.1 on a Dell Optiplex 760 with Windows XP.? I have pasted
2011 Oct 26
1
Using abline in lattice
Dear all,
being a relative beginner in R, I apologize for posting the second question
within two days.
So I want a stacked barchart, which should look like the one produced by
this code:
Tuvalu <- c(9,3,4,0,3,0,0)
Singapor <- c(38,0,0,0,12,19,0)
Samoa <- c(26,16,2,0,5,2,0)
PNG <- c(56,4,0,5,2,0,56)
Micronesia <- c(6,0,0,0,0,0,0)
graph4 <-
2010 May 06
2
splitting character strings and converting to numeric vectors
This seemingly should be quite simple but I can't solve it:
I have a long character vector of geographic data (data frame column named
"XY") whose elements vary in length (from 11 to 14 chars). Each element is
structured as a set of digits, then an underscore, then more digits, e.g:
> data.frame(head(as.character(XY)))
head.as.character.XY..
1 -448623_854854
2
2005 Apr 11
0
plotting Principle components vs individual variables.
Dear R,
I'm trying to plot the first principle component of an analysis vs the first
variable but am having trouble. I have no trouble doing the initial plot
but have difficulty thereafter.
First I want to highlight some points of the following data set
list(running)
[[1]]
X100m X200m X400m X800m X1500m X5K X10K Marathon
Argentina 10.39 20.81 46.84 1.81
2005 Apr 11
1
plotting Principal components vs individual variables.
At the cost of breaking the thread I'm going to change your subject and
replace 'Principle' by 'Principal'. I just can't stand it any longer...
OK, here is how I would solve your other problems. First put
> wh <- c("USA", "New Zealand", "Dominican Republic",
"Western Samoa", "Cook Islands")
> ind
2007 Mar 26
1
Handling Multiple Select Lists
Hi All,
After much searching and head scratching I post you this!
I can''t seem to find a generic way to handle multiple select data. The
function I use to receive form values will only pass the first selected
value from a multiple select. I have pasted part of the form and the
function below.
Thanks for any pointers,
Vince
// Example selectbox
<select
2010 Apr 02
1
Selecting the first row based on a factor
Hello there,
I have a situation where I would like to select the first row of a
particular factor for a data frame (data example below). So that is, I would
like to select the first entry when the factor1 =A and then the first row
when factor1=B etc. I have thousands of entries so I need some general way
of doing this. I have a minimal example that should illustrate what I am
trying to do. I am
2009 Jul 24
3
Duplicated date values aren't duplicates
Dear list,
I just had a function (as.ltraj in Adehabitat) give me the following error:
"Error in as.ltraj(xy, id, date = da) : non unique dates for a given burst"
I checked my dates and got the following:
> dupes<-mydata$DateTime[duplicated(mydata$DateTime)]
> dupes
[1] (07/30/02 00:00:00) (08/06/03 17:45:00)
Is there a reason different dates would come up as duplicate
2008 Jul 18
1
manipulate a matrix2
Building upon Jim's answer below (Thanks Jim, that helped a lot), I need
to pickup where this thread left off. I'm using Vegan to calculate the
Jaccard's Index and the Row.Names and column names are represented in my
matrix as seen here.
[,3] [,5] [,6] [,9] [,11]
[3,] 0 6 11 16 21
[5,] 2 0 12 17 22
[6,] 3 8 0 18 23
[9,] 4 9
2010 Jul 17
2
Plot error
Hi guys,
I am a newbie to R, so apologies in advance.
I created this simple table in excel, saved in tab delimited .txt:
name value_1 value_2
1 bill 1 4
2 ben 2 2
3 jane 3 1
>test <-read.table("\path\to\file", sep="\t", header=TRUE)
>x <-c(seq["value_1"])
>y <-c(seq["value_2"])
2003 Jan 21
2
newbie: data frame to vector
Sorry, but I'm very new to R. I'm trying to figure out how to convert a
column from a data frame to a vector. More specifically, I have read in a
comma separated value table which contains a number of variables in columns,
plots in rows...
t <- read.table("G:/R/table1.txt", sep=",", header=TRUE)
the data comes in just fine. Now I want to do an XY plot of 2
2012 Jun 04
1
Plotting with Rgraphviz
Hi All,
After a lengthy battle just to get the package installed, I am not able to
actually use Rgraphviz to generate any plots. I tried just using the sample
code in the documentation
(http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/r/rgraphviz/)
and I get the following:
*> > library(Rgraphviz)
> test.matrix<-matrix(rep(c(0,1,0,0), 9), ncol=6, nrow=6)
>
2012 Nov 17
3
transform input argument (matrix) of function
Dear list!
I would like to write a function to transform matrix, which is input argument of a written function. It is easy with new matrix (see below), but my idea is to transform input argument (matrix) of function without any additional matrixes. Here is an example:
fun1 <- function(xy) {
xy <- cbind(xy[,1], xy[,2], xy[,1] + xy[,2])
return(xy)
}
df1 <- matrix(c(1,2,3,1,2,3), ncol =
2009 Jun 09
3
Splicing factors without losing levels
Hi list!
An operation that I often need is splicing two vectors:
> splice(1:3, 4:6)
[1] 1 4 2 5 3 6
For numeric vectors I use this hack:
splice <- function(x, y) {
xy <- cbind(x, y)
xy <- t(xy)
dim(xy) <- length(x) * 2
return(xy)
}
So far, so good (?). But I also need splicing for factors and I tried
this:
splice <- function(x, y) {
xy <-
2013 May 21
3
add identifier column by row
I want to add identifier column (Date) to a time series data frame. I want
to name the "Date" column be from 1 to 30 every 1440 rows.
Say I have a data like this (I simply my actual data here):
$dat
ID Var
1 1
2 4
3 6
4 7
5 7
6 8
How can I add identifier column (Date) from 1 to 3 every 2 rows and have
output like this:
ID