Re: [R] log transform a data frame

2023-06-13 Thread David Carlson via R-help
Try this pdf("~/graph.pdf") par(mar=c(8, 4, 4, 2)) barplot(d2, legend= c("SYCL", "CUDA"), beside= TRUE,las=2,cex.axis=0.7,cex.names=0.7,ylim=c(0,80), col=c("#9e9ac8", "#6a51a3")) dev.off() See ?par to see the details for adjusting margins and other plot features. David On Tue, Jun 13, 2023 at 5

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread avi.e.gross
Bert, I stand corrected. What I said may have once been true but apparently the implementation seems to have changed at some level. I did not factor that in. Nevertheless, whether you use an index as a key or as an offset into an attached vector of labels, it seems to work the same and I th

Re: [R] log transform a data frame

2023-06-13 Thread Ana Marija
Thank you so much David, here is correction: d1=suppressWarnings(read.csv("/Users/anamaria/Downloads/B1.csv", stringsAsFactors=FALSE, header=TRUE)) d1$X <- NULL d2=as.matrix(sapply(d1, as.numeric)) pdf("~/graph.pdf") b<-barplot(d2, legend= c("SYCL", "CUDA"), beside= TRUE,las=2,cex.axis=0.7,cex.nam

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Bert Gunter
Below. On Tue, Jun 13, 2023 at 2:18 PM wrote: > > > Javad, > > There may be nothing wrong with the methods people are showing you and if it satisfied you, great. > > But I note you have lots of data in over a quarter million rows. If much of the text data is redundant, and you want to simplify s

Re: [R] log transform a data frame

2023-06-13 Thread David Carlson via R-help
Your first data column appears to contain character data (e.g. SYCL) which cannot be converted to numeric. You also appear to have 0's in the numeric columns which will cause problems since log(0) is -Inf. Barplots are useful for categorical data, but not continuous, numeric data which are better h

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread avi.e.gross
Javad, There may be nothing wrong with the methods people are showing you and if it satisfied you, great. But I note you have lots of data in over a quarter million rows. If much of the text data is redundant, and you want to simplify some operations such as changing some of the values to

[R] log transform a data frame

2023-06-13 Thread Ana Marija
Hello, I have a data frame like this: d11=suppressWarnings(read.csv("/Users/anamaria/Downloads/B1.csv", stringsAsFactors=FALSE, header=TRUE)) > d11 X Domain.decomp. DD.com..load Neighbor.search Launch.PP.GPU.ops. Comm..coord. 1 SYCL 2. 10 3.7

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Bill Dunlap
It is safer to use !grepl(...) instead of -grep(...) here. If there are no matches, the latter will give you a zero-row data.frame while the former gives you the entire data.frame. E.g., > d <- data.frame(a=c("one","two","three"), b=c(10,20,30)) > d[-grep("Q", d$a),] [1] a b <0 rows> (or 0-lengt

Re: [R] Rmarkdown code rendering as LaTeX, not executing?

2023-06-13 Thread Olivier Crouzet
Dear Kevin, actually you're mixing markdown and LaTeX syntax, which is the reason why you see LaTeX code in the PDF. You have to choose... 1) Either you wish to produce an RMarkdown document and your sections, subsections... should read: # Abstract In this document, ... ## Boundaries of the Ra

[R] Rmarkdown code rendering as LaTeX, not executing?

2023-06-13 Thread Kevin Zembower via R-help
Hi, all, I'm trying to compose an Rmarkdown document and render it as a PDF file. My first block of R code seems to work okay, but the second on seems to be interpreted as LaTeX code, and not executed as R code. In the output, the three back-ticks that mark the R code block are interpreted as a

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Rui Barradas
Às 17:18 de 13/06/2023, javad bayat escreveu: Dear Rui; Hi. I used your codes, but it seems it didn't work for me. pat <- c("_esmdes|_Des Section|0") dim(data2) [1] 281549 9 grep(pat, data2$Layer) dim(data2) [1] 281549 9 What does grep function do? I expected the funct

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread javad bayat
Dear all; I used these codes and I get what I wanted. Sincerely pat = c("Level 12","Level 22","0") data3 = data2[-which(data2$Layer == pat),] dim(data2) [1] 281549 9 dim(data3) [1] 244075 9 On Tue, Jun 13, 2023 at 11:36 AM Eric Berger wrote: > Hi Javed, > grep returns the positions of

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Eric Berger
Hi Javed, grep returns the positions of the matches. See an example below. > v <- c("abc", "bcd", "def") > v [1] "abc" "bcd" "def" > grep("cd",v) [1] 2 > w <- v[-grep("cd",v)] > w [1] "abc" "def" > On Tue, Jun 13, 2023 at 8:50 AM javad bayat wrote: > > Dear Rui; > Hi. I used your codes, but it