[R] quick help needed: split a number and "find and replace" type of function that works like in MS excel

2011-05-01 Thread Ram H. Sharma
Hi R experts I have a couple of quick question: Q1 #my data set.seed(12341) SN <- 1:100 pool<- c(12,13,14, 23, 24, 34) CT1<- sample(pool, 100, replace= TRUE) set.seed(1242) CT2 <- sample(pool, 100, replace= TRUE) set.seed(142) CT3 <- sample(pool, 100, replace= TRUE) # the number of variables r

Re: [R] quick help needed: split a number and "find and replace" type of function that works like in MS excel

2011-05-01 Thread Ram H. Sharma
t; There are a couple of ways to do what you want. > > I'll provide the fodder and let you finish the implementation. > > On Sun, May 1, 2011 at 4:26 PM, Ram H. Sharma > wrote: > > Hi R experts > > > > I have a couple of quick question: > > >

[R] pls help: lattice graph with both negative and positive value, x and y cross at 0 and negative value bars are plotted just oppositive direction in contrast to positive

2011-05-15 Thread Ram H. Sharma
Dear R experts: Here is my problem: #Data 1 Y <- c(0.5, 0.1, 0.5, 1.3, 1.4, 1.6, 1.65, 2.4, 2.6, 3.4, 3.6, 4.3, 4.42, 4.8, 4.7, 3.4, 3.3, 2.8, 2.8, 1.2, 1.1, 0.5, 0.2, 0.1, -0.2, -1.5, -2.5, -1.3, -0.5, -0.1) X <- seq(1:30) X1 <- c(rep("T1", 24), rep("T2", 6)) dat1 <- data.frame(Y, X, X1)

[R] lme in loop help

2011-02-25 Thread Ram H. Sharma
Dear R users I am new R user, execuse me I bother you, but I worked hard to find a solution: # data ID <- c(1:100) set.seed(21) y <- rnorm(100, 10,2) x1 <- rnorm(100, 10,2) x2 <- rnorm(100, 10,2) x3 <- rnorm(100, 10,2) x4 <- rnorm(100, 10,2) x5 <- rnorm(100, 10,2) x6 <- rnorm(100, 10,2) mydf <- d

[R] replace with quantile value for a large data frame...

2011-03-13 Thread Ram H. Sharma
Dear R-Experts I am sure this might look simple question for experts, at least is problem for me. I have a large data frame with over 1000 variables and each have different distribution( i.e. have different quantile). I want to create a new grouped data frame, where the new variables where the val

[R] help please: put output into dataframe

2011-03-17 Thread Ram H. Sharma
Dear R community members I have been struggling on this simple question, but never get appropriate solution. So please help. # my data, though I have a large number of variables var1 <- rnorm(500, 10,4) var2 <- rnorm(500, 20, 8) var3 <- rnorm(500, 30, 18) var4 <- rnorm(500, 40, 20) datafr1 <- da

Re: [R] help please: put output into dataframe

2011-03-18 Thread Ram H. Sharma
-3.736066 -3.471752 > [2,] 17.37176 34.929800 62.969733 80.224799 > > apply(datafr1, 2, range) > var1 var2 var3 var4 > [1,] -2.668841 -10.23848 -22.13500 -22.93678 > [2,] 21.803714 40.48186 87.02953 91.92733 > > Assuming you wanted to do this columnwise

Re: [R] help please: put output into dataframe

2011-03-18 Thread Ram H. Sharma
n each element and it is also in a form that you can easily > process it to create whatever other output you might need. > > On Fri, Mar 18, 2011 at 7:24 AM, Ram H. Sharma > wrote: > > Hi Dennis and R-users > > > > Thank you for more help. I am pretty close, but challeng

Re: [R] help please: put output into dataframe

2011-03-18 Thread Ram H. Sharma
in each element and it is also in a form that you can easily > process it to create whatever other output you might need. > > On Fri, Mar 18, 2011 at 7:24 AM, Ram H. Sharma > wrote: > > Hi Dennis and R-users > > > > Thank you for more help. I am pretty close, but chal

