similar to: elseif syntax

Displaying 20 results from an estimated 10000 matches similar to: "elseif syntax"

2010 Aug 16
5
how to test if a vector contain a value?
Hi all, How to convert following simple python script to R if x in a_list: print x OR simply, how to test if a vector contain a value? Thank you in advance, Hyunchul [[alternative HTML version deleted]]
2010 Sep 03
4
function to compare numbers
Hi, all is there a built-in function to compare two numbers? something like following function cmp <- function(x, y){ value <- 0 if (x > y){ value <- 1 }else if (x == y){ value <- 0 }else { value <- -1 } return(value) } Thanks in advance, Hyunchul [[alternative HTML version deleted]]
2010 Aug 30
2
listing files recursively
Hi, all how to get all filenames in a directory and its all subdirectories? something like filenames <- c(Sys.glob('/path/to/directory/*'), Sys.glob('/path/to/directory/*/*'), Sys.glob('/path/to/directory/*/*/*'), ...) Thanks in advance, Hyunchul [[alternative HTML version deleted]]
2010 Aug 29
2
take component names of a list
Hi, all I want to take a vector of component names of a list. list.a <- list('x'=1, 'y'=2) how to get a c('x','y') from list.a? Thanks in advance, Hyunchul [[alternative HTML version deleted]]
2010 Sep 19
2
get time as a number
Hi, all, How to get a time as a number? While script is running, I want to print the elapsed time something like TIME_AS_SECOND() in the following script inittime <- TIME_AS_SECOND() for (i in 1:100){ do_something(i) curtime <- TIME_AS_SECOND() elapsedtime <- curtime-inittime print(paste(i, elapsedtime)) } Thanks in advance, Hyunchul [[alternative HTML version
2008 Feb 19
4
How to join path with arguments
Hi, all How to format and join strings ? For example, like following short python examples. ********* name1 = 'sample-plot' filename = '%s.png' % name1 inputdir = '/path/to/dir' os.path.join(inputdir, filename) ********** Best, Hyunchul Kim [[alternative HTML version deleted]]
2010 Aug 29
1
how to take a os.path.basename
Hi, all I made a simple R script to take the basename of a file without directory names. path.splitted <- strsplit('/path/to/a_basename', '/') path.length <- length(path.splitted[[1]]) basename <- path.splitted[[1]][path.length] # basename <- 'a_basename' Is there a simple function for this? something like os.path.basename(a_filename) of python? Thanks in
2010 Sep 04
1
how to free memory? (gc() doesn't work for me)
Hi, all I have a huge object that use almost all of available memory. R> rm(a_huge_object) R> gc() doesn't free memory and ?gc doesn't show anything. Are there any suggestion? Thanks in advance, Regards, Hyunchul [[alternative HTML version deleted]]
2008 Feb 19
1
How to count from larger value to smaller value in ecdf (Empirical Cumulative Distribution Function)
Hi, all ecdf function (Empirical Cumulative Distribution Function) in "stats" package counts from smaller values to larger values. However, I want to draw it by counting from larger value to smaller values and I couldn't find options for this purpose. How can I draw ecdf or ecdf like graph by counting from larger values to smaller values. Thank you in advance. Hyunchul Kim
2008 Aug 11
2
How to specify the type and size of font in bitmap format output?
Hi, all I need to specify a font (for example, type=helvetica and size=10) in bitmap output (for example, dev.print(bitmap, 'test.png'). How can I do this? Thanks. Hyunchul [[alternative HTML version deleted]]
2008 Mar 06
1
histogram like x labels in barplot
Hi, all I drew a barplot with > barplot(data1, beside=TRUE) and then, I want to labels with hist() like x-axis ticks. How can I do this? Thanks in advance, Hyunchul
2012 Aug 13
4
if else elseif for data frames
Hi all, It seems like I cannot use normal 'if' for data frames. What would be the best way to do the following. if data$col1='high' data$col2='H' else if data$col1='Neutral' data$col2='N' else if data$col='low' data$col2='L' else #chuch a warning? Note that col2 was not an existing column and was newly assigned for this
2016 Feb 01
1
Wrong config check for __libc_stack_end
>>>>> Simon Urbanek <simon.urbanek at r-project.org> >>>>> on Mon, 1 Feb 2016 08:36:56 -0500 writes: > On Feb 1, 2016, at 4:16 AM, Martin Maechler <maechler at stat.math.ethz.ch> wrote: [..............] >> Back to R: I'm not familiar with that part of the code, neither >> the configuration, nor the usage (in
2008 Apr 28
5
Combine Values into a Vector or List
Hi all, I have the following x1<-paste("A", 1:6, sep = "") x2<- round(rgamma(6,2,1)) x3<-paste("B", 1:6, sep = "") x4<- round(rgamma(6,2,1)) data1 <- data.frame(x1,x2,x3,x4) I would like to get data2 <- c(A1=4, A2=1, A3=0,...) Is there any standard for such a case? Thank you very much in advance, Diego
2007 Dec 13
6
ls() pattern
Hello everyone, I get some data in the following format and I would like to combine them to form a dataframe. The data is like: cbcname1 = 0.1, cbcname2= 0.2, cbcname3=0.3,... name1, name2, name2 are just some random names. I would like to achieve sth like: (cbcname1=0.1, cbcname2=0.2, cbcname3=0.3,......) I am using the following codes do.call(cbind,
2007 Dec 06
2
Any package for deconvolution?
I want to run deconvolution of a time series by an impulse or point-spread function through Wiener filter, regularized filter, Lucy-Richardson method, or any other approaches. I searched the CRAN website and the mailing list archive, but could not find any package for such a deconvolution analysis. Does anybody know an existing R function for deconvolution? TIA, Gang
2006 Oct 31
5
Odd behaviour of removing 'nothing' from an array or data frame
I've just found some behaviour which strikes me as odd, but I'm not sure whether it's a bug or a feature. If you don't mind, I'd like to explain via a couple of examples. Let x = 1:10. Then intuitively, to me at least, the command x[-integer(0)] should leave x untouched. However the actual output under R2.4.0 is integer(0). A slightly more involved example demonstrates
2008 Sep 18
3
Oja median
Hi, Can we get the code for calculating Oja median for multivariate data Thanks and Regards Rahul Agarwal Analyst Equities Quantitative Research UBS_ISC, Hyderabad On Net: 19 533 6363 [[alternative HTML version deleted]]
2008 Jan 17
4
aaMI
hi i am new to R language. I want to use aaMI package which calculates the amino acid mutual interaction for a given protein sequence. I had installed the package but when i run the program it gives me the error could not find function "aaMI". can anyone tell me what might be the problem.. -- View this message in context: http://www.nabble.com/aaMI-tp14915744p14915744.html Sent from
2003 Mar 26
2
ifelse()
Hi, I'm not sure if this can be done but.. I know that with ifelse() I can do something like: ifelse(x <= 3, 1, 2) to go through each element in my vector x, and if x_i <= 3 substitute the number with 1 else with 2. Essentially I'll get a vector with 2 levels. Can I tweak it so I can get 3-levels? For example: if(x <= 3) then 1 elseif(3 < x <= 4) then 2