Displaying 20 results from an estimated 5000 matches similar to: "interpreting date-related error message"
2012 Nov 01
2
Name assignment in for loop
Dear helpeRs-
I'm using a for loop to create a series of models.
I'm trying to assign a name to each model created,
using the loop index. The loop gets stuck at the name
of the model, giving the error "target of assignment
expands to non-language object". The linear model runs
without error; only the name is problematic.
Here is the current loop syntax. The use of dat
2010 Aug 12
4
conditional selection of dataframe rows
Dear helpeRs,
I have a dataframe (14947 x 27) containing measurements collected
every 5 seconds at several different sampling locations. If one
measurement at a given location is less than zero on a given day, I
would like to delete all measurements from that location on that day.
Here is a toy example:
toy <- data.frame(CH = rep(3:5,3), DAY = c(rep(4,5), rep(5,4)),
SLOPE =
2006 Dec 20
1
Reformat meteorological data
Dear HelpeRs:
I have a data set in the following format,
which will be familiar to those of you working
with NCDC climate data.
Example:
Year <- rep(1:3, each = 3)
Year <- c(Year,Year)
ID <- rep(1:2, each = 9)
Jan <- runif(18, min = 0, max = 20)
Feb <- runif(18, min = 0, max = 20)
Mar <- runif(18, min = 0, max = 20)
var <- gl(3,1,18,label =
2009 Nov 13
2
format (PR#14062)
Full_Name: Dirk Jacob
Version: R 2.8.1 and 2.9.1
OS: Win XP
Submission from: (NULL) (153.96.32.62)
I want to convert numbers to strings
like:
> inputs= c(0.3+0*(1:12) )
> (format(inputs,digits=3,scientific=T,collapse=" "))
and it works
[1] "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01"
2010 Sep 28
2
Reshape
Hello, helpeRs,
I've been trying, unsuccessfully, to change a dataframe from long to
wide format using reshape (the original). I would appreciate it if
someone could demonstrate the correct syntax. The script below will
create a toy example. The new wide data should have a column name
for each unique entry in the "fame" column. Under each column
should be either the
2008 Aug 07
1
Bug in format.default(): na.encode does not have any effect for (PR#12318)
Hi!
If I use format() on numeric vector, na.encode argument does not have any e=
ffect. This
was reported before:
- https://stat.ethz.ch/pipermail/r-help/2007-October/143881.html
- http://tolstoy.newcastle.edu.au/R/e2/devel/06/09/0360.html
It works for other (say character) classes!
> format(c("a", NA), na.encode=3DTRUE)
[1] "a " "NA"
>
2019 Mar 21
3
prettyNum digits=0 not compatible with scientific notation
R developers,
Seems I get a bad result ("%#4.0-1e" in particular) when trying to use prettyNum digits=0 with scientific notation. I tried on both my Linux box and on an online R evaluator and saw the same problem, so it's not limited to my box at least. I see the problem in both R 3.5.3 and R 3.3.2.
options(scipen=-100)
prettyNum(1, digits=0)
[1] "%#4.0-1e"
prettyNum(2,
2007 Jun 13
5
Confusion with sapply
Hi,
I have some confusion in applying a function over a column.
Here's my function. I just need to shift non-March month-ends to March
month-ends. Initially I tried seq.dates, but one cannot give a negative
increment (decrement) here.
return(as.Date(seq.dates(format(xdate,"%m/%d/%Y"),by="months",len=4)[4])
)
Hence this simple function:
> mydate <-
2010 Feb 14
4
Newbie woes with *apply
Dataframe cust has Date-type column open.date. I wish to set up another
column, with (first day of) the quarter of open.date.
To be comprehensive (of course, improvement suggestions are welcome),
month = function(date)
{
return(as.numeric(format(date,"%m")))
}
first.day.of.month = function(date)
{
return(date + 1 - as.numeric(format(date,"%d")))
}
first.day.of.quarter =
2019 Mar 22
2
prettyNum digits=0 not compatible with scientific notation
FWIW, it doesn't seem to be happening on Mac OS:
> format(2^30, digits=0)
[1] "1.e+09"
> prettyNum(12345.6, digits=0)
[1] "1.e+04"
A glibc misfeature?
-pd
> On 22 Mar 2019, at 10:10 , Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>
> Thank you, Robert for raising this here !
>
>>>>>> Robert McGehee
2006 May 01
1
format.info() versus format.default(): Comments please
The format.info() function currently takes args (x, digits = NULL,
nsmall = 0), while format.default() takes many more:
function (x, trim = FALSE, digits = NULL, nsmall = 0, justify = c("left",
"right", "centre", "none"), width = NULL, na.encode = TRUE,
scientific = NA, big.mark = "", big.interval = 3, small.mark = "",
2012 Apr 14
1
R Error/Warning Messages with library(MASS) using glm.
Hi there,
I have been having trouble running negative binomial regression (glm.nb)
using library MASS in R v2.15.0 on Mac OSX.
I am running multiple models on the variables influencing the group size of
damselfish in coral reefs (count data). For total group size and two of my
species, glm.nb is working great to deal with overdispersion in my count
data. For two of my species, I am getting a
2010 Aug 18
1
syntax for batching rbind process
Dear helpeRs,
I am attempting to read in a series of csv files so I can bind them
into one large dataframe. I have written the following script:
test <- list.files(".", pattern = "csv") #lline 1
imp <- list() #line 2
for (i in 1:length(test)) { #line 3
imp[i] <- read.csv(test[i]) #line 4
}
2010 Feb 15
2
Printing 2 digits after decimal point
Hi there,
i'm not getting along with the following problem.
I'd like to print a real number, e.g.
x <- 12.3
with exactly two digits after the decimal point, e.g.
12.30
I've tried the whole format(), formatC() and prettyNum() functions but
did not have any success with it.
This should work with all real numbers, in case even with 0.0 (-> 0.00).
For cracks this thing is pretty
2012 Jun 20
2
reshape
Hello, helpeRs,
I am attempting to reshape (either base R or package reshape) multiple .csv
spreadsheets from a very unfortunate wide format to long format. ?Each spreadsheet
looks something like this, after being read in to R:
toy <- data.frame(year = rep(2007:2008,each = 20), month = rep(1:5,each = 4, length = 40),
day = rep(1:2,each = 2,length = 40), hhmm = rep(1100:1101,length = 40),
2008 Jun 24
1
Error message: Bad value
Dear R help,
In the middle of my session, I started receiving the error
message "bad value"
regardless of what I entered. I had to close R and restart
it. When the error
occurred, I was creating basic lattice plots, with no other
add-on packages running.
I am running R through John Fox's XEmacs interface, XEmacs
version
21.4.20 on a Windows XP Pro machine with 2 GB of RAM. I
have
2010 Feb 15
2
Confidence intervals nls
Dear All
I am quite new to R and would appreciate some help fitting 95% confidence
intervals to a nls function. I have the data
DOY CET
90 5.9
91 8
92 8.4
93 7.7
95 6.6
96 6.8
97 7.1
98 9.7
99 12.3
100 12.8
102 11
103 9.3
104 9.8
105 9.9
107 7.7
110 6.2
111 5.9
112 5.9
113 3.4
114 3.5
116 3.3
117 5.4
118 6.3
119 9.7
120 11.2
121 7.3
124 7.8
etc
I am trying to use some code that has been
2005 Oct 06
5
Interpolation in time
Can anybody help me write a code on the following data example, which
fills out all NA values by using a linear interpolation with the two
closest values?
Doy is day of year (%j).
Code example:
yr<-c(rep(2000,14))
doy<-c(16:29)
dat<-c(3.2,NA,NA,NA,NA,NA,NA,5.1,NA,NA,NA,NA,NA,4.6)
ta<-cbind(yr,doy,dat)
ta
yr doy dat
[1,] 2000 16 3.2
[2,] 2000 17 NA
[3,] 2000 18 NA
2005 Sep 12
2
barplot with multiple columns
I have a large dataset looking like this (as an example):
doy<-c(178,179,180,181,182,183,184,185,186,187,188)
s1<-c(0 , 0, 2.4 , 0 , 3.34 , 0 , 5.34 , 0 , 0 , 0 , 6.9)
s2<-c(0 , 9.72, 0, 10.56 , 2.67 , 0 , 6.45 ,0 , 0 , 9, 3.6)
dat<-cbind(doy,s1,s2)
dat
I need to make a barplot where the two time series s1 and s2 are plottet
beside each other for each doy. How can I do that?
2004 Oct 26
1
2nd Y-axis text problem
Dear All,
I'm having problems getting text to appear on a second y axis....because
this can only be done within a plot statement and my attempts to add the
label as text didn't work because the "locator" refers to the plot
area....
Any thoughts greatly appreciated.
Thanks in advance,
Sion
>par(mai=c(1,1,1,1.5))
>plot(time[DOY<230],Hmeas[DOY <