Re: [R] Converting chr to num

2018-08-19 Thread Rui Barradas
Hello, Inline. On 20/08/2018 01:08, Daniel Nordlund wrote: See comment inline below: On 8/18/2018 10:06 PM, Rui Barradas wrote: Hello, It also works with class "factor": df <- data.frame(variable = c("12.6%", "30.9%", "61.4%")) class(df$variable) #[1] "factor" as.numeric(gsub(pattern =

Re: [R] as.Date() function

2018-08-19 Thread philipsm
Thanks Erin and Jim. You have indeed solved my problem. Philip Quoting Erin Hodgess : Hi Philip: Here is something to consider: #potential solution: sta <- paste(st,"-01",sep="") st1 <- as.Date(sta, format=("%Y-%m-%d")) print(st1) [1] "1961-01-01" "1961-04-01" "1983-02-01" Hope this

Re: [R] Converting chr to num

2018-08-19 Thread Daniel Nordlund
See comment inline below: On 8/18/2018 10:06 PM, Rui Barradas wrote: Hello, It also works with class "factor": df <- data.frame(variable = c("12.6%", "30.9%", "61.4%")) class(df$variable) #[1] "factor" as.numeric(gsub(pattern = "%", "", df$variable)) #[1] 12.6 30.9 61.4 This is because

Re: [R] as.Date() function

2018-08-19 Thread Jim Lemon
Hi Phillip, Jose has the correct answer. You probably missed this sentence in the "Note" section of the help page: "If the date string does not specify the date completely, the returned answer may be system-specific." In your case, the function throws up its hands and returns NA as you haven't

Re: [R] Request for R Assistance: Downloading Data

2018-08-19 Thread Sparks, John
I agree with Jeff. The data type is the problem. I wrote what I wrote without looking at the problem very carefully. --JJS From: Jeff Newmiller Sent: Sunday, August 19, 2018 4:38 PM To: r-help@r-project.org; Sparks, John; Spencer Brackett;

Re: [R] Request for R Assistance: Downloading Data

2018-08-19 Thread Jeff Newmiller
I think this hunch is off the mark... the file name is fine as it is... if anything will confuse R it would be that the data inside the file are not what was expected. If in fact the file is csv formatted then the function to read it would be read.csv [1] or read.table [2]. Read the help pages

Re: [R] as.Date() function

2018-08-19 Thread José María Mateos
On Sun, Aug 19, 2018 at 05:20:29PM -0400, phili...@cpanel1.stormweb.net wrote: > Why the heck am I getting three NAs instead of three Dates?I have > studied the R documentation for as.Date() and it has not turned on > the light bulb for me. I haven't encountered this problem before, but in my

Re: [R] as.Date() function

2018-08-19 Thread Erin Hodgess
Hi Philip: Here is something to consider: > #potential solution: > sta <- paste(st,"-01",sep="") > st1 <- as.Date(sta, format=("%Y-%m-%d")) > print(st1) [1] "1961-01-01" "1961-04-01" "1983-02-01" Hope this helps! Erin Erin Hodgess, PhD mailto: erinm.hodg...@gmail.com On Sun, Aug 19, 2018 at

[R] as.Date() function

2018-08-19 Thread philipsm
I am having trouble with what must be a very simple problem. Here is a reproducible example: library(lubridate) st <- c("1961-01","1961-04","1983-02") print(st) #[1] "1961-01" "1961-04" "1983-02" st1 <- as.Date(st, format=("%Y-%m")) print(st1) #[1] NA NA NA Why the heck am I getting three NAs

Re: [R] learning tidyverse

2018-08-19 Thread Erin Hodgess
Thanks so much e Erin Hodgess, PhD mailto: erinm.hodg...@gmail.com On Sun, Aug 19, 2018 at 2:42 PM Ista Zahn wrote: > https://www.tidyverse.org/learn/ > On Sun, Aug 19, 2018 at 4:29 PM Erin Hodgess > wrote: > > > > Hello everyone! > > > > Could anyone recommend a good way to learn about

Re: [R] learning tidyverse

