Re: [R] Subsetting dataframe by the nearest values of a vector elements

2015-11-09 Thread David Winsemius
> On Nov 9, 2015, at 9:19 AM, Adams, Jean wrote: > > Harun, > > Can you give a simple example? > > If your cross_section looked like this > c(144, 179, 214, 39, 284, 109, 74, 4, 249) > and your other vector looked like this > c(0, 50, 100, 150, 200, 250, 300, 350) > what would you want your su

Re: [R] Prefix

2015-11-09 Thread Val
HI Dennis and David Thank you very much! I really appreciate that. Now I am half way from my final goal. At the end what I would like is the following output. New_X1 New_X2 New_X3 Old X1 1 0 0 0_Abbot 2 0 0 1920_

Re: [R] calculate factor scores

2015-11-09 Thread David L Carlson
I think you can use predict.psych() in package psych. Since you analyzed a correlation matrix with fa() it does not have access to the original data. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Origin

Re: [R] Subsetting dataframe by the nearest values of a vector elements

2015-11-09 Thread jim holtman
Do you want the "closest" or what range it is in? If you want the range, then use 'cut': > x <- c(144, 179, 214, 39, 284, 109, 74, 4, 249) > range <- c(0, 50, 100, 150, 200, 250, 300, 350) > result <- cut(x, breaks = range) > cbind(x, as.character(result)) x [1,] "144" "(100,150]" [2,] "1

Re: [R] Subsetting dataframe by the nearest values of a vector elements

2015-11-09 Thread Adams, Jean
Harun, Can you give a simple example? If your cross_section looked like this c(144, 179, 214, 39, 284, 109, 74, 4, 249) and your other vector looked like this c(0, 50, 100, 150, 200, 250, 300, 350) what would you want your subset to look like? Jean On Mon, Nov 9, 2015 at 7:26 AM, Harun Rashid v

Re: [R] [GGplot] Geom_smooth with formula "power"?

2015-11-09 Thread Catarina Silva
I've tried others initial solutions and the adjustement was done to power model in ggplot - geom_smooth. But, with "nls" I can't do the confidence interval with ggplot - geom_smooth? I read that with "nls" we have to force "se=FALSE". Is this true? How can I draw confidence interval in the plot?

Re: [R] NULL dev.lis()

2015-11-09 Thread peter dalgaard
On 09 Nov 2015, at 11:10 , Pascal Oettli via R-help wrote: > Martin, > > Sorry, but what are you talking about ? Of course I know it is normal > to get this result. It is what I explained in my message! And Martin agreed/confirmed. Notice that "you" in English does not necessarily refer to y

[R] homals pre-upgrade

2015-11-09 Thread Jan Deleeuw
We are preparing an upgrade of the homals package on CRAN. The current non-packaged version of the code, with theory and examples, is at http://rpubs.com/deleeuw/87298. The new version implements principal component analysis, (multiset) canonical correlation analysis, multiple regression analy

[R] raster::cellFromXY behaviour

2015-11-09 Thread Jae Choi
Hi users of raster: When a point lands within a raster cell, the cell is correctly identified. But when a point lands on the border between two adjacent raster cells, cell identity seems to be inconsistent. We are wondering if this is an error? Example code follows to demonstrate our question:

[R] Subsetting dataframe by the nearest values of a vector elements

2015-11-09 Thread Harun Rashid via R-help
Hello, I have a dataset with two columns 1. cross_section (range: 0~635), and 2. elevation. The dataset has more than 100 rows. Now I want to make a subset on the condition that the 'cross_section' column will pick up the nearest cell from another vector (say 0, 50,100,150,200,.,650). How ca

[R] Plotting a glmmADMB model

2015-11-09 Thread Luiz Ernesto Costa Schmidt
Dear users, Thanks for your attention. I’m running a glmm model using the glmmadmb function provided in the package glmmADMB. My dependent variable is the number of individuals belonging to a single species of an aquatic insect, sampled throughout two non-consecutive years. The samples were clas

[R] calculate factor scores

2015-11-09 Thread David Studer
Hello everybody, I have a problem regarding factor analysis: As I am using the hetmat()-function from the polycor-package in order to calculate different kinds of correlation coefficients automatically* I cannot obtain factor scores using fit$scores. The problem is that I am using the fa()-functio

Re: [R] get maximum 3 rows by column elements in data frame

2015-11-09 Thread PIKAL Petr
Hi I am not completely sure what do you want, so here is my guess. > dat<-structure(list(Measure_id = c(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, > 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, > 5), i = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4,

Re: [R] get maximum 3 rows by column elements in data frame

2015-11-09 Thread jim holtman
It is not entirely clear what you are asking for. Can you provide a sample of the output that you want from the data. Here is the data split by Measure_id, but not sure what to do with it: > split(x, x$Measure_id) $`1` Measure_id i j value rank 1 1 2 1 1.5 0.750 6

[R] get maximum 3 rows by column elements in data frame

2015-11-09 Thread Ragia Ibrahim
Dear group, I have the following data freame dput(df_all_nodes) structure(list(Measure_id = c(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1,  2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2,  3, 4, 5, 1, 2, 3, 4, 5), i = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2,  2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 5, 5, 5, 5,

Re: [R] NULL dev.lis()

2015-11-09 Thread Pascal Oettli via R-help
Martin, Sorry, but what are you talking about ? Of course I know it is normal to get this result. It is what I explained in my message! Regards, Pascal On Mon, Nov 9, 2015 at 6:19 PM, Martin Maechler wrote: >> Pascal Oettli via R-help >> on Mon, 9 Nov 2015 14:18:37 +0900 writes: >

Re: [R] NULL dev.lis()

2015-11-09 Thread Martin Maechler
> Pascal Oettli via R-help > on Mon, 9 Nov 2015 14:18:37 +0900 writes: > Dear Tom, > Running R 3.2.2 on Ubuntu 15.04, if I run dev.list(), I get NULL. Yes, indeed with all "regular" / "default" versions of R. I you don't get that, you must have set something user-specific, o