[R] problem in simple saving and loading data frames

2011-03-28 Thread Ram H. Sharma
Dear all My dataframe has > 80,000 variables which I can not everytime load into R using *.txt files (read.table option), cost me time and sometime computer decomes not responsive. So I need a way to save my dataframe in my workdirectory as such. Execuse me if the problem is too simple. I tried t

Re: [R] problem in simple saving and loading data frames

2011-03-28 Thread Ram H. Sharma
Thank you David and Dennis On Mon, Mar 28, 2011 at 3:43 PM, David Winsemius wrote: > > On Mar 28, 2011, at 11:20 AM, Ram H. Sharma wrote: > > Dear all >> >> My dataframe has > 80,000 variables which I can not everytime load into R >> using *.txt files (rea

[R] reading from text file that have different rowlength and create a data frame

2011-04-04 Thread Ram H. Sharma
Hi R-experts I have many text files to read and combined them into one into R that are output from other programs. My textfile have unbalanced number of rows for example: ;this is example ; r help Var1 Var2 Var3 Var4 Var5 0 0.05 0.0112 1 0.04

[R] loop and sapply problem, help need

2011-04-09 Thread Ram H. Sharma
Dear R experts Sorry for this question M1 <- 1:10 lcd1 <- c(11, 22, 33, 44, 11, 22, 33, 33, 22, 11) lcd2 <- c(22, 11, 44, 11, 33, 11, 22, 22, 11, 22) lcd3 <- c(12, 12, 34, 14, 13, 12, 23, 23, 12, 12) #generating variables through sampling pvec <- c("PR1", "PR2", "PR3", "PR4", "PR5", "PR6", "PR7

Re: [R] loop and sapply problem, help need

2011-04-09 Thread Ram H. Sharma
e(smpool,1),]) > > but I can't be sure. >- Phil Spector > Statistical Computing Facility > Department of Statistics > UC Berkeley >

[R] model specification: help needed

2011-04-11 Thread Ram H. Sharma
Hi R experts: I am new to mixed model commodity. I am tryping to specify a model using lmer in lme4 package. I am not sure if I am doing right, so I need your helpplease.. Treatment / factor structure Year: level 1:3, the whole the experiment was repeated in three years, random fact

[R] split string into individual valus while reading in R

2011-04-12 Thread Ram H. Sharma
Dear R experts Sorry for posting: I have text file that I need to read into R (this is out from different program). A portion of data look like: ;example data 1_1 ch1 0.0 HAAAHHAAAHHAHHAHHAHAHHHAAHHAHHAAAHHAHHAAHAHHHAAAHHHAAAHHAHHHAAAAHHAAHHAHAAAHAHHAAHAAHAA

Re: [R] split string into individual valus while reading in R

2011-04-13 Thread Ram H. Sharma
Sorry NULL in V8 should be corrected as NA On Wed, Apr 13, 2011 at 7:33 AM, Ram H. Sharma wrote: > It looks like my question is not clear, I have not get any suggestion, yet > let me reiterate my problem: > > My data looks like this to be read from a text file. As I provided earlie

Re: [R] split string into individual valus while reading in R

2011-04-13 Thread Ram H. Sharma
AAA Any trick to do this? Thanks; Ram H On Tue, Apr 12, 2011 at 5:19 PM, Ram H. Sharma wrote: > Dear R experts > > Sorry for posting: > I have text file that I need to read into R (this is out from different > program). A portion of data look like: &g

[R] extract p-value from mixed model in kinship package

2011-04-13 Thread Ram H. Sharma
Dear R experts I was using kinship package to fit mixed model with kinship matrix. The package looks like lme4, but I could find a way to extract p-value out of it. I need to extract is as I need to analyse large number of variables (> 1). Please help me: require(kinship) Generating random

[R] no solution yet, please help: extract p-value from mixed model in kinship package