2018-08-19 Thread Ista Zahn
https://www.tidyverse.org/learn/ On Sun, Aug 19, 2018 at 4:29 PM Erin Hodgess wrote: > > Hello everyone! > > Could anyone recommend a good way to learn about tidyverse, please? Is > there a book, please? > > Thanks, > Erin > > > > Erin Hodgess, PhD > mailto: erinm.hodg...@gmail.com > >

[R] learning tidyverse

2018-08-19 Thread Erin Hodgess
Hello everyone! Could anyone recommend a good way to learn about tidyverse, please? Is there a book, please? Thanks, Erin Erin Hodgess, PhD mailto: erinm.hodg...@gmail.com [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Request for R Assistance: Downloading Data

2018-08-19 Thread Sparks, John
Just a hunch, but I would recommend simplifying your filename: remove the (CSV) portion. It could be confusing in R read syntax. Create a filename with no unnecessary punctuation and no blank spaces. --John Sparks From: R-help on behalf of Spencer

Re: [R] Request for R Assistance: Downloading Data

2018-08-19 Thread David L Carlson
The load() function is only used for binary files that R creates with the save() function. You are trying to assign the data to an object (variable) called LGG Drug. R does not allow spaces in variable names. You could try LGGDrug, LGG_Drug, or LGG.Drug. Same issue with GBM Drug. David L.

Re: [R] Request for R Assistance: Downloading Data

2018-08-19 Thread Rich Shepard
On Sun, 19 Aug 2018, Spencer Brackett wrote: I am attempting to download Genomic data from the GDC onto R for analysis and am experiencing some difficulty. I have downloaded the GDC data into an Excel, CSV, and notepad (.txt) file and implemented what I believe to be the proper arguments, with

[R] Request for R Assistance: Downloading Data

2018-08-19 Thread Spencer Brackett
Good evening, I am attempting to download Genomic data from the GDC onto R for analysis and am experiencing some difficulty. I have downloaded the GDC data into an Excel, CSV, and notepad (.txt) file and implemented what I believe to be the proper arguments, with every attempting failing to

Re: [R] [FORGED] Re: bar plot add space to group data

2018-08-19 Thread David L Carlson
Actually the data you provided are a data frame and not a matrix as R uses the term. Two columns of gceac are numeric and one is a factor. If we read your data with read.csv() we get: > str(gceac) 'data.frame': 35 obs. of 3 variables: $ year : int 2014 2014 2014 2014 2014 2014 2014

[R] Computing the density of a median

2018-08-19 Thread Dioggban Jakperik
I have the following function kdenor <- function(aa,q=NULL){ a=sample(aa,500,replace=F) ab=quantile(a, p=0.75)-quantile(a, p=0.25) h=(0.9*min(var(a),ab))/(1.34*n^(1/5)) if(is.null(q)) { q = seq(min(a)-3*h, max(a)+3*h, length.out=length(a)) } nx = length(a) nq = length(q) xmat = matrix(q,nq,nx) -

Re: [R] [FORGED] Re: bar plot add space to group data

2018-08-19 Thread Peter Langfelder
On Sun, Aug 19, 2018 at 7:15 AM wrote: > > August 19, 2018 4:58 AM, "Peter Langfelder" > wrote: > > > To the OP, try formatting the data to be plotted as a matrix, not as a > > vector > > CSV data provided in a previous message; is not the data formatted as a > matrix? I meant the data you

Re: [R] [FORGED] Re: bar plot add space to group data

2018-08-19 Thread citc
August 19, 2018 4:58 AM, "Peter Langfelder" wrote: > To the OP, try formatting the data to be plotted as a matrix, not as a > vector CSV data provided in a previous message; is not the data formatted as a matrix? __ R-help@r-project.org mailing list

Re: [R] bar plot add space to group data

2018-08-19 Thread citc
August 17, 2018 10:24 PM, "Rolf Turner" wrote: > On 18/08/18 02:37, David L Carlson wrote: > >> Notice below that your message is substantially scrambled. R-Help is a >> plain text only list so you should set your email client to produce plain >> text messages. Apologies, forgot to change the