[R] function

2009-10-26 Thread Val
Hi all, Is there a function in R that handle nonparametric model for survival analysis (Cox or Weibull)? Thanks a lot Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] sm.regression

2009-10-27 Thread Val
function sm.regression Thanks Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

[R] Reading data

2009-10-28 Thread Val
Error in file(file, r) : cannot open the connection In addition: Warning message: In file(file, r) : cannot open file 'Rossi': No such file or directory Rossi[1:5,1:10] Error: object 'Rossi' not found Thank you for your help in advance Val

Re: [R] Reading data

2009-10-28 Thread Val
The working directory is getwd() [1] C:/Documents and Settings/Val/My Documents The data file(Rossi.dat) and the script(Rossi.R) are in C:/Documents and Settings/Val/My Documents/R_data/prd How should I write to read the file? source(???) # what should be included here? Rossi

Re: [R] Reading data

2009-10-28 Thread Val
Val, please take it slow, you are missing basic stuff here. (1) Windows Explorer may hide extensions; the 'Type' column should read 'R file' anyway. * Yes I looked at it and it only shows type. To check I downloaded another script with R extension test.R and the type column shows

Re: [R] Reading data

2009-10-28 Thread Val
On Wed, Oct 28, 2009 at 11:59 AM, David Winsemius dwinsem...@comcast.netwrote: On Oct 28, 2009, at 11:46 AM, Val wrote: Val, please take it slow, you are missing basic stuff here. (1) Windows Explorer may hide extensions; the 'Type' column should read 'R file' anyway. * Yes I looked

Re: [R] Reading data

2009-10-28 Thread Val
On Wed, Oct 28, 2009 at 1:08 PM, David Winsemius dwinsem...@comcast.netwrote: On Oct 28, 2009, at 12:21 PM, Val wrote: On Wed, Oct 28, 2009 at 11:59 AM, David Winsemius dwinsem...@comcast.netwrote: On Oct 28, 2009, at 11:46 AM, Val wrote: Val, please take it slow, you are missing

[R] Frequency

2009-11-02 Thread Val
by their occurrence. Below is the output that I want 10=3 6=2 4=2 9=1 5=1 7=1 3=1 How do I do it in R? Thanks in advance Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

[R] Output

2009-11-04 Thread Val
Hi all, I fitted a model say with five xc-lm( y~x1,x2,x3,x4,x5) I want to plot the residuals for each factor and I used this, plot(xc,residuals=TRUE,se=TRUE,pch=.) I only get the plot of the last factor (i.e., x5). I think it is overwriting. How can I send the five plots into a file? I

[R] Models

2009-11-09 Thread Val
Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

[R] Missing and number of days

2009-11-26 Thread Val
Hi all, Assume that I have a data set (“xcv”) with several variables and some of the variables have a missing observation represented by -9 as shown below. I want to exclude these observations from the analysis ( as a NA). Is there a command that I can do it for the entire data set

[R] binary

2010-01-25 Thread Val
Hi all Assume I have a data set xx; Group: 1=group1  , 2=group2 IQ:  1= High, 0 =low fit - glm(IQ ~group, data = xx, family = binomial()) summary(fit) Results    Estimate Std. Error z value Pr(|z|) (Intercept) -2.55456    0.210 -12.273  5e-16 *** group  0.36180   

Re: [R] binary

2010-01-25 Thread Val
does the odd ratio 1.43359 is interpreted? in the group1 the IQ score increase by 1.43359 compared to group 2 On Mon, Jan 25, 2010 at 10:05 AM, Mohamed Lajnef mohamed.laj...@inserm.fr wrote: Hi val, Val a écrit : Hi all Assume I have a data set xx; Group: 1=group1  , 2=group2 IQ:  1

[R] Loop

2010-03-03 Thread Val
Hi all, Assume the following function that generate a random number. z1-function (n, eta) { wv - runif(n) wz - (-1/eta) * log(wv) wz } y - z1(100,4) mean(y) I want to run this function say 1000 times and I want to count if the mean(y) outside the following range 0.20

