Displaying 20 results from an estimated 3000 matches similar to: "reference text variables as column name to plot"
2010 Sep 22
1
failure to access packages
I am helping a fellow worker get R up and running, and he has run into a peculiar problem I've not encountered in previous install situations.
>From the Rconsole menu choice, he can set CRAN mirror to USA CA2, but when he selects "load packages" a very truncated list of packages appears (many packages don't appear at all).
If he issues "chooseCRANmirror()" from the
2009 Aug 13
3
shading between two smoothed curves
I have a set of 52 weekly values, one is the desired high lake stage for
a week, and the other is the desired low lake stage for each week. It
looks like this:
week
High
Low
1
16
14.5
2
16
14.5
3
15.95
14.45
4
15.84
14.34
5
15.73
14.23
6
15.61
14.11
7
15.5
14
8
15.38
13.88
9
15.25
13.75
10
15.13
13.63
....
52
15
13.5
I can plot out two nice curves
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
2009 Jul 21
3
how to use a list to create a plot
I issued the following command to obtain the std dev for each month.
psd<-numSummary(Sal, groups=month, statistics=c("sd"))
which resulted in
> psd
sd n NA
1 6.930340 9367 2319
2 7.847003 10827 1008
3 5.962308 12988 404
4
2010 Jun 10
1
nls model fitting errors
What am I failing to understand here?
The script below works fine if the dataset being used is
DNase1 <- DNase[ DNase$Run == 1, ] per the example given in
help(nlrob).
Obviously, I am trying to understand how to use nls and nlrob to fit
curves to data using R.
#package=DAAG
attach(codling)
plot(pobs~dose)
#next command returns 'step factor reduced below min factor
2010 Jul 20
1
Exporting NMDS distance matris to csv
If you submit these lines, you end up with variable "vare.dis". I want
to export vare.dis to csv. Stuck I am.
library(vegan,logical.return = TRUE) #return=true verifies package is
available
library(MASS,logical.return=TRUE) #return=true verifies package is
available
data(varespec) #varespec is an example data file in the vegan package
vare.dis <- vegdist(varespec)
2009 Jun 08
4
increase number of ticks on x axis of dates
My x axis is a series of daily dates (e.g., 01/01/2000, 01/02/2000,
etc.) from 2000 to end of 2008. The default only gives me 4 ticks. I
want more. Why doesn't this work?
sdate<-as.POSIXct(strptime(date,format="%m/%d/%Y"))
plot(ppt~sdate,type="l",ylim=c(0,47),col=1,lwd=1,pch=16,ylab="Salinity,
psu",xlab="Year",las=1,main="Duck Key
2011 Feb 03
2
tapply output as a dataframe
On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube <ddube-at-advisen.com> wrote:
> i use tapply and by often, but i always end up banging my head against
> the wall with the output.
The proposed solution of Dan's problem posted on R-help was:
> do.call(rbind,a)
When I use this 'solution' I get 'ERROR: second argument must be a list'. So head on wall continues.
My
2009 May 14
1
replacing default axis labels on a plot
I have 3 columns: flow, month, and monthname, where month is 1-12, and
monthname is name of month. I can't get the plot to replace the 1-12
with monthname using ticks.lab. What am I doing wrong?
plot(flow~factor(month),xlab="Month",ylab="Total Flow per Month",
ylim=c(0,55000), ticks.lab="monthname")
Thanks
Gregory A. Graves
Lead Scientist
REstoration
2008 Dec 31
2
sdate<-as.POSIXct(strptime(date,format="%m/%d/%Y %H:%M"))
Newbie here~
I've spent a ton of time on this, but have to admit I am stuck. I've tried various combinations of strptime and the package CHRON, but still can't get there.
My simple task is that I want to plot salinity (S1 or S2) on y-axis and time on x-axis, but I want to use a lay-understandable representation of time (not Julian). If I use the following command, I can make a
2010 Jul 22
1
interpretation of stress in NMDS
Among those users of Primer, stress values greater than 0.3 are
interpreted as "questionable". Using both isoMDS and metaMDS (vegan
package), the stress values returned are much higher using my own data
and using examples provided in R Help. For example Rstress = 8.3, and
the stressplot r2 = 0.99 indicating (to me) that the ordination is OK.
I am guessing that the "stress"
2017 Jun 03
2
New var
Thank you all for the useful suggestion. I did some of my homework.
library(data.table)
DFM <- read.table(header=TRUE, text='obs start end
1 2/1/2015 1/1/2017
2 4/11/2010 1/1/2011
3 1/4/2006 5/3/2007
4 10/1/2007 1/1/2008
5 6/1/2011 1/1/2012
6 10/5/2004 12/1/2004',stringsAsFactors = FALSE)
DFM
DFM$D =as.numeric(difftime(as.Date(DFM$end,format="%m/%d/%Y"),
2017 Jun 04
2
New var
Thank you Jeff and All,
Within a given time period (say 700 days, from the start day), I am
expecting measurements taken at each time interval;. In this case "0" means
measurement taken, "1" not taken (stopped or opted out and " -1" don't
consider that time period for that individual. This will be compared with
the actual measurements taken (Observed-
2017 Jun 04
0
New var
# read.table is NOT part of the data.table package
#library(data.table)
DFM <- read.table( text=
'obs start end
1 2/1/2015 1/1/2017
2 4/11/2010 1/1/2011
3 1/4/2006 5/3/2007
4 10/1/2007 1/1/2008
5 6/1/2011 1/1/2012
6 10/5/2004 12/1/2004
',header = TRUE, stringsAsFactors = FALSE)
# cleaner way to compute D
DFM$start <- as.Date( DFM$start, format="%m/%d/%Y" )
DFM$end
2017 Jun 04
0
New var
Since the number of choices is small (6), how about this?
Starting with Jeff's initial DFM:
DFM <- structure(list(obs = 1:6, start = structure(c(16467, 14710, 13152,
13787, 15126, 12696), class = "Date"), end = structure(c(17167,
14975, 13636, 13879, 15340, 12753), class = "Date"), D = c(700,
265, 484, 92, 214, 57), bin = structure(c(6L, 3L, 5L, 1L, 3L,
1L), .Label
2017 Jan 17
2
bug in rbind?
I suspect there may be a bug in base::rbind.data.frame
Below there is minimal example of the problem:
m <- matrix (1:12, 3)
dfm <- data.frame (c = 1 : 3, m = I (m))
str (dfm)
m.names <- m
rownames (m.names) <- letters [1:3]
dfm.names <- data.frame (c = 1 : 3, m = I (m.names))
str (dfm.names)
rbind (m, m.names)
rbind (m.names, m)
rbind (dfm, dfm.names)
#not working
rbind
2011 Aug 27
2
Am having trouble calling a function
In my main R program, I have
source("retaanalysis/Functions/doAirport.R")
.... stuff to read data and calculate ads
sapply(ads, function(x) {doAirport(x, base)} )
And doAirport has
# analyze the flights for a given airport
doAirport = function(df, base) {
# Get rid of unused runway factor levels (from other airports)
df$lrw <- drop.levels(df$lrw) # In gdata package
#
2017 Jul 16
2
About doing figures
Hi R users,
I still have the problem about plotting. I wanted to put the datasets on
one figure, x-axis represents values B, y-axis represents values C, while
different colors label column A. Each record uses a circle on the figure,
while hollow circles represent DF=1 and solid circles represent DF=2. I put
my code below, but the A labels do not correspond to the true record, so I
don't know
2017 Jul 16
2
About doing figures
Hi Jim,
For true color, I meant that the points in the figure do not correspond to
the values from the dataframe. Also, why to use rainbow(9) here? And the
legend is straight in the middle, is it possible to reformat it to the very
bottom? Thanks again.
On Sun, Jul 16, 2017 at 2:50 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
> Hi lily,
> As I have no idea of what the "true
2017 Jul 16
0
About doing figures
Hi lily,
As I have no idea of what the "true record" is, I can only guess.
Maybe this will help:
# get some fairly distinct colors
rainbow_colors<-rainbow(9)
# this should sort the numbers in dfm$A
dfm$Acolor<-factor(dfm$A)
plot(dfm$B,dfm$C,pch=ifelse(dfm$DF==1,1,19),
col=rainbow_colors[as.numeric(dfm$Acolor)])
legend("bottom",legend=sort(unique(dfm$A)),