This should get you started:
x <- "2009-03-21"
substr( x, 1, 4 )
y <- as.integer( substr( x, 1, 4 ) )
y
or
yy <- as.POSIXlt( x )$year + 1900
yy
RShowDoc( "R-intro" )
On June 4, 2020 9:18:00 PM PDT, Charles Thuo wrote:
>Dear Sirs,
>
>I have a data frame that has a column that shows the transa
Dear Sirs,
I have a data frame that has a column that shows the transaction date.
How do i add another column that extracts the year of transaction from the
transaction date.
Charles
[[alternative HTML version deleted]]
__
R-help@r-project.
Is there possible to generate a barplot in the following link using ggplot?
https://photos.app.goo.gl/E3MC461dKaTZfHza9
here is what I did
library(ggplot2)
df <- read.csv(text=
"trt,gene,freq,cols
M6,ALDH16A1,100.000,red
M6,Others,0.000,lightgrey
M12,ALDH16A1,64.6638015,red
M12,GBE1,2.0
Thanks to all for the help.
I found that write.table works nicely, with col.names = FALSE with append =
TRUE.
Sincerely,
Erin
Erin Hodgess, PhD
mailto: erinm.hodg...@gmail.com
On Thu, Jun 4, 2020 at 7:56 PM Jeff Newmiller
wrote:
> Use write.table.
>
> Write.csv follows a very specific defini
... :
"arguments to write.table: append, col.names, sep, dec and qmethod cannot
be altered."
The default is FALSE, so cannot be altered.
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom
Hi Erin: The default for write.csv is col.names = TRUE . So, in the second
one,
if you put, col.names = FALSE, that should work. It's confused right now
because you want to append but also write the column names again.
Mark
On Thu, Jun 4, 2020 at 9:34 PM Erin Hodgess wrote:
> Hello!
>
> H
Use write.table.
Write.csv follows a very specific definition for csv... one element of which is
that it is not allowed to have a second header line after data lines. The only
way for write.csv to enforce this is to disallow appending.
On June 4, 2020 6:34:14 PM PDT, Erin Hodgess wrote:
> Hell
Change over to write.table.
Sorry for the wasted bandwidth.
Thanks,
Erin
Erin Hodgess, PhD
mailto: erinm.hodg...@gmail.com
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.
Hello!
Hope everyone is doing as well as possible.
I have a question about write.csv. I thought that the append argument
would permit adding another data frame with the same column names.
Here is my example:
date1 <- as.Date("2020-03-09")
wday <- weekdays(date1)
x1 <- data.frame(date=date1
Thanks - a previous response resolved the issue and I'm off and running with
the analyses.
-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Thursday, June 4, 2020 5:02 PM
To: Ted Stankowich
Cc: Rui Barradas ; William Dunlap ;
r-help@r-project.org
Subject:
Perhaps indexing with rowSums(is.na(dfrm))?
—
David
Sent from my iPhone
> On Jun 4, 2020, at 4:58 PM, Ted Stankowich
> wrote:
>
> This worked! Thank you!
>
> -Original Message-
> From: Rui Barradas [mailto:ruipbarra...@sapo.pt]
> Sent: Thursday, June 4, 2020 2:49 PM
> To: Ted Stan
This worked! Thank you!
-Original Message-
From: Rui Barradas [mailto:ruipbarra...@sapo.pt]
Sent: Thursday, June 4, 2020 2:49 PM
To: Ted Stankowich ; William Dunlap
Cc: r-help@r-project.org
Subject: Re: [R] na.omit not omitting rows
CAUTION: This email was sent from an external source.
Better read the Posting Guide mentioned in the footer of this and every email
on this list. Attachments can only be among a very few file types and still be
passed through... yours did not.
As for your question, it is very likely that the answer is yes, though since
this list is about the R lan
Hello,
If the problem is the "na.action" attribute, here are two ways of
solving it.
First, an example data set.
set.seed(2020)# Make the example reproducible
phamComplBinomial <- sprintf("f%003d", 1:356)
is.na(UphamComplBinomial) <- sample(356, 37)
DarkEum <- factor(sample(1:2, 356, TRUE
Thanks, but no that doesn’t work. The na.omit attributes are still in the
dataframe, which you can see in the str outputs from the post. The problem line
is likely: - attr(*, "na.action")= 'omit' Named int [1:2] 2 3
From: William Dunlap [mailto:wdun...@tibco.com]
Sent: Thursday, June 4, 2020 12
You should post on r-sig-geo, the list devoted to spatial data analysis,
rather than here.
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Jun 4, 2020 at
Does droplevels() help?
> d <- data.frame(size = factor(c("S","M","M","L","L"),
levels=c("S","M","L")), id=c(101,NA,NA,104,105))
> str(d)
'data.frame': 5 obs. of 2 variables:
$ size: Factor w/ 3 levels "S","M","L": 1 2 2 3 3
$ id : num 101 NA NA 104 105
> str(na.omit(d))
'data.frame': 3 o
Hello! I'm trying to create a subset of a dataset and then remove all rows with
NAs in them. Ultimately, I am running phylogenetic analyses with trees that
require the tree tiplabels to match exactly with the rows in the dataframe. But
when I use na.omit to delete the rows with NAs, there is sti
I did a regression analysis with categorical data with a glm model
approach, which worked fine. I have longitude and latitude coordinates for
each observation and I want to add their geographic spillover effect to the
model.
My sample data is structured:
Index DV IVI IVII IVIII IVIV Long Lat
1
Dear Jeff,
Thank you so much for your time.
I tried your code. It successfully assigned NA to the zeros.
But the main code seems not to work with the NAs. The mean, for example,
resulted in NA. I am attaching the data for a period of one year and the
code which I use in plotting the data. Maybe
Dear Jeff,
Yes. It worked. But I am still fine turning the script.
Please permit me to ask again.
Since I can handle one year. I wish to take on more years. I added extra
two years and now have 2000 to 2002.
I wish to plot the same graph for those years such that the x-axis will be
showing 2000,
I have a question about using ggplot.
Is there possible to generate a barplot like the attached file using ggplot?
Thank you,
Aimin
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE
Catalin,
> On Jun 4, 2020, at 6:06 AM, Catalin Roibu wrote:
>
> Dear R users,
>
> Please help me to detect consecutive n values in R and their interval.
>
>
> rle.seq1<-rle(reco$extr)
> cbind(rle.seq1$values)
> index<-any(rle.seq1$values=="DRY"&rle.seq1$lengths>=3)
> cumsum(rle.seq1$lengths)[
Dear R users,
Please help me to detect consecutive n values in R and their interval.
rle.seq1<-rle(reco$extr)
cbind(rle.seq1$values)
index<-any(rle.seq1$values=="DRY"&rle.seq1$lengths>=3)
cumsum(rle.seq1$lengths)[index]
reco is a data frame with 2 columns (year and values (DRY, WET).
I want to
24 matches
Mail list logo