Re: [R] Loop

2010-03-03 Thread Val
Thank you Henrique, However, F1-sum(!findInterval(colMeans(replicate(100, z1(100, 4))), 0.2:0.3)) F2-sum(findInterval(colMeans(replicate(100, z1(100, 4))), 0.2:0.3)) the sum of the two (F1+F2) = number of replicates (in this case 100). Sometimes I do not get that sum. Do you know why? Val

[R] Renumbering

2010-03-28 Thread Val
is highly appreciated in Advance Val K [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] Renumbering

2010-03-28 Thread Val
,] 3 1 2 125 [4,] 4 1 0 126 [5,] 5 3 4 127 [6,] 6 0 5 128 [7,] 7 1 3 130 Thanks again Val On Sun, Mar 28, 2010 at 5:09 PM, jim holtman jholt...@gmail.com wrote

[R] Combing

2010-03-29 Thread Val
v3 1 0 0 -9 -9 -9 2 0 0 -9 -9 -9 3 1 2 2.5 3.4 302 4 1 0 8.6 2.9 317 5 3 2 9.7 4.0 325 6 5 4 7.5 1.9 296 Any help is highly appreciated in advance, Val [[alternative HTML version deleted]] __ R-help@r-project.org

[R] Bootstrap

2011-07-20 Thread Val
Hi all, I am facing difficulty on how to use bootstrap sampling and below is my example of function. Read a data , use some functions and use iteration to find the solution( ie, convergence is reached). I want to use bootstrap approach to do it several times (200 or 300 times) this whole

[R] Correlation

2011-03-23 Thread Val
Hi all, Assume I have a data set collected in a related family. dat - read.table(textConnection( Id Father Mother x y 1 0 0 15 26 2 0 0 18 14 3 1 2 12 25 4 0 2 15 30 5 1 0 19 28), header=TRUE) xx=dat$x yy=dat$y I want to analyze the

[R] matrix

2011-04-26 Thread Val
Hi all, Assume I have a matrix xv= [1 0 0 0 0 12, 0 1 0 0 0 10, *0 0 1 0 0 -9,* 0 0 0 1 0 20, * 0 0 0 0 1 -5]* if the last column of xv less than 0 then I want to set zero the entire row. The desired output looks like the following. In this case row 3 and row 5 are set

[R] Reading file

2011-04-27 Thread Val
, header = T) : incomplete final line found by readTableHeader on 'G:/test.xlsx' Did I miss something there? Your help is highly appreciated Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https

[R] if statement

2012-03-07 Thread Val
will be used x [1] 0 1 2 3 4 5 That command added 1 to each element. But I want like this 0 0 1 2 3 4 Can anybody help me? Thanks Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] if statement

2012-03-07 Thread Val
Now I got results as I wanted. Thank you all. On Wed, Mar 7, 2012 at 2:51 PM, AAsk aa2e...@lycos.co.uk wrote: x - -1:4 x0 # returns TRUE (1) or FALSE (0) [1] TRUE FALSE FALSE FALSE FALSE FALSE x+as.numeric(x0) [1] 0 0 1 2 3 4 __

[R] grouping

2012-04-03 Thread Val
anyone help me out? In SAS I used to do it using proc rank. thanks in advance Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] grouping

2012-04-03 Thread Val
that helps, Michael On Tue, Apr 3, 2012 at 8:47 AM, Val valkr...@gmail.com wrote: Hi all, Assume that I have the following 10 data points. x=c( 46, 125 , 36 ,193, 209, 78, 66, 242 , 297 , 45) sort x and get the following y= (36 , 45 , 46, 66, 78, 125,193, 209, 242, 297) I want

Re: [R] grouping

2012-04-03 Thread Val
which is not the default for cut() either (to my continued amazement). But let me add the method I use when doing it by hand: cut(x, quantile(x, prob=seq(0, 1, length=ngrps+1)), include.lowest=TRUE) -- David. Michael On Tue, Apr 3, 2012 at 9:31 AM, Val valkr...@gmail.com wrote: Thank