2011-04-15 Thread Ram H. Sharma
I am making the question clear. Please help. > Dear R experts > > I was using kinship package to fit mixed model with kinship matrix. > The package looks like lme4, but I could find a way to extract p-value > out of it. I need to extract is as I need to analyse large number of > variables (> 10

[R] -log10 of 0

2011-08-28 Thread Ram H. Sharma
Dear R users: Sorry for this simple question: I am writing a function where I would need to pickup p values and make -log10 of it. The p values are from an anova output and sometime it can yield me 0. -log10 (0) [1] Inf I can not replace Inf with 0, which not case here. This is restricting

Re: [R] -log10 of 0

2011-08-28 Thread Ram H. Sharma
Thank you Ted and David for prompt reply. I can accept Inf but can not use for plotting, which I intend to do. May be I can add 1/(10^308), so that if something comes to 0 will be in -log10 scale be 308. Ram H On Sun, Aug 28, 2011 at 12:12 PM, Ted Harding wrote: > On 28-Aug-11 15:37:06, Ra

[R] generate correlated qualitative data

2011-08-31 Thread Ram H. Sharma
Dear R experts: I have following problem: # myfunction mfun1 <- function(x) { if ( x == 2){ xv <- sample(c(2,1,0),100, replace = T, prob = c(0.6, 0.2, 0.2)) } if ( x == 1){ xv <- sample(c(1,0),100, replace = T, prob = c(0.6, 0.4)) } if ( x == 0) { xv <- sample(c(0,0),100, replace = T, pro

[R] UNSOLVED: Fwd: generate correlated qualitative data

2011-08-31 Thread Ram H. Sharma
The problem remain unsolved. If you have any idea please do suggest thank you; Ram H On Wed, Aug 31, 2011 at 12:06 PM, Ram H. Sharma wrote: > Dear R experts: > > I have following problem: > > # myfunction > mfun1 <- function(x) { >if ( x == 2)

[R] output and save multiple dataset from a function: sorry I could not figure out this....

2011-09-04 Thread Ram H. Sharma
Dear list: Before going into my problem, R list has been awesome for me ...thank you for the help. I have a simple problem, however I could get a answer to it... #my data myseed <- c(1001:1030) gend <- function(x){ set.seed(x) var <- rep(1:4, c(rep(4, 4))) vary <- rnorm(length(var), 50, 10) mat

[R] Rgraphviz installation problem

2011-07-25 Thread Ram H. Sharma
Dear experts I installed Rgraphviz with the following command: source("http://www.bioconductor.org/biocLite.R";) biocLite("Rgraphviz") But had a problem when I tried to load it. This says that libcdt-4.dll is missing in your computer and the following message in R window: > library("Rgr

[R] Fwd: Rgraphviz installation problem

2011-07-25 Thread Ram H. Sharma
ted once you've installed graphviz and before installing Rgraphviz" -- Forwarded message -- From: Martin Morgan Date: Mon, Jul 25, 2011 at 9:25 AM Subject: Re: [R] Rgraphviz installation problem To: "Ram H. Sharma" Cc: r-help@r-project.org On 07/25/2011 06:05 AM, R

Re: [R] Fwd: Rgraphviz installation problem

2011-07-25 Thread Ram H. Sharma
Hi Martin Thank you for help, that helped me to come out the problem ! On Mon, Jul 25, 2011 at 11:46 AM, Martin Morgan wrote: > On 07/25/2011 07:58 AM, Ram H. Sharma wrote: > >> Hi All >> >> How can I adjust this path. My current path of Graphviz installation is: >

[R] lattice overlay

2011-07-27 Thread Ram H. Sharma
Dear experts: I want to overlay lattice scatter plot: I do not know why the following code is not plotting subscripts ! Sorry if this question is too simple: require(lattice) xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris, panel= function(x, y, subscripts) { panel.xyplot(x, y, pch=

[R] not working yet: Re: lattice overlay

2011-07-28 Thread Ram H. Sharma
;red", ylim= c(0,10) ) panel.lmline(iris$Petal.Length [subscripts], iris$Petal.Width [subscripts], col = "red") }, as.table=T, subscripts=T) Help please: From: Dieter Menne > Date: Wed, Jul 27, 2011 at 8:44 AM > Subject: Re: [R] lattice overlay > To: r-help@r-project.o