Re: [R] What's box() (exactly) doing?

2016-06-23 Thread Jim Lemon
Hi Marius, There are a few things that are happening here. First, the plot area is not going to be the same as your x and y limits unless you say so: # run your first example par("usr") [1] -0.04 1.04 -0.04 1.04 # but plot(NA, type = "n", ann = FALSE, axes = FALSE, xlim = 0:1, ylim = 0:1,xaxs=

Re: [R] What's box() (exactly) doing?

2016-06-23 Thread David Winsemius
> On Jun 23, 2016, at 7:29 PM, Marius Hofert wrote: > > Hi, > > I would like to replicate the behavior of box() with rect() (don't ask why). > However, my rect()angles are always too small. I looked a bit into the > internal C_box but > couldn't figure out how to solve the problem. Below is a m

[R] What's box() (exactly) doing?

2016-06-23 Thread Marius Hofert
Hi, I would like to replicate the behavior of box() with rect() (don't ask why). However, my rect()angles are always too small. I looked a bit into the internal C_box but couldn't figure out how to solve the problem. Below is a minimal working (and a slightly bigger) example. Cheers, Marius ## M

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread Bert Gunter
... actually, FWIW, I would say that this little discussion mostly demonstrates why the OP's request is probably not a good idea in the first place. Usually, NA's should be left as NA's to be dealt with properly by R and packages. In biological measurements, for example, NA's often mean "below the

Re: [R] R help needed

2016-06-23 Thread Marc Schwartz
> On Jun 23, 2016, at 9:50 AM, Sana Fatima wrote: > > Hello everyone, > I am trying to create an shiny app that could be used for ~ 700 different > user names and passwords. Each username and password would lead to a > different set of data being pulled in, however the tabs and fields with in >

[R] R help needed

2016-06-23 Thread Sana Fatima
Hello everyone, I am trying to create an shiny app that could be used for ~ 700 different user names and passwords. Each username and password would lead to a different set of data being pulled in, however the tabs and fields with in the app will be the same. Just that different username would dis

[R] r_toolbox: Update

2016-06-23 Thread G . Maubach
Hi folks, I have updated the functions of the r_toolbox.R set of utilities: https://sourceforge.net/projects/r-project-utilities/files/?source=navbar Naming was changed with some functions to reflect similar functions in SAS or SPSS, e. g. t_n_miss, t_n_valid. In addition I added functions for

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread David L Carlson
Good point. I did not think about factors. Also your example raises another issue since column c is logical, but gets silently converted to numeric. This would seem to get the job done assuming the conversion is intended for numeric columns only: > test <- data.frame(a=c(1,NA,2), b = c("A","b",

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread Bert Gunter
Not in general, David: e.g. > test <- data.frame(a=c(1,NA,2), b = c("A","b",NA), c= rep(NA,3)) > is.na(test) a bc [1,] FALSE FALSE TRUE [2,] TRUE FALSE TRUE [3,] FALSE TRUE TRUE > test[is.na(test)] [1] NA NA NA NA NA > test[is.na(test)] <- 0 Warning message: In `[<-.factor`(

Re: [R] Saving .eps files with Times New Roman font

2016-06-23 Thread Yixuan Qiu
You may want to use the showtext package that converts fonts into curves in your graph. Below is the sample code: library(showtext) ## Load Times New Roman fonts on Windows font.add("times", regular = "times.ttf", bold = "timesbd.ttf") showtext.auto() setEPS() postscript("test.eps") par(family =

Re: [R] Saving .eps files with Times New Roman font

2016-06-23 Thread Jeff Newmiller
Not that I am an expert, but you should probably be using the direct approach rather than pointing and clicking. ?postscript ?cairo_ps -- Sent from my phone. Please excuse my brevity. On June 23, 2016 10:15:15 AM PDT, A A via R-help wrote: >In RGui, I'm running the following bit of code: >win

Re: [R] Saving .eps files with Times New Roman font

2016-06-23 Thread David Winsemius
> On Jun 23, 2016, at 10:15 AM, A A via R-help wrote: > > In RGui, I'm running the following bit of code: > windowsFonts(A=windowsFont("Times New Roman")) > plot(0,0, ylab='y axis', xlab='x axis',main='title',family="A") > The labels and title appear in Times New Roman font. So far, so good. >

[R] Saving .eps files with Times New Roman font

2016-06-23 Thread A A via R-help
In RGui, I'm running the following bit of code: windowsFonts(A=windowsFont("Times New Roman")) plot(0,0, ylab='y axis', xlab='x axis',main='title',family="A") The labels and title appear in Times New Roman font. So far, so good. However, when I right click the figure and select 'Save as postscript

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread David L Carlson
The function is.na() returns a matrix when applied to a data.frame so you can easily convert all the NAs to 0's: > ds_test var1 var2 1 11 2 22 3 33 4NA NA 5 55 6 66 7 77 8NA NA 9 99 10 10 10 > is.na(ds_test) var1 v

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread ruipbarradas
Hello, You could do ds_test[is.na(ds_test$var1), ] <- 0  # note the comma or, more generally, ds_test[] <- lapply(ds_test, function(x) {x[is.na(x)] <- 0; x}) Hope this helps, Rui Barradas   Citando g.maub...@weinwolf.de: > Hi All, > > I would like to recode my NAs to 0. Using a single vecto

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread Ivan Calandra
Thank you Bert for this clarification. It is indeed an important point. Ivan -- Ivan Calandra, PhD Scientific Mediator University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89 ivan.calan...@univ-reims.fr -- https://www.resea

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread Bert Gunter
Sorry, Ivan, your statement is incorrect: "When you use a single bracket on a list with only one argument in between, then R extracts "elements", i.e. columns in the case of a data.frame. This explains your errors. " e.g. > ex <- data.frame(a = 1:3, b = letters[1:3]) > a <- 1:3 > identical(ex[1

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread Ivan Calandra
My statement "Using a single bracket '[' on a data.frame does the same as for matrices: you need to specify rows and columns" was not correct. When you use a single bracket on a list with only one argument in between, then R extracts "elements", i.e. columns in the case of a data.frame. This

Re: [R] rgl and rglwidget: Weird behaviour than animating lines

2016-06-23 Thread Duncan Murdoch
On 23/06/2016 5:59 AM, Nicole Karakin wrote: I am trying to follow help and Internet examples to create a very simple animation of a 3d-line in R. This is just a test and my final goal is to use this functionality to visually verify results of some geometrical transformations on 3d-movement data

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread Ivan Calandra
Dear Georg, You need to learn a bit more about the subsetting methods, depending on the object structure you're trying to subset. More specifically, when you run this: ds_test[is.na(ds_test$var1)] you get this error: "Error in `[.data.frame`(ds_test, is.na(ds_test$var1)) : undefined columns s

Re: [R] Subscripting problem with is.na()

2016-06-23 Thread Ista Zahn
Suggestion: figure out the correct extraction syntax first. One you do that replacement will be easy. See ?Extract for all the messy details. Best, Ista On Jun 23, 2016 10:00 AM, wrote: > Hi All, > > I would like to recode my NAs to 0. Using a single vector everything is > fine. > > But if I us

Re: [R] import of data set and warning from R CMD check

2016-06-23 Thread Pascal A. Niklaus
Dear Thierry, Thanks, that indeed solved the warning. Still, I think the message from R CMD check is confusing since the hint seems not to work with the current R version. Pascal On 2016-06-21 11:31, Thierry Onkelinx wrote: Dear Pascal, You could try to use data(CO2, package = "datasets")

[R] rgl and rglwidget: Weird behaviour than animating lines

2016-06-23 Thread Nicole Karakin
I am trying to follow help and Internet examples to create a very simple animation of a 3d-line in R. This is just a test and my final goal is to use this functionality to visually verify results of some geometrical transformations on 3d-movement data that I am analysing. So basically I need nothin

[R] Subscripting problem with is.na()

2016-06-23 Thread G . Maubach
Hi All, I would like to recode my NAs to 0. Using a single vector everything is fine. But if I use a data.frame things go wrong: -- cut -- var1 <- c(1:3, NA, 5:7, NA, 9:10) var2 <- c(1:3, NA, 5:7, NA, 9:10) ds_test <- data.frame(var1, var2) test <- var1 test[is.na(test)] <- 0 test # NA rec

Re: [R] biplot

2016-06-23 Thread S Ellison
> Rather than doing them manually, > you might have better luck with ggbiplot, and the ggrepel package designed to > 'repel' point labels so they don't overlap. For base graphics, 'thigmophobe.lables' in the plotrix package also works to avoid label overlap. Steve E *

Re: [R] biplot

2016-06-23 Thread Michael Friendly
On 6/22/2016 8:39 AM, Shane Carey wrote: Hey, Does anyone know how to remove labels from a biplot? I want to input them manually as they are currently overlapping. Rather than doing them manually, you might have better luck with ggbiplot, and the ggrepel package designed to 'repel' point lab

Re: [R] Generate list if sequence form two vector element

2016-06-23 Thread PIKAL Petr
Hi what about mapply(":", a, b) Sometimes R can behave like a magic. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jim Lemon > Sent: Wednesday, June 22, 2016 10:01 AM > To: Mohammad Tanvir Ahamed > Cc: R-help Mailing List > Subjec