Re: [R] need help to convert animal ID to a factor

2016-05-22 Thread Jeff Newmiller
I am not familiar with any function called "toFactor". It may be part of some contributed package that you need to re-load. However, one does not ordinarily need to use a package to convert one column of a data frame into a factor, since factors are supported by base R. Eg MyDF$ID <- factor(

Re: [R] need help to convert animal ID to a factor

2016-05-22 Thread David Winsemius
> On May 22, 2016, at 9:46 PM, Neny Sitorus wrote: > > Hi, > > I was trying to convert my animal ID experiment (ID) to factor to get the > ggboxplot, previously it was working well. > But since yesterday it displayed "Error" every time I tried to re-run it. > Could you help me in this issue? >

[R] need help to convert animal ID to a factor

2016-05-22 Thread Neny Sitorus
Hi, I was trying to convert my animal ID experiment (ID) to factor to get the ggboxplot, previously it was working well. But since yesterday it displayed "Error" every time I tried to re-run it. Could you help me in this issue? # convert rat ID to factor Leak.df <- toFactor(Leak.df, id.var=c("ID

Re: [R] Element-by-element operation (adding)

2016-05-22 Thread Peter Langfelder
Two solutions... v + matrix(b, nrow(v), ncol(v), byrow = TRUE) or t(apply(v, 1, `+`, b)) Peter On Sun, May 22, 2016 at 10:39 PM, Steven Yen wrote: > Hi all, need help below. Thank you. > > > # Matrix v is 5 x 3 > > # Vector b is of length 3 > > # I like to add b[1] to all element in v[,1]

[R] Element-by-element operation (adding)

2016-05-22 Thread Steven Yen
Hi all, need help below. Thank you. > # Matrix v is 5 x 3 > # Vector b is of length 3 > # I like to add b[1] to all element in v[,1] > # I like to add b[2] to all element in v[,2] > # I like to add b[3] to all element in v[,3] > # as follows > v<-matrix(0,nrow=5,ncol=3); v [,1] [,2] [

Re: [R] need help to work with Boolnet package

2016-05-22 Thread Jim Lemon
Okay, perhaps if you try this: cellcontrol<- loadNetwork("C:/Users/mohammad/Documents/cellcontrol.txt") stateTransition(cellcontrol, rep(1,11)) Obviously this is a guess, but it might help. Jim On Mon, May 23, 2016 at 1:55 PM, mohammad alsharaiah wrote: > Hi jim , > first of all iwant to tha

Re: [R] need help to work with Boolnet package

2016-05-22 Thread Jim Lemon
Hi Mohammad, I don't have the BoolNet package installed, but the error means that the object "cellcontrol" is not there for the function to use. It should be a network "generated by generateRandomNKNetwork, or reconstructed by reconstructNetwork" as detailed in the help pages. Jim On Mon, May 23

[R] need help to work with Boolnet package

2016-05-22 Thread mohammad alsharaiah
Hi, every one , im using Boolnet package inside R environment to create a boolean network. after i create a text file for the Boolean network and i loaded it by using R by using this command: > library(BoolNet) > loadNetwork("C:/Users/mohammad/Documents/cellcontrol.txt") then its loaded ins

[R] mgcv::gam(): NA parametric coefficient in a model with two categorical variables + model interpretation

2016-05-22 Thread Fotis Fotiadis
Hallo all I am using a gam model for my data. m2.4<-bam(acc~ 1 + igc + s(ctrial, by=igc) + shape + s(ctrial, by=shape) + s(ctrial, sbj, bs = "fs", m = 1) , data=data, family=binomial) igc codes condition and there are four levels (CAT.pseudo, CAT.ideo,PA.pseudo, PA.ideo), and shape is a factor (

Re: [R] Element-by-element multiplication

2016-05-22 Thread Jeff Newmiller
outer( p, a ) -- Sent from my phone. Please excuse my brevity. On May 22, 2016 3:34:31 PM PDT, Jim Lemon wrote: >Hi Steven, > >as.data.frame(sapply(a,"*",p)) > >Jim > > >On Mon, May 23, 2016 at 8:22 AM, Steven Yen wrote: >> Dear R users: >> >> > # p is a vector if length 10 >> > # a is a vect

Re: [R] Element-by-element multiplication

2016-05-22 Thread Jim Lemon
Hi Steven, as.data.frame(sapply(a,"*",p)) Jim On Mon, May 23, 2016 at 8:22 AM, Steven Yen wrote: > Dear R users: > > > # p is a vector if length 10 > > # a is a vector if length 3 > > # I like to create a matrix with > > # the first column being p multiplied by a[1] > > # the second colu

[R] Element-by-element multiplication

2016-05-22 Thread Steven Yen
Dear R users: > # p is a vector if length 10 > # a is a vector if length 3 > # I like to create a matrix with > # the first column being p multiplied by a[1] > # the second column being p multiplied by a[2] > # the third column being p multiplied by a[3] > # The following would do that:

Re: [R] if else condition - help

2016-05-22 Thread jim holtman
if you want to use 'ifelse', here is a way: > k = + structure(c(0.0990217544905328, 1.60623837694539, -0.104331330281166, + -2.91485614212114, -0.108388742328104, -1.41670341534772, -1.70609114096417, + 2.92018951284015, 0.201868946570178, 0.907637296638577, -0.403004972105994, + -2.4771801580322

Re: [R] Merging 2 files with different timestamp

2016-05-22 Thread David Winsemius
> On May 22, 2016, at 9:40 AM, Bhaskar Mitra wrote: > > Hello, I am trying to merge two text files by using the timestamp > header for both the files: > > The first file has the following format for the timestamp:"2012-01-01 > 23:30:00 UTC" > > Timestamp for the second file : 2012-01-01 2330.

Re: [R] Merging 2 files with different timestamp

2016-05-22 Thread jim holtman
Is this the format of a column within the two different files? If they are columns, here is a way of converting to a common format for merging: > # convert to POSIXct > date1 <- as.POSIXct("27-Dec-12 23H 30M 0S", format = "%d-%b-%y %HH %MM %SS") > date2 <- as.POSIXct('2012-12-27 2330', format =

Re: [R] Merging 2 files with different timestamp

2016-05-22 Thread Jeff Newmiller
What time zone are these data in? Does daylight savings adjustment apply? -- Sent from my phone. Please excuse my brevity. On May 22, 2016 9:48:08 AM PDT, Bhaskar Mitra wrote: >Hello, > >My apologies for the earlier posting. There was an error with regard to >my >query : > > >I am trying to mer

Re: [R] if else condition - help

2016-05-22 Thread Dylan Keenan
Try this: > sign(ifelse(abs(k)<=1.5, 0, k)) C1 C2 C3 C4 A 0 0 0 0 B 1 0 0 0 C 0 -1 0 0 D -1 1 -1 -1 On Sun, May 22, 2016 at 2:00 PM Adrian Johnson wrote: > Hi group: > I am having difficulty with if else condition. I kindly request some help. > > I have a matrix k > > > k >

[R] Merging 2 files with different timestamp

2016-05-22 Thread Bhaskar Mitra
Hello, I am trying to merge two text files by using the timestamp header for both the files: The first file has the following format for the timestamp:"2012-01-01 23:30:00 UTC" Timestamp for the second file : 2012-01-01 2330. I am having problems by converting from one timestamp format to anothe

Re: [R] Merging 2 files with different timestamp

2016-05-22 Thread Bhaskar Mitra
Hello, My apologies for the earlier posting. There was an error with regard to my query : I am trying to merge two text files by using the timestamp header for both the files: The first file has the following format for the timestamp:"27-Dec-12 23H 30M 0S" Timestamp for the second file : 2012-

Re: [R] if else condition - help

2016-05-22 Thread David Winsemius
> On May 22, 2016, at 11:23 AM, Adrian Johnson > wrote: > > Thank you both Dylan and Wray. > > since my matrix is quite large and for simplicity in downstream > operation, i will use sign function. thanks a lot. > > On Sun, May 22, 2016 at 2:12 PM, Dylan Keenan wrote: >> Try this: >> >>> si

Re: [R] if else condition - help

2016-05-22 Thread Adrian Johnson
Thank you both Dylan and Wray. since my matrix is quite large and for simplicity in downstream operation, i will use sign function. thanks a lot. On Sun, May 22, 2016 at 2:12 PM, Dylan Keenan wrote: > Try this: > >> sign(ifelse(abs(k)<=1.5, 0, k)) > > > C1 C2 C3 C4 > A 0 0 0 0 > B 1 0 0

Re: [R] Plots for lmrob function

2016-05-22 Thread varin sacha via R-help
Perfect, many thanks Best S De : David Winsemius À : varin sacha Cc : R-help Mailing List Envoyé le : Vendredi 20 mai 2016 21h13 Objet : Re: [R] Plots for lmrob function > On May 20, 2016, at 8:28 AM, varin sacha via R-help > wrote: > > Dear R-helpers, > > I have fitted a ro

Re: [R] if else condition - help

2016-05-22 Thread WRAY NICHOLAS
Hi Adrian I'm not sure that you need to use the ifelse here. You can simply assign values ina vector or matrix using a simple condition -- here is a simple example: v<-c(4,5,6,7) v1<-v v1[]<-0 v1[v<5]<--1 v1[v>6]<-1 v1 Nick > > On 22 May 2016 at 18:58 Adrian Johnson wrote: > > > Hi

[R] if else condition - help

2016-05-22 Thread Adrian Johnson
Hi group: I am having difficulty with if else condition. I kindly request some help. I have a matrix k > k C1 C2 C3 C4 A 0.09902175 -0.1083887 0.2018689 -0.3546167 B 1.60623838 -1.4167034 0.9076373 -0.3161138 C -0.10433133 -1.7060911 -0.4030050 1.0153297 D

Re: [R] R vs SPSS - simple effects analysis in mixed 2x2 ANOVA scheme - same data, different results

2016-05-22 Thread Michael Dewey
The only people who will be able to help you are people who use both R and SPSS as you do not show the result from either. So even though they can re-run your R commands they cannot compare them with SPSS. On 22/05/2016 09:49, Michu Kom wrote: down votefavoriteHell

[R] R vs SPSS - simple effects analysis in mixed 2x2 ANOVA scheme - same data, different results

2016-05-22 Thread Michu Kom
down votefavoriteHell Hello, I prepared a mixed 2x2 ANOVA design analysis both in SPSS and in R. The SPSS script is correct, but in R script there is a mistake somewhere.

Re: [R] Choosing rows

2016-05-22 Thread ruipbarradas
Hello, First of all, it's better to post data using ?dput. Below, I give an example of that  in the lines structure(...). dat <- structure(list(rs = c("   rs941873  ", "   rs634552  ", "   rs11107175  ", "   rs12307687  ", "   rs3917155  ", "   rs1600640  ", "   rs2871865  ", "   rs2955250  ", "