Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Bert Gunter
I believe this is unnecessarily complicated. What the OP did not seem to get is that he had to specify the col's and pch's in the panel function that were actually used via appropriate subscripting. He just passed in the whole col and pch vector by default -- subscripting is not done unless specifi

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Richard M. Heiberger
conditions look better as factors (their values are displayed in the strip label). groups should be a factor to get the uniqueness over panels. To use two factors together for groups, take their interaction. col and pch should be integers xyplot(mpg ~ wt | factor(cyl), data=mtcars, groups

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Peter Langfelder
Glad to be of help. Peter On Tue, Apr 9, 2019 at 10:03 PM Matthew Snyder wrote: > You are not late to the party. And you solved it! > > Thank you very much. You just made my PhD a little closer to reality! > > Matt > > > > *Matthew R. Snyder* > *~* > PhD Candidate > University F

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Matthew Snyder
You are not late to the party. And you solved it! Thank you very much. You just made my PhD a little closer to reality! Matt *Matthew R. Snyder* *~* PhD Candidate University Fellow University of Toledo Computational biologist, ecologist, and bioinformatician Sponsored Guest Res

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Peter Langfelder
Sorry for being late to the party, but has anyone suggested a minor but important modification of the code from stack exchange? xyplot(mpg ~ wt | cyl, panel = function(x, y, ..., groups, subscripts) { pch <- mypch[factor(carb)[subscripts]] col <- mycol[factor(

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Matthew Snyder
I tried this too: xyplot(mpg ~ wt | cyl, data=mtcars, # groups = carb, subscripts = TRUE, col = as.factor(mtcars$gear), pch = as.factor(mtcars$carb) ) Same problem... *Matthew R. Snyder* *~* PhD Candidate University Fellow University of Toledo Computa

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Matthew Snyder
I want to have one column in a dataframe define the color and another define the pch. This can be done easily with a single panel: xyplot(mpg ~ wt, data=mtcars, col = mtcars$gear, pch = mtcars$carb ) This produces the expected result: two pch that are the same color are uniq

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Bert Gunter
1. I am quite sure that whatever it is that you want to do can be done. Probably straightforwardly. The various R graphics systems are mature and extensive. 2. But I, for one, do not understand from your post what it is that you want to do. Nor does anyone else apparently. Cheers, Bert Gunter

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Jeff Newmiller
Maybe you should use factors rather than character columns. On April 9, 2019 8:09:43 PM PDT, Matthew Snyder wrote: >Thanks, Jim. > >I appreciate your contributed answer, but neither of those make the >desired >plot either. I'm actually kind of shocked this isn't an easier more >straightforward th

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Matthew Snyder
Thanks, Jim. I appreciate your contributed answer, but neither of those make the desired plot either. I'm actually kind of shocked this isn't an easier more straightforward thing. It seems like this would be something that a user would want to do frequently. I can actually do this for single plots

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Jim Lemon
Hi Matthew, How about this? library(lattice) xyplot(mpg ~ wt | cyl, data=mtcars, col = mtcars$gear, pch = mtcars$carb ) library(plotrix) grange<-range(mtcars$gear) xyplot(mpg ~ wt | cyl, data=mtcars, col = color.scale(mtcars$gear,extremes=c("blue","red"),xrange=g

Re: [R] Can one perform a dry run of a package installation?

2019-04-09 Thread Duncan Murdoch
On 09/04/2019 5:46 p.m., Sebastien Bihorel wrote: Hi, Is there a way to do a dry run of install.packages() or update.packages() to simulate how an R environment would be modified by the installation or update of a particular set of packages (with their dependencies)? I am particularly interes

[R] Can one perform a dry run of a package installation?

2019-04-09 Thread Sebastien Bihorel
Hi, Is there a way to do a dry run of install.packages() or update.packages() to simulate how an R environment would be modified by the installation or update of a particular set of packages (with their dependencies)? I am particularly interested in finding how dependencies would be recursivel

[R] Define pch and color based on two different columns

2019-04-09 Thread Matthew Snyder
I am making a lattice plot and I would like to use the value in one column to define the pch and another column to define color of points. Something like: xyplot(mpg ~ wt | cyl, data=mtcars, col = gear, pch = carb ) There are unique pch points in the second and third panels,

Re: [R] Create a sequence

2019-04-09 Thread Eric Berger
And just for fun, yet another way > cumsum((1:200)*c(1,-1)) On Tue, Apr 9, 2019 at 9:51 PM David L Carlson wrote: > Here's another approach: > > > x <- c(rbind(1:100, -(1:100))) > > head(x); tail(x) > [1] 1 -1 2 -2 3 -3 > [1] 98 -98 99 -99 100 -100 > > ---

Re: [R] Create a sequence

2019-04-09 Thread David L Carlson
Here's another approach: > x <- c(rbind(1:100, -(1:100))) > head(x); tail(x) [1] 1 -1 2 -2 3 -3 [1] 98 -98 99 -99 100 -100 David L Carlson Department of Anthropology Texas A&M University College Station, TX 77843-4352 -Original Message-

[R] [R-pkgs] New package to query the OpenTripPlanner (OTP) API

2019-04-09 Thread Young M . A .
Dear all A new R package 'otpr' is now available on CRAN. It's a wrapper for the OpenTripPlanner (OTP) API and is primarily aimed at researchers and transport planners who want to use OTP to carry out accessibility studies or generate variables for transport models. The package consists of four

Re: [R] Convert a character to numeric

2019-04-09 Thread Boris Steipe
As there are many possible sources of the warning, to "sort it out" try something like which( is.na() & (! is.na())) B. > On 2019-04-09, at 11:02, Richard M. Heiberger wrote: > > My guess is that numbers formatted with commas are causing an unwanted > coercion. > Remove the commas with

Re: [R] Convert a character to numeric

2019-04-09 Thread Richard M. Heiberger
My guess is that numbers formatted with commas are causing an unwanted coercion. Remove the commas with gsub before converting to numeric. > as.numeric(NA) [1] NA > as.numeric("1,234,567") [1] NA Warning message: NAs introduced by coercion > as.numeric(gsub(",", "", "1,234,567")) [1] 1234567 > On

Re: [R] How can I solve this prediction problem?

2019-04-09 Thread Bert Gunter
This looks like homework, and there is a no homework policy on this list. 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 Tue, Apr 9, 2019 at 5:51 AM Coder 634

Re: [R] Convert a character to numeric

2019-04-09 Thread Alfredo Cortell
Hi Bienvenue, I believe that your problem is that R can't translate "one" to a number, because it is not a number. R could translate to numeric for example this vector, where numbers are expressed as strings, c("1","4","7") but "one" is just letters put together, therefore R can't understand the

Re: [R] Create a sequence

2019-04-09 Thread Marc Schwartz via R-help
> On Apr 9, 2019, at 9:07 AM, bienvenidoz...@gmail.com wrote: > > how to create > u = (1, −1, 2, −2, . . . , 100, −100) in r > > Thanks > Bienvenue Hi, See ?seq and ?rep > rep(seq(100), each = 2) * c(1, -1) [1]1 -12 -23 -34 -45 -56 -67 [14] -7

[R] Create a sequence

2019-04-09 Thread bienvenidoz...@gmail.com
how to create u = (1, −1, 2, −2, . . . , 100, −100)  in r Thanks Bienvenue [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Convert a character to numeric

2019-04-09 Thread Duncan Murdoch
On 09/04/2019 7:30 a.m., Jim Lemon wrote: Hi Bienvenue, Perhaps you should ask whether you really want to "sort it out". The warning is telling you that you are converting the NA values to NA in the returned numeric vector. I don't think that's what it is saying. I think it is saying that a n

[R] How can I solve this prediction problem?

2019-04-09 Thread Coder 634
Hi, I'm new at R programming and I need help to solve this problem. The objective is to predict the change of the value of the Close variable: D(t) =Close(t) – Close(t-1) for a given day t, using the known data until t-1 to generate the prediction model. We can use univariate and multivariate mo

Re: [R] Convert a character to numeric

2019-04-09 Thread Jim Lemon
Hi Bienvenue, Perhaps you should ask whether you really want to "sort it out". The warning is telling you that you are converting the NA values to NA in the returned numeric vector. I can't think of anything more sensible to do with NA values. You may also have character strings that cannot be conv

[R] Convert a character to numeric

2019-04-09 Thread bienvenidoz...@gmail.com
Hi,  I am applyin function as.numeric to a vector having many values as NA  and it is giving :  Warning message:  NAs introduced by coercion  Can anyone help me to know how to remove this warning and sor it out?  Thanks  Bienvenue [[alternative HTML version deleted]] ___

Re: [R] Greek characters in R studio

2019-04-09 Thread Ivan Krylov
On Mon, 8 Apr 2019 18:41:16 +0300 kostas zogopoulos wrote: > How do you read a csv file that contains greek characters as part of > the header (i.e. α, β etc) in R studio? Determine the character encoding used in the file (is it UTF-8, ISO8859-7 or something else?) and pass it as fileEncoding=".