Re: [R] grouping

2012-04-03 Thread Val
$gxc it did not work for me. On Tue, Apr 3, 2012 at 10:15 AM, David Winsemius dwinsem...@comcast.netwrote: On Apr 3, 2012, at 10:11 AM, Val wrote: David W and all, Thank you very much for your help. Here is the final output that I want in the form of data frame. The data frame

Re: [R] grouping

2012-04-03 Thread Val
-0400, Val wrote: Hi All, On the same data points x=c(46, 125 , 36 ,193, 209, 78, 66, 242 , 297,45 ) I want to have have the following output as data frame x group group mean 46 142.3 125 289.6 36 142.3 193 3235.25

Re: [R] grouping

2012-04-03 Thread Val
On Tue, Apr 3, 2012 at 2:53 PM, Berend Hasselman b...@xs4all.nl wrote: On 03-04-2012, at 20:21, Val wrote: Hi All, On the same data points x=c(46, 125 , 36 ,193, 209, 78, 66, 242 , 297,45 ) I want to have have the following output as data frame x group group mean 46

[R] curve

2010-12-13 Thread Val
in advance Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self

[R] (no subject)

2011-12-15 Thread Val
standardized residuals too? Thanks Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

[R] Generate data - function

2012-01-31 Thread Val
Hi All, I want generate data using R that follows the shape of graphs (A and B) in the attached file. Can anybody suggest me what function fits for each graph? Your help is highly appreciated in advance Val graphs.pdf Description: Adobe PDF document

Re: [R] Generate data - function

2012-01-31 Thread Val
On Tue, Jan 31, 2012 at 11:09 AM, Petr Savicky savi...@cs.cas.cz wrote: On Tue, Jan 31, 2012 at 10:03:39AM -0500, Val wrote: Hi All, I want generate data using R that follows the shape of graphs (A and B) in the attached file. Can anybody suggest me what function fits for each graph? Hi

Re: [R] Generate data - function

2012-01-31 Thread Val
the definite integral equal to 1. Is this true? Yes Petr Savicky. On Tue, Jan 31, 2012 at 1:41 PM, Petr Savicky savi...@cs.cas.cz wrote: On Tue, Jan 31, 2012 at 12:40:35PM -0500, Val wrote: [...] What I want is, 1- let the plot star from 0.2 in Y-axis rather than the minimum value

Re: [R] Generate data - function

2012-01-31 Thread Val
for the derivative of the inverse function. The problem is that I am not high level programmer. Could you please help me out? Your help will be appreciated in advance On Tue, Jan 31, 2012 at 2:36 PM, Petr Savicky savi...@cs.cas.cz wrote: On Tue, Jan 31, 2012 at 01:59:13PM -0500, Val wrote: Hi petr

Re: [R] Generate data - function

2012-02-01 Thread Val
...@cs.cas.cz wrote: On Tue, Jan 31, 2012 at 01:59:13PM -0500, Val wrote: Hi petr, Can the required density be understood as a piecewise linear function going through 4 or 5 given points? That is my problem. The function should be nonlinear. However, we can break it down to the first 3 or 4

Re: [R] Generate data - function

2012-02-01 Thread Val
Hi Petr, Thank you very much . I will let you know my progress! Do you think that sampling from the traingular distribution will also be good enough? Will it provides similar results? Val On Wed, Feb 1, 2012 at 12:48 PM, Petr Savicky savi...@cs.cas.cz wrote: On Wed, Feb 01, 2012 at 11

[R] summary and plot

2013-10-10 Thread Val
Hi All, I have a huge data set with the following type; city year sex obs 1 1990 M 25 1 1990 F 32 1 1991 M 15 1 1991 F 22 2 1990 M 42 2 1990 F 36 2 1991 M 12 2 1991 F 16 I want to calculate the percentage of M and F by city, year and

[R] covar

2011-02-16 Thread Val
Hi all, I want to construct relatedness among individuals and have a look at the following script. # rm(list=ls()) N=5 id = c(1:N) dad = c(0,0,0,3,3) mom = c(0,0,2,1,1) sex = c(2,2,1,2,2) # 1= M and 2=F A=diag(nrow = N) for(i in 1:N){ for(j in i:N)

[R] Survreg

2012-04-21 Thread Val
2.07e-139 x2 -0.000211 5.64e-06 -37.47.89e-306 Log(scale)-0.267627 1.57e-02 -17.05.63e-65 Scale= 0.765 How do I interpret those results? Is there a relationship between Webull PH and AFT Model? Thanks Val [[alternative HTML version deleted

[R] (no subject)

2014-02-11 Thread Val
Hi all, I have a sample of data set with variables day, ID,var and month: day ID var Month 1 11 x March 1 11 x March 1 11 x April 1 11 y March 1 11 x March 1 11 y March 2 11 x March 2 11 y March 3 11 x March 3 11 y March 4 11 y March In the above data set there

[R] Reading multiple files from different folders

2015-08-12 Thread Val
Hi all, I have several files in different folders or subdirectories. Here is an example of the data set. c:\country\state\city. There might be more than 500 cities. ** c:\country\state\city1 c:\country\state\city2 . . . c:\country\state\city500

[R] Prefix

2015-11-08 Thread Val
HI all, DF <- read.table(textConnection(" X1 X2 X3 TIME Alex1 0 0 1960 Alexa 0 01920 Abbot 0 0 0 Smith Alex1 Alexa2012 Carla Alex1 01996 JackySmith Abbot2013 Jack 0 Jacky2014

[R] Decast

2015-11-13 Thread Val
Hi all, I have a data frame called "df" it's dimension is dim(df) [1] 9540634 38 >From this data frame the variable * df$X1 *has about 78, 000 unique values and *df$region *has two classes. I am trying to do the following operation The goal is reshaping the variable from long to

Re: [R] Prefix

2015-11-09 Thread Val
col[u] # substitute original names with those in refcol > v[is.na(v)] <- "0" # set NAs in v to "0" > v > } > > apply(DF[, grep("^X", names(DF))], 2, f) # grep() selects out > columns starting with "X" > > Dennis > >

[R] If else

2015-10-30 Thread Val
Hi all, Iam trying to change character to numeric but have probelm mydata <- read.table(header=TRUE, text=', sep=" " id sex 1 NA 2 NA 3 M 4 F 5 M 6 F 7 F ') if sex is missing then sex=0; if sex is"M" then sex=1; if sex is"F" then

Re: [R] If else

2015-10-30 Thread Val
t; Using numeric for missing sounds like asking for trouble. But if you > must, something like > > mydata$confusingWillCauseProblemsLater <- > ifelse( > is.na(mydata$sex), > 0, > as.numeric(factor(mydata$sex, > levels = c("M", "

Re: [R] If else

2015-10-31 Thread Val
- > Sent from my phone. Please excuse my brevity. > > On October 31, 2015 8:23:05 AM PDT, Val <valkr...@gmail.com> wrote: > >Hi All, > > > > > >Yes I need to change to numeric because I am preparing a data set > >for > >further analysis.

Re: [R] If else

2015-10-31 Thread Val
and Indeterminate, > for each of which there is a potential assoctiation with type of crime. > With most analyses, however, a category of "NA" would be ignored > (at least by R). > > And then one has a variable which is a factor with 3 levels, all > of which can (as above) be meani

Re: [R] If else

2015-10-31 Thread Val
2 2 2 2 2 2 > > > >> > > > > > > On Fri, Oct 30, 2015 at 8:28 PM, Ista Zahn <istaz...@gmail.com> wrote: > > > >> Using numeric for missing sounds like asking for trouble. But if you > >> must, something like > >> > >&

Re: [R] [FORGED] Re: If else

2015-10-31 Thread Val
Hi All, I am sorry for the confusion and yes I understand this due to limited knowledge of R. I am working on that. Thank you again. On Sat, Oct 31, 2015 at 7:06 PM, Rolf Turner wrote: > > Jim: I'm sure that this is much more sophisticated than anything that the

Re: [R] by group

2015-10-20 Thread Val
; > Rhydwyn McGuire > Senior Biostatistician | Health Statistics NSW > Level 7, 73 Miller St, North Sydney 2060 > Tel 02 9391 9781 | rm...@doh.health.nsw.gov.au > www.health.nsw.gov.au > > > > -Original Message- > From: R-help [mailto:r-help-boun...@r-pr

[R] by group

2015-10-12 Thread Val
Hi all, Assume that I have the following data set : cntry state city Gender (1=F and 2=M) 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 2 2 2 1 2 3 2 1 2 3 1 I want to calculate the number of Females and Males, total (F+M) and percentage (F/M) by country, state and city. Here is

[R] count by category

2015-10-05 Thread Val
Hi All, I have a data set ( region, city, town and district). The data looks like region, city, town, district 1 1 1 1 1 1 1 2 1 1 1 3 1 1 2 1 1 1 2 2 1 2 1 1 I want the counts for region, city and town. Here region 1 has 6 records, city 1 has 5 records and city 2 has 1

[R] Extract from a text file

2016-05-30 Thread Val
Hi all, I have a messy text file and from this text file I want extract some information here is the text file (out.txt). One record has tow lines. The mean comes in the first line and the SE of the mean is on the second line. Here is the sample of the data. Mean of weight group 1, SE of mean

Re: [R] Extract from a text file

2016-05-31 Thread Val
ing > v1 <- as.numeric( sub( pattern, "\\1", indta[ firstlines ] ) ) > # Replace the matched portion (entire string) with the second capture # > string > v2 <- as.numeric( sub( pattern, "\\2", indta[ firstlines ] ) ) > # Convert the lines just after the fir

Re: [R] Pairing and

2016-02-11 Thread Val
;-indat %*% array(c(rep(c(rep(1,2),rep(0,dim(indat)[2])),dim(indat)[2]/2),1,1),dim=c(dim(indat)[2],dim(indat)[2]/2)) outdat[outdat==2]<-0 outdat[outdat==4]<-1 outdat Thank you! On Thu, Feb 11, 2016 at 5:58 PM, Dalthorp, Daniel <ddalth...@usgs.gov> wrote: > Hi Val, > There

[R] Pairing and

2016-02-11 Thread Val
Hi all, I have SNP data set: the first column is the ID and the the subsequent pair of columns are the alleles for each SNP1, SNP2 and So on. Each SNP has two columns. Based on the alleles I want make phenotype if the alleles are 1 1then genotype is 0 2 2

Re: [R] LDheatmap

2016-02-03 Thread Val
Thank you Bert, Yes I looked a this one and I was looking for if any one has used it or not before? My data set is different what they are showing in the paper On Wed, Feb 3, 2016 at 4:00 PM, Bert Gunter wrote: > Have you looked here (found immediately by an

[R] subsetting

2016-02-24 Thread Val
Hi all, One of the the columns of a data frame has a value such like S-2001-yy S-2004-xx F-2007-SS and so on based on this column (variable) I want subset a data frame where the middle value of this variable is between 2001 to 2004. THE END RESULT THE DATA FRAME WILL BE THIS.

Re: [R] subsetting

2016-02-24 Thread Val
th 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 Wed, Feb 24, 2016 at 6:57 PM, Val <valkr...@gmail.com> wrote: > > Hi all, > > >

[R] Table

2016-02-10 Thread Val
Hi all, I want create a frequency table using this : xc1<- sample(c(1:10), 100, replace = TRUE) xc2<- sample(c(0,1), 100, replace = TRUE) xc3<- cbind(xc1,xc2) tab1<- xc3[,list( d1=sum(xc2==0), d2=sum(xc2==1)),by=xc1] but not working. Error in `[.data.frame`(xc3, , list(d1 = sum(xc2 == 1), d2

[R] assign

2016-04-08 Thread Val
Hi all I am trying t extract a variable from a column ASk/20005-01-45/90 Alldatk/25-17-4567/990 I want to assign a variable to the numbers coming the first"-" x=01 for the first and x=17 for teh second I tried using gsub but did not work x=gsub("-") any help?

[R] Last

2016-04-17 Thread Val
e manually. Is it possible to read the last sheet of an excel file? Thank yo in advance Val [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help

[R] remove

2017-02-11 Thread Val
Hi all, I have a big data set and want to remove rows conditionally. In my data file each person were recorded for several weeks. Somehow during the recording periods, their last name was misreported. For each person, the last name should be the same. Otherwise remove from the data.

Re: [R] remove

2017-02-12 Thread Val
our data set is really big (running out of memory big) then you might > want to investigate the data.table or sqlite packages, either of which can > be combined with dplyr to get a standardized syntax for managing larger > amounts of data. However, most people actually aren't running out of m

Re: [R] [FORGED] Re: remove

2017-02-12 Thread Val
>first week last >> 1 Bob1 John >> 2 Bob2 John >> 3 Bob3 John >> 4 Cory1 Jack >> 5 Cory2 Jack >> >> which is the desired output. If there is a "basic stuff" way to do this >> I'd like to see it. Perhap

Re: [R] remove

2017-02-12 Thread Val
!. On Sun, Feb 12, 2017 at 6:31 PM, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > Your question mystifies me, since it looks to me like you already know the > answer. > -- > Sent from my phone. Please excuse my brevity. > > On February 12, 2017 3:30:49 PM PST, Val <valk

Re: [R] remove

2017-02-12 Thread Val
t to investigate the data.table or sqlite packages, either of which can > be combined with dplyr to get a standardized syntax for managing larger > amounts of data. However, most people actually aren't running out of memory > so in most cases the extra horsepower isn't actually needed. >

Re: [R] remove

2017-02-12 Thread Val
ob1 John Bob2 John Bob3 John Cory1 Jack Cory2 - Thank you again! On Sun, Feb 12, 2017 at 7:28 PM, Val <valkr...@gmail.com> wrote: > Sorry Jeff, I did not finish my email. I accidentally touched the send > button. > My question was the > whe

Re: [R] output

2017-01-17 Thread Val
essage of Error in read.table(file = file, header = header, sep = sep, quote = quote, : no lines available in input Thank you in advance On Tue, Dec 13, 2016 at 5:07 PM, Val <valkr...@gmail.com> wrote: > Marc, > Thank you so much! That was helpful comment. > > > On Mon, D

Re: [R] [FORGED] if and

2017-02-27 Thread Val
> > "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 Mon, Feb 27, 2017 at 6:16 PM, Rolf Turner <r.tur...@auckland.ac.nz>

[R] if and

2017-02-27 Thread Val
Currently I have about six or more scripts that do the same job. I thought it might be possible and more efficient to use one script by using IF ELSE statements. Here is an example but this will be expandable for several countries ans year-months Year-month = FEB2015, FEB2012, Feb2010

[R] transform

2016-09-30 Thread Val
Hi all, I want to standardize a variable based on certain condition Here is my sample of data obs, Year, bb, kk, y 1, 2001, 25 ,100, 12.6 2, 2001, 15 ,111, 24.7 3, 2001, 53, 110, 13.8 4, 2001, 50, 75, 9.6 5, 2001, 125, 101, 31.5 6, 2001, 205, 407, 65.7 7, 2001, 250, 75, 69.1 If

Re: [R] Incremental

2016-10-12 Thread Val
at$flag == "S") > > # 2) > dat$z2 <- unlist(tapply(dat$y1, dat$x1, function(y) y - y[1])) > > Hope this helps, > > Rui Barradas > > > Em 12-10-2016 21:15, Val escreveu: >> >> Hi all, >> >> I have a data set like >> dat<-read.

[R] Variable

2016-11-24 Thread Val
Hi all, I am trying to get shell variable(s) into my R script in Linux . How do I get them? my shell script is t1.sh #!bin/bash Name=Alex; export Name Age=25; export Age How do get the Name and Age variables in my R script? My R script is test.R print " Your Name is $Name and

Re: [R] read

2016-11-28 Thread Val
Hi Jeff and John, Thank you for your response. In each folder, I am expecting a single file name (either dat or dat.csv).v so will this work? Is the following correct? fns <- list.files(mydir) if (is.element(pattern="dat(\\.[^.]+)$",fns )) Thank you again. On Mon, Nov 28, 2016 at 7:20

[R] load and

2016-11-19 Thread Val
Hi all, I have two *.RData objects saveds in different time. They do have the same number of columns but different number of rows. I was trying to load and compare the two files by the first columns but face problem. t1=load(file="dat.RData") t2=load(file="dat256.RData") Error: object 'dat256'

[R] Incremental

2016-10-12 Thread Val
4,H,1,336 40332,S,2,0 40471,R,2,139 40493,R,2,161 40533,X,2,201 40718,H,2,386 40771,S,3,0 40829,R,3,58 40892,X,3,121 41056,H,3,285 41110,S,4,0 41160,R,4,50 41222,R,4,112 41250,R,4,140 41289,R,4,179 41324,X,4,214 41355,R,4,245 41415,X,4,305 41562,X,4,452 41562,H,4,452 41586,S,5,0 Val

Re: [R] Incremental

2016-10-14 Thread Val
t; 0L, 50L, 112L, 140L, 179L, 214L, 245L, 305L, 452L, 452L, > 0L)), .Names = c("y1", "flag", "x1", "z2"), row.names = c(NA, > -24L), class = "data.frame") > > > Rui Barradas > > > Em 12-10-2016 21:53, Val escreveu: >&g

[R] lag, count

2016-10-15 Thread Val
Hi all, I want sort the data by ID and Y2 then count the number of rows within IDs. Assign a "flag" variable to reach row starting from first to the last row. For instance, in the following data ID "1" has three rows and each row is assigned flag sequentially 1, 2,3. 2. In the second step,

[R] output

2016-12-12 Thread Val
Hi all, I have a data frame with more than 100,000 rows. datx <- function(n,mean,sd) { mean+sd*scale(rnorm(n)) } dat <- datx(11,10,2) 1) WriteXLS(dat, "test4.xls", row.names=FALSE) Error in WriteXLS(dat, "test4.xls", row.names = FALSE) : One or more of the data frames named in 'x' exceeds

[R] data

2016-12-03 Thread Val
Hi all, I am trying to read and summarize a big data frame( >10M records) Here is the sample of my data state,city,x 1,12,100 1,12,100 1,12,200 1,13,200 1,13,100 1,13,100 1,14,200 2,21,200 2,21,200 2,21,100 2,23,100 2,23,200 2,34,200 2,34,100 2,35,100 I want get the total count by state, and

[R] files

2016-11-29 Thread Val
Hi all, In one folder I have several files and I want combine/concatenate(rbind) based on some condition . Here is the sample of the files in one folder test.csv test123.csv test456.csv Adat.csv Adat123.csv Adat456.csv I want to create 2 files as follows test_all =

Re: [R] files

2016-11-29 Thread Val
les(pattern="^test") > myfiles <- lapply(filelist, read.csv) > myfiles <- do.call(rbind, myfiles) > > > > On Tue, Nov 29, 2016 at 9:11 PM, Val <valkr...@gmail.com> wrote: >> Hi all, >> >> In one folder I have several files and I want &g

[R] create new

2017-03-24 Thread Val
Hi all, I have several variables in a group and one group contains three variables. Sample of data ( Year, x1, x3 and x2) mydat <- read.table(header=TRUE, text=' Year x1 x3 x2 Year1 10 120 Year2 0 150 Year3 0 020 Year4 25 0 12 Year5 15 25 12 Year6 0 16 14

[R] screen

2017-03-15 Thread Val
HI all, I have some data to be screened based on the recording flag (obs). Some family recorded properly (1) and others not (0). Th 0 = improper and 1 = proper The recording period starts week1. All families may not start in the same week in recording properly an observation, DF2 <-

[R] combination

2017-04-12 Thread Val
Hi all, I have two variables x and y. X has five observation and y has three. I want combine each element of x to each element of y values to produce 15 observation. Below is my sample data and desired output data x Y 1 A 2 B 3 C 4 5 Output 1 A 1 B 1 C 2 A 2 B 2 C 3 A 3 B 3 C

[R] replace

2017-03-13 Thread Val
HI all, if first name is Alex then I want concatenate the second column to Alex to produce Alex and the second column value DF1 <- read.table(header=TRUE, text='first YR Alex2001 Bob 2001 Cory2001 Cory2002 Bob 2002 Bob 2003 Alex2002 Alex2003 Alex2004')

[R] missing and replace

2017-04-26 Thread Val
HI all, I have a data frame with three variables. Some of the variables do have missing values and I want to replace those missing values (1represented by NA) with the mean value of that variable. In this sample data, variable z and y do have missing values. The mean value of y and z are152. 25

[R] New var

2017-06-02 Thread Val
Hi all, I have a data set with time interval and depending on the interval I want to create 5 more variables . Sample data below obs, Start, End 1,2/1/2015, 1/1/2017 2,4/11/2010, 1/1/2011 3,1/4/2006, 5/3/2007 4,10/1/2007, 1/1/2008 5,6/1/2011, 1/1/2012 6,10/15/2004,12/1/2004 First, I want

Re: [R] New var

2017-06-04 Thread Val
; -1), tf1 = c(0, 0, 0, 1, 0, 1), tf2 = c(0, 0, 0, -1, 0, -1), > tf3 = c(0, 1, 0, -1, 1, -1), tf4 = c(0, -1, 0, -1, -1, -1 > ), tf5 = c(0, -1, 1, -1, -1, -1), tm1 = c(0, 0, 0, 1, 0, > 1), tm2 = c(0, 0, 0, -1, 0, -1), tm3 = c(0, 1, 0, -1, 1, > -1), tm4 = c(0, -1, 0, -1, -1,

Re: [R] New var

2017-06-03 Thread Val
st to me. > > Cheers, > Bert > > > 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 F

[R] remove

2017-06-10 Thread Val
Hi all, I have a date issue and would appreciate any help. I am reading a field data and n one of the columns I am expecting a date but has non date values such as character and empty. space. Here is a sample of my data. KL <- read.table(header=TRUE, text='ID date 711 Dead 712 Uknown 713

Re: [R] match and new columns

2017-12-13 Thread Val
t 7:23 PM, William Dunlap <wdun...@tibco.com> wrote: > Use the stringsAsFactors=FALSE argument to read.table when > making your data.frame - factors are getting in your way here. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Wed, Dec 13, 2017 at 3:02 PM, V

[R] match and new columns

2017-12-13 Thread Val
Hi all, I have a data frame tdat <- read.table(textConnection("A B C Y A12 B03 C04 0.70 A23 B05 C06 0.05 A14 B06 C07 1.20 A25 A23 A12 3.51 A16 A25 A14 2,16"),header = TRUE) I want match tdat$B with tdat$A and populate the column values of tdat$A ( col A and Col B) in the newly created columns

Re: [R] match and new columns

2017-12-13 Thread Val
.pt> wrote: > Hello, > > Here is one way. > > tdat$D <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0) > tdat$E <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0) > > > Hope this helps, > > Rui Barradas > > > On 12/13/2017 9:36 PM, Val wrote: > &

[R] family

2017-11-17 Thread Val
Hi all, I am reading a huge data set(12M rows) that contains family information, Offspring, Parent1 and Parent2 Parent1 and parent2 should be in the first column as an offspring before their offspring information. Their parent information (parent1 and parent2) should be set to zero, if unknown.

Re: [R] exclude

2018-05-17 Thread Val
le 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 Thu, May 17, 2018 at 5:48 PM, Val <valkr...@gmail.com> wrote: > >> Hi All, >>

  1   2   >