> On Oct 12, 2016, at 11:20 AM, Ashta wrote:
>
> Hi David and all,
>
> I want run the following script in a loop but faced difficulty.
>
> trt=c(1,2,2,4,5,6,7,8)
> for(i in 1:length (trt))
> {
> try[i] <- (select trt, date1, date2, datediff(date1,date2) as
> d12diff [i] from
>
Hi David and all,
I want run the following script in a loop but faced difficulty.
trt=c(1,2,2,4,5,6,7,8)
for(i in 1:length (trt))
{
try[i] <- (select trt, date1, date2, datediff(date1,date2) as
d12diff [i] from
dateTable where trt=[i]")
}
I would appreciate if you point me
Thank you so much David! Your suggestions worked for me.
On Sun, Oct 9, 2016 at 11:16 AM, David Winsemius wrote:
>
>> On Oct 9, 2016, at 7:56 AM, Ashta wrote:
>>
>> I am trying to query data from Hive service and create a variable.
>>
>>
>> dbGetQuery(hivecon,"select date1, date2 from dateTab
This being the R-help mailing list, not being fluent in random SQL variants is
normal. There is a place for discussing the intersection of R and databases
where the intersection of R with such knowledge might be more typical. I
suggest that Ashta read the Posting Guide to learn about appropriate
> On Oct 9, 2016, at 7:56 AM, Ashta wrote:
>
> 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/1
> On Oct 9, 2016, at 7:56 AM, Ashta wrote:
>
> 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/1
I think you need to do some homework on your own first. Have you gone
through any R tutorials? -- there are many good ones on the web.
Including ones on date-time processing in R.
To answer your question directly, read up on date/time classes and
functions with ?"date-time" . You may also find th
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
Hello,
thanks for the quick answers! Some answers were more useful to me than
others but I really appreciate everybodys effort, reading and
answering my question.
I will try Dons approach because as he said, it looks quite readable.
I'll need to take a closer look on the nested ifelse statements
On Jan 2, 2012, at 4:22 PM, David Stevens wrote:
Could it be
NO. You are not reading the documentation for "if" carefully enough,
despite several efforts to point you in the right direction. You
cannot make literal transliterations of SPSS syntax work in the manner
you imagine.
--
Dav
Could it be
if(variable1.fac == 0 & variable2.num == 0) {variable3 = 1} #
brackets {} aren't strictly required for a one liner.
if(variable1.fac == 0 & variable2.num >= 0) {variable3 = 2} #
brackets {} aren't strictly required for a one liner.
if(variable1.fac == 1 & variable2.nu
I usually do this kind of thing like this:
variable3 <- rep(1,length(variable1.fac))
variable3[ variable1.fac == 0 & variable2.num >= 1 ] <- 2
variable3[ variable1.fac == 1 & variable2.num == 0 ] <- 3
variable3[ variable1.fac == 1 & variable2.num >= 1 ] <- 4
This approach is easy to read and unde
On Jan 2, 2012, at 10:42 AM, David Winsemius wrote:
On Jan 2, 2012, at 4:11 AM, Richard Kolodziej wrote:
Hello,
I'm using SPSS at work but really would like to switch to R. Right
now I'm
trying to learn R in reproducing calculations I did with SPSS but
am stuck
with something that is qu
d Kolodziej
Verzonden: maandag 2 januari 2012 10:11
Aan: r-help@r-project.org
Onderwerp: [R] Create variable with AND IF statement
Hello,
I'm using SPSS at work but really would like to switch to R. Right now I'm
trying to learn R in reproducing calculations I did with SPSS but am stuck wi
On Jan 2, 2012, at 4:11 AM, Richard Kolodziej wrote:
Hello,
I'm using SPSS at work but really would like to switch to R. Right
now I'm
trying to learn R in reproducing calculations I did with SPSS but am
stuck
with something that is quite simple and comprehensible in SPSS-Syntax:
IF (var
Hello,
I'm using SPSS at work but really would like to switch to R. Right now I'm
trying to learn R in reproducing calculations I did with SPSS but am stuck
with something that is quite simple and comprehensible in SPSS-Syntax:
IF (variable1.fac = 0 AND variable2.num = 0) variable3=1.
IF (variabl
On 20.11.2011 15:32, Alaios wrote:
Dear all,
I would like based on a variable values, like threshold<- 90 to create
variables name that will load data sets
For example
paste('mystring',threshold,sep="")<-load('myfile')
This is a FAQ!
You probably want to assign into a list. But if you rea
Dear all,
I would like based on a variable values, like threshold<- 90 to create
variables name that will load data sets
For example
paste('mystring',threshold,sep="")<-load('myfile')
How I can doi something like that in R?
B.R
Alex
[[alternative HTML version deleted]]
_
On Mar 31, 2011, at 3:46 PM, Henrique Dallazuanna wrote:
Take a look in ?assign
On Thu, Mar 31, 2011 at 5:42 PM, Noah Silverman > wrote:
Hi,
I want to create variable names from within my code, but can't find
any documentation for this.
An example is probably the best way to illustrate.
The best thing to do is to understand how to use 'list' for this
purpose. Much easier to handle the information.
On Thu, Mar 31, 2011 at 4:42 PM, Noah Silverman wrote:
> Hi,
>
> I want to create variable names from within my code, but can't find any
> documentation for this.
>
> An example is p
Perfect.
Thank You
On Mar 31, 2011, at 1:47 PM, Mark Leeds wrote:
> hi noah: assign(thing you paste, 123, envir=whatever) should work I think.
>
>
> On Thu, Mar 31, 2011 at 4:42 PM, Noah Silverman
> wrote:
> Hi,
>
> I want to create variable names from within my code, but can't find any
Take a look in ?assign
On Thu, Mar 31, 2011 at 5:42 PM, Noah Silverman wrote:
> Hi,
>
> I want to create variable names from within my code, but can't find any
> documentation for this.
>
> An example is probably the best way to illustrate. I am reading data in from
> a file, doing a bunch of s
Hi,
I want to create variable names from within my code, but can't find any
documentation for this.
An example is probably the best way to illustrate. I am reading data in from a
file, doing a bunch of stuff, and want to generate variables with my output.
(I could make a "list of lists" and n
e-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
>> project.org] On Behalf Of Ralf B
>> Sent: Wednesday, October 06, 2010 10:32 AM
>> To: r-help Mailing List
>> Subject: [R] Create variable by name
>>
>> Can one create a variable thro
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Ralf B
> Sent: Wednesday, October 06, 2010 10:32 AM
> To: r-help Mailing List
> Subject: [R] Create variable by name
>
> Can one create a variable th
On Oct 6, 2010, at 12:58 PM, David Winsemius wrote:
On Oct 6, 2010, at 12:32 PM, Ralf B wrote:
Can one create a variable through a function by name
Isn't that what "<-" does?
createVariable <- function(name) {
outputVariable = name
name <- NULL
}
after calling
createVa
On Oct 6, 2010, at 12:32 PM, Ralf B wrote:
Can one create a variable through a function by name
Isn't that what "<-" does?
createVariable <- function(name) {
outputVariable = name
name <- NULL
}
after calling
createVariable("myVar")
?assign # and isn't this covered in
An alternative to Peter's solution:
createVariable <- function(name) {assign(name, NULL, envir=.GlobalEnv)}
Jeff.
On Wed, Oct 6, 2010 at 12:32 PM, Ralf B wrote:
> Can one create a variable through a function by name
>
> createVariable <- function(name) {
> outputVariable = name
>
On Wed, Oct 6, 2010 at 9:32 AM, Ralf B wrote:
> Can one create a variable through a function by name
>
> createVariable <- function(name) {
> outputVariable = name
> name <- NULL
> }
>
> after calling
>
> createVariable("myVar")
>
> I would like to have a variable myVar initialized w
On Wed, Oct 6, 2010 at 9:32 AM, Ralf B wrote:
> Can one create a variable through a function by name
>
> createVariable <- function(name) {
> outputVariable = name
> name <- NULL
> }
>
> after calling
>
> createVariable("myVar")
>
> I would like to have a variable myVar initialized w
Can one create a variable through a function by name
createVariable <- function(name) {
outputVariable = name
name <- NULL
}
after calling
createVariable("myVar")
I would like to have a variable myVar initialized with NULL in my
environment. Is this possible?
Ralf
31 matches
Mail list logo