Hi all,
>From one of the columns of the data frame I want to search and
extract a text that contains Tall or Short and create new column
that should contain these texts in a corresponding row.
My example data and the desired output are shown below
dat<-read.table(text="obs Year char
1 2001
ng along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Thu, Nov 28, 2019 at 3:17 PM Ashta wrote:
>>
>> Hi all, I want to remove a row based on a condition in one of the
>> variables f
Hi all, I want to remove a row based on a condition in one of the
variables from a data frame.
When we split this string it should be composed of 3-2- 5 format (3
digits numeric, 2 characters and 5 digits numeric). Like
area code -region-numeric. The max length of the area code should be
3, the
c 9, 2017 at 9:38 AM, David Winsemius <dwinsem...@comcast.net>
> wrote:
>>
>>
>> > On Dec 8, 2017, at 6:16 PM, David Winsemius <dwinsem...@comcast.net>
>> > wrote:
>> >
>> >
>> >> On Dec 8, 2017, at 4:48 PM, Ashta <
25 125
A 23 135
B 45 321
B 47 512
C 61 521
C 68 235
Thank you
On Wed, Dec 6, 2017 at 10:34 PM, David Winsemius <dwinsem...@comcast.net> wrote:
>
>> On Dec 6, 2017, at 4:27 PM, Ashta <sewa...@gmail.com> wrote:
>>
>> Thank you Ista! Worked fine.
>
> Here's anot
Thank you Ista! Worked fine.
On Wed, Dec 6, 2017 at 5:59 PM, Ista Zahn <istaz...@gmail.com> wrote:
> Hi Ashta,
>
> There are many ways to do it. Here is one:
>
> vars <- sapply(split(DM$x, DM$GR), var)
> DM[DM$GR %in% names(vars[vars > 0]), ]
>
> Best
>
t; wrote:
> subset( DM, "B" != x )
>
> This is covered in the Introduction to R document that comes with R.
> --
> Sent from my phone. Please excuse my brevity.
>
> On December 6, 2017 3:21:12 PM PST, David Winsemius <dwinsem...@comcast.net>
> wrote:
c 6, 2017, at 3:15 PM, Ashta <sewa...@gmail.com> wrote:
>>
>> Hi all,
>> In a data set I have group(GR) and two variables x and y. I want to
>> remove a group that have the same record for the x variable in each
>> row.
>>
>> DM <- read.table(
Hi all,
In a data set I have group(GR) and two variables x and y. I want to
remove a group that have the same record for the x variable in each
row.
DM <- read.table( text='GR x y
A 25 125
A 23 135
A 14 145
A 12 230
B 25 321
B 25 512
B 25 123
B 25 451
C 11 521
C 14 235
C 15 258
C 10
o, not how you want to do it.
>
> On Tue, Jun 13, 2017 at 5:09 PM, Ashta <sewa...@gmail.com> wrote:
>>
>> Hi all,
>>
>> I am using R to extract data on a regular basis.
>> However, sometimes using the same script and the same data I am
>> getting dif
Hi all,
I am using R to extract data on a regular basis.
However, sometimes using the same script and the same data I am
getting different observation.
The library I am using and how I am reading it is as follows.
library(stringr)
namelist <- file("Adress1.txt",encoding="ISO-8859-1")
Name <-
Jeff,
I am sorry for that.
On Sat, Apr 15, 2017 at 12:04 AM, Jeff Newmiller
<jdnew...@dcn.davis.ca.us> wrote:
> You don't follow instructions very well. Read the Posting Guide more
> carefully.
> --
> Sent from my phone. Please excuse my brevity.
>
> On April 14, 20
wrote:
> Show us str(DF1) . It is not a data frame.
>
> -- Bert
>
>
>
>
> On Fri, Apr 14, 2017 at 9:02 PM, Ashta <sewa...@gmail.com> wrote:
>> Hi all,
>> I am reading a field data that contains several variables. The sample
>> of the data with the fi
Hi all,
I am reading a field data that contains several variables. The sample
of the data with the first two variables is shown below. I wanted to
know the minimum and maximum recording date However, I have some
problem.
Name Rdate V1 to V20
Alex101/03/2015
Alex201/03/2014
Hi all,
I have more than two files and merge by a single column and preserve the
other columns.
Here is an example of two files
dat1 <- read.table(header=TRUE, text=' ID T1 T2
ID1125245
ID2141264
ID3133281')
dat2 <- read.table(header=TRUE, text=' ID G1 G2
ID225 46
(sp, function(x)
>> if(length(unique(x$var)) == 1) x else NULL))
>> rownames(want) <- NULL
>> want
>>
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>> Em 18-03-2017 13:51, Ashta escreveu:
>> > Hi all,
>> >
Hi all,
I am trying to find a city that do not have the same "var" value.
Within city the var should be the same otherwise exclude the city from
the final data set.
Here is my sample data and my attempt. City1 and city4 should be excluded.
DF4 <- read.table(header=TRUE, text=' city wk var
city1
th zero
On Sat, Feb 25, 2017 at 5:43 PM, David Winsemius <dwinsem...@comcast.net> wrote:
>
>> On Feb 25, 2017, at 10:45 AM, Ashta <sewa...@gmail.com> wrote:
>>
>> Thank you David.
>> is it not possible to sort it by year and flag so that we can make '-'
>&g
017, at 8:09 AM, Ashta <sewa...@gmail.com> wrote:
>>
>> I have a data set and I want to repeat a column value based on other
>> column value,
>>
>> my data look like
>>
>> read.table(text = "Year month flag
>> 2001 1 Z
>> 2001 2 -
I have a data set and I want to repeat a column value based on other
column value,
my data look like
read.table(text = "Year month flag
2001 1 Z
2001 2 -
2001 4 X
2002 1 Z
2002 2 -
2003 1 -
2003 2 Z
2004 2 Z
2005 3 Z
2005 2 -
2005 3 -", header = TRUE)
Within year If flag
Hi all,
I have a script that reads a file (dat.csv) from several folders.
However, in some folders the file name is (dat) with out csv and in
other folders it is dat.csv. The format of data is the same(only the
file name differs with and without "csv".
Is it possible to read these files
> year num diff
> 1 2001 250
> 2 2001 75 50
> 3 2001 150 125
> 4 2002 300
> 5 2002 85 55
> 6 2002 95 65
>
>
> Philip
>
>
> On 28/10/2016 3:20 PM, Ashta wrote:
>>
>> Hi all,
>>
>> I want to calculate the differe
Hi all,
I want to calculate the difference between successive row values to
the first row value within year.
How do I get that?
Here isthe sample of data
Year Num
200125
200175
2001 150
200230
200285
200295
Desired output
Year Num diff
200125 0
2001
Hi all,
I am trying to summarize big data set by selecting a row
conditionally. and tried to do it in a loop
Here is the sample of my data and my attempt
dat<-read.table(text=" ID,x1,x2,y
1,a,b,15
1,x,z,21
1,x,b,16
1,x,k,25
2,d,z,31
2,x,z,28
2,g,t,41
3,h,e,32
3,x,z,38
3,x,g,45
point me the problem.
Thank you in advance
On Sun, Oct 9, 2016 at 11:16 AM, David Winsemius <dwinsem...@comcast.net> wrote:
>
>> On Oct 9, 2016, at 7:56 AM, Ashta <sewa...@gmail.com> wrote:
>>
>> I am trying to query data from Hive service and create a variable.
Thank you so much David! Your suggestions worked for me.
On Sun, Oct 9, 2016 at 11:16 AM, David Winsemius <dwinsem...@comcast.net> wrote:
>
>> On Oct 9, 2016, at 7:56 AM, Ashta <sewa...@gmail.com> wrote:
>>
>> I am trying to query data from H
I am trying to query data from Hive service and create a variable.
dbGetQuery(hivecon,"select date1, date2 from dateTable limit 10")
date1, date2, Diif
4/5/1999, 6/14/2000
7/2/1999, 6/26/2000
8/14/1999, 8/19/2000
11/10/1999, 9/18/2000
8/25/2000, 6/5/2001
3/14/2012, 3/15/2004
Here is what I
mta.hu> wrote:
>
>
> On 07/17/2016 01:39 AM, Duncan Murdoch wrote:
>>
>> On 16/07/2016 6:25 PM, Ashta wrote:
>> > Hi all,
>> >
>> > I have a large square matrix (60 x 60) and found it hard to
>> > visualize. Is it possible to change it
Hi all,
I have a large square matrix (60 x 60) and found it hard to
visualize. Is it possible to change it as shown below?
Sample example (3 x 3)
A B C
A 3 4 5
B 4 7 8
C 5 8 9
Desired output
A A 3
A B 4
A C 5
B B 7
B C 8
C C 9
Thank you in advance
Thank you Jeff. Solved.
On Fri, Jun 3, 2016 at 12:47 AM, Jeff Newmiller
<jdnew...@dcn.davis.ca.us> wrote:
> ?merge
>
> Pay attention to the all-whatever parameters.
> --
> Sent from my phone. Please excuse my brevity.
>
> On June 2, 2016 7:04:47 PM PDT, Ashta <sew
I have 2 data sets. File1 and File2. Some records are common to both
data sets. For those common records I want get the difference between
d_x1z1= z1-x1 and d_x2z2= z2-x2.
File1<- data.frame(var = c(561,752,800,900), x1= c(23,35,40,15), x2=
c(125,284,280,347))
File2<- data.frame(var =
Thank you David!
On Sat, May 7, 2016 at 12:18 AM, David Winsemius <dwinsem...@comcast.net> wrote:
>
>> On May 6, 2016, at 5:15 PM, Ashta <sewa...@gmail.com> wrote:
>>
>> Thank you very much David.
>>
>> So there is no general formal that works year
)
nextmo
Many thanks
On Fri, May 6, 2016 at 6:40 PM, David Winsemius <dwinsem...@comcast.net> wrote:
>
>> On May 6, 2016, at 4:30 PM, David Winsemius <dwinsem...@comcast.net> wrote:
>>
>>
>>> On May 6, 2016, at 4:11 PM, Ashta <sewa...@gmail.com&g
Hi all,
I am trying to ge get the next month of the year.
today <- Sys.Date()
xx<- format(today, format="%B%Y")
I got "May2016", but I want Jun2016. How do I do that?
My other question is that, I read a data and do some analysis and I
want to send all the results of the analysis to a pdf
Thank you very much Jim!
It is working fine!!
On Sun, Feb 28, 2016 at 1:46 AM, Jim Lemon <drjimle...@gmail.com> wrote:
> Hi Ashta,
> This does not seem too difficult:
>
> DF$flag<-"n"
> for(thisname in unique(DF$Name)) {
> if(any(DF$year[DF$Name == thisna
Hi all,
I have a data set represented by the following sample.
I want flag records of an individual as "N", if if the tag column of
an individual is equal to zero for the last two years. So in the
following example, Alex1 records are flagged as "y", On the other
hand Carla's records are
hi all,
I have a square matrix (1000 by 1000),
1. I want calculate mean, min and max values for each column and row.
2, I want pick the coordinate value of the matrix that has the max
and min value for each row and column.
This an example 4 by 4 square matrix
Hi all,
I am looking for an R package that calculates a pair wise LD
(linkage disequilibrium) I came up with library(LDheatmap). has any
one used this library? I would appreciate if I get a help how to use
this library for my set of data..
My data set look like
Geno file
Name1 1 1 2 2 2 2
quot;solution" of times 6, 7, and 8 will never appear because the
> sum of the values is 586.
>
>
> David L. Carlson
> Department of Anthropology
> Texas A University
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ashta
>
Hi all,
I have a data set that contains samples collected over time. In
each time period the total number of samples are given (X2) The goal
is to select 500 random samples.The selection should be based on
time (select time periods until I reach 500 samples). Also the time
period
TRUE)
what I want is
time S1
12
21
33
Thank you again.
On Sat, Nov 21, 2015 at 1:30 PM, Ashta <sewa...@gmail.com> wrote:
> Thank you Bert!
>
> What I want is at least 500 samples based on random sampling of time
> period. This allows samples co
rra...@sapo.pt> wrote:
> Hello,
>
> Try
>
> tapply(tab$S1, tab$time, function(x) length(unique(x)))
>
> Hope this helps,
>
> Rui Barradas
>
>
> Citando Ashta <sewa...@gmail.com>:
>
> Hi Bert and all,
> I have related question. In each time perio
utorial. All you need is to know how to form a data.frame.
>
>
> tmp <- tapply(tab1$S1, tab1$time, function(x) length(unique(x)))
> data.frame(time = names(tmp), S1 = tmp)
>
> Rui Barradas
>
>
> Citando Ashta <sewa...@gmail.com>:
>
> Hi Rui ,
>
>
>
TRUE,sz<500)]
> }),]
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
>-- Clifford Stoll
>
>
> On Sat, Nov 21, 2015 at 10:56 AM, Ashta <sewa...@gmail.c
Hi all,
I have the following raw data some records don't have the second variable.
test <- read.table(textConnection(" Country STATUS
USA
USAW
USAW
GER
GERW
GERw
GERW
UNKW
UNK
UNKW
FRA
FRA
FRAW
FRAW
FRAW
SPA
SPAW
SPA "),header = TRUE, sep=
UNK 1 2 3
> USA 1 2 3
>
> I'll let you figure out how to get the last column.
>
> David L. Carlson
> Department of Anthropology
> Texas A University
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of As
lt. What am I
missing here?
On Wed, Nov 11, 2015 at 7:54 PM, Sarah Goslee <sarah.gos...@gmail.com>
wrote:
> On Wed, Nov 11, 2015 at 8:44 PM, Ashta <sewa...@gmail.com> wrote:
> > Hi Sarah,
> >
> > I used the following to clean my data, the program crushed several tim
Hi all,
I have a data frame with huge rows and columns.
When I looked at the data, it has several garbage values need to be
cleaned. For a sample I am showing you the frequency distribution
of one variables
Var1 Freq
1:3
2]6
3MSN 1040
4YYZ 300
5\\4
6+
setting your data.
>
> Var1 %in% myvalues
>
> Sarah
>
> On Wed, Nov 11, 2015 at 7:10 PM, Ashta <sewa...@gmail.com> wrote:
> > Thank you Sarah for your prompt response!
> >
> > I have the list of values of the variable Var1 it is around 20.
> > Ho
Thanks Sarah,
1. to shade or color (blue) the curve using the criterion that any values
greater than 11,000
I think I was not clear in the above point. I want shade not the line but
the area under the curve,
and
Your last line of code,
segments(x0=mean(test1), y0=0, y1=curveheight)
gave me
Hi All,
I was trying to find a function that handles Partially Linear
Single-Index model in survival analysis, but was not lucky.
Is thee a function in R for this type of analysis?
Thanks
A
__
R-help@r-project.org mailing list
Hi all,
Does any one know how to write the likelihood function for Poisson distribution
in R when P(x=0).
For normal case, it an be written as follows,
n * log(lambda) - lambda * n * mean(dat)
Any help is highly appreciated
Ashta
In a histogram , is it possible to have different colors?
Example. I generated
x - rnorm(100)
hist(x)
I want the histogram to have different colors based on the following condition
mean(x)+sd(x) with red color and mean(x) - sd(x) with red color as
well. The middle one with blue color.
Hi All,
Does the step function work in this model? I tried to run the
following model but no result obtained. The computer is hanging and I
killed the job several times. Below is the code.
library(survival)
m.fit=clogit(y~x1+x2+x3+x4, data=ftest)
summary(m.fit)
final- step(m.fit)
Thanks in
Hi all,
I am trying to interparete the result of the following output from lm;
fit1 =lm(Feed _Intake ~ weight + season + weight*season)
Season has three classes(x,y,z)
Reults are
Estimate (Intercept) 21.51559
weight 2.13051
factor(season)y
+ weight*season, data = DF)
On Mon, Jan 18, 2010 at 2:00 PM, Ashta sewa...@gmail.com wrote:
Hi all,
I am trying to interparete the result of the following output from lm;
fit1 =lm(Feed _Intake ~ weight + season + weight*season)
Season has three classes(x,y,z)
Reults are
Estimate
Hi all,
I want to calculate hazard ratio within each covariate
Example, one covariate has 3 classes (1,2 and 3) and x2 has 2 classes
I want to compare the relative risk ratio within each class of the covariate.
How do I get this result ? .
The other question is that how do I interpret
0.6665
factor(y1)3 -0.510124 0.600421 0.088901 -5.738 9.57e-09 ***
factor(x2)2 -0.510124 0.600421 0.088901 -5.738 9.57e-09 ***
What are those values? Is it comparing in reference to the first
class of each covariate?
Thanks again.
On Thu, Dec 10, 2009 at 8:33 AM, Ashta sewa
Hi all,
I was trying to test the assumption of proportional hazards
assumption, I used the cox.zph function
cox.zph(coxfit6)
Results are:
rhochisqp
x1 -0.03961.397 2.37e-01
x2 0.11079.715 1.83e-03
x3 -0.08857.743
Hi All,
I am trying to run the following script but have problem,
coxm- coxph(Surv(sdat$time, sdat$cens)~hd+nawtg+nwwg+ntpg+cy+nseas,data=sdat)
coxm-stepAIC(coxm,~.^2)
The error message is
Error: could not find function stepAIC
I tried to install the package but I could not find it. Where
HI R-Users
Assume that I have a data frame 'temp' with several variables (v1,v2,v3,v4,v5.).
v1 v2 v3 v4 v5
1 2 3 36
5 2 420
2 -9 5 43
6 2 1 34
1, I want to look at the entire row values of when v2 =-9
like
2 -9 5 43
I
Thank you Jorge and
res - table(unlist(x))
res[order(res, decreasing = TRUE)]
# 10 4 6 3 5 7 9 18
# 3 2 2 1 1 1 1 1
This one works fine for me. Is it possible to transpose it?
I tried t(res[order(res, decreasing = TRUE)]), but it did not work!
I want the result like this
10
Hi all,
I am trying to do wavelets and I got an error message saying The
length of data is not a power of 2
Is there a way of handing that? or should the data length be exactly
the power of 2?
I am using R version 2.9.2 (2009-08-24)
The is library(wavethresh).
wds -
Hi all,
I have the data set df with three varaibles,
x1 x2 x3
1 2 5
2 4 1
5 6 0
1 1 2
I want to insert more rows ( eg, 3 rows with value filled with zeros)
1 2 5
2 4 1
5 6 6
1 1 2
0 0 0
0 0 0
0 0 0
Can any body help me out?
Thanks
Hi All,
Assume that I have the following data set with two variables and I
want count the number of observation with identical values and number
of time each factor changed from x1 to x2.
x1 x2
1 1
1 0
0 1
0 1
0 0
1 1
0 1
The output should be
x1 changed
Hi Bill and all,
On Tue, Oct 20, 2009 at 12:09 PM, William Dunlap wdun...@tibco.com wrote:
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Peter Ehlers
Sent: Tuesday, October 20, 2009 8:48 AM
To: Ashta
Cc: R help
Subject: Re: [R] Counting
How about
Hi All,
I am using R version 2.9.2 (2009-08-24) window version
and I wanted to use the
library(spline)
Error in library(spline) : there is no package called 'spline'
I tried to install packages as well and it is not there either.
Am I missing something there. Where can I get this library?
Hi all,
Has any body the exprience to iclude a nonparametric component into the
survival analysis using R
package? *Can someone recommend *me * some ** references? *
Thanks a lot
Ashta
[[alternative HTML version deleted]]
__
R-help@r
*Hi all,
*
*Assume that I have the following data set with tow variables and I want
count the number of observation with identical values
*
**
*x1 x2*
* 1 1 *
* 1 0 *
* 0 1*
* 0 1*
* 0 0*
* 1 1*
* 0 1
*
I want the following output
**
*
*
*n1=3 # number of identical
Hi All,
I have the matrix called 'X' with 200 rows and 12 variables. I want to
create 2 new variables (V1 and V2) based on random number generator
p1-rnorm(200. mean=0, std=1)
p2-rnorm(200. mean=0, std=1)
x - cbind(x, v1=ifelse(x[,'p1'] 0.4, 1, 0), v2=ifelse(x[,'p2'] 0.6, 0,
1))
I found the
Hi all,
I have a data set
x1 x2 x3
1 2 1
1 2 3
2 1 2
1 2 1
3 1 1
I want to tabulate in the following way.
1 2 3
x13 2 1
x22 3 0
x33 1 1
It is just like frequency distribution
Any help is highly appreciated
Hi all,
I have a data set called x with200 rows and 12 columns. I want
create two more columns based on probability. ie
if p 0 .4 then v1 =1 else v1=0;
if p 0 .6 then v2 =1 else v2=0;
Finally x will have 14 variables.
Can any one show me how to do that?
Thanks
Ashta
, 0)
If it is matrix, try
x - cbind(x, v1=ifelse(x[,'p'] 0.4, 1, 0), v2=ifelse(x[,'p'] 0.6, 1,
2))
If helps a lot if you follow the posting rules and provide commented,
minimal, self-contained, reproducible code.
On Sat, Oct 10, 2009 at 6:04 PM, Ashta sewa...@gmail.com wrote:
Hi all
-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of David Winsemius
Sent: Thursday, October 08, 2009 4:19 PM
To: Ashta
Cc: R help
Subject: Re: [R] row selection
On Oct 8, 2009, at 4:14 PM, Ashta wrote:
Hi all,
I have a matrix named x with N by C
I want
Hi all,
I have a matrix named x with N by C
I want to select every 5 th rrow from matrix x
I used the following code
n- nrow(x)
for(i in 1: n){
+ b - a[i+5,]
b
}
Error: subscript out of bounds
Can any body point out the problem?
[[alternative HTML version deleted]]
Hi All,
Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat,
Sun),7,1)
Hum -matrix(c(56,57,60,75,62,67,70),
Temp-matrix(c(76,77,81,95,82,77,83),
Using the above information I want plot humidity and temperature on Y-axis
and days on X-axis
Any help is appreciated!
[[alternative
, but we like some evidence that the
querent has *tried* before inquiring.
Sarah
On Tue, Oct 6, 2009 at 10:05 AM, Ashta sewa...@gmail.com wrote:
Hi All,
Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat,
Sun),7,1)
Hum -matrix(c(56,57,60,75,62,67,70),
Temp-matrix(c
I have more than three lines in one and I want to add a legend for each
line
abline( m1, col = 'red' )
ablime( m2, col = 'blue' )
abline( m3, col = 'purple' )
How can I add a legend? . Is it also possible to increase the thickness of
the lines?
Thanks
[[alternative HTML version
I am trying to plot a line graph for 3 or more regression lines
abline(m1)
abline(m2)
abline(m3)
Can I change the color of each line? if so how?
Thanks in advance
Ashta
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing
My data is called xc and has more than 15 variables.
When I used summary(xc) it gave me the detail description of each
variable.
Summary(xc)
Y1x1 x2
x3 ..
Min. :0. Min. : 1.000 Min. : 1.000 Min. : 1.000
1st
the outcome. I
want to fit a binomial model . How do I do that? I am guessing the response
variable should be transformed but not sure which family of transformation
to use.
It is easy to do it in SAS but I just want to learn using R
Any help is highly appreciated
Ashta
[[alternative HTML
How can I get the the standard error and confidence interval for the
prediction in a multiple regression model using the R command?
for a simple regression I used
*predict(xc, newdata=data.frame(var1=10.),se=T)
where xc is the glm model using binomial and var1 is teh variable.
*
I can get the
the outcome.
I want to fit a binomial model in R . I want also to rder the factors based
on their degree of influence the outcome. How do I do this in R.
thanks in advance
Ashta
[[alternative HTML version deleted]]
__
R-help@r-project.org
Dear R-users,
I am a new user for R. I am eager to lean about it.
I wanted to read and summary of the a simple data file
I used the following,
rel - read.table(C:/Documents and Settings/ashta/My
Documents/R_data/rel.dat, quote=,header=FALSE,sep=,col.names=
c(id,orel,nrel))
summary
84 matches
Mail list logo