Displaying 20 results from an estimated 5000 matches similar to: "how to take a os.path.basename"
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 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 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
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 May 01
3
elseif syntax
Hi, all
How to use elseif ?
For example, like following short python examples.
*********
x = 1
if x == 1:
print 'same'
*elif* x > 1:
print 'bigger'
else:
print 'smaller'
*********
Thanks in advance,
Hyunchul Kim
[[alternative HTML version deleted]]
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 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]]
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
How to count from larger value to smaller value in ecdf (Empirical Cumulative Distribution Function)
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
2003 Apr 08
1
IRIX compilation and openbsd-compat/basename.h
I was trying to compile openssh-3.6.1p1 on IRIX and ran across this
error while compiling progressmeter.c:
"/usr/include/libgen.h", line 35: error(1143): declaration is incompatible
with "char *basename(const char *)" (declared at line 9 of
"openbsd-compat/basename.h")
extern char *basename(char *);
^
1 error detected in the
2020 Jun 29
1
`basename` and `dirname` change the encoding to "UTF-8"
On 29/06/2020 10:39 a.m., Johannes Rauh wrote:
> Dear R Developers,
>
> I noticed that `basename` and `dirname` always return "UTF-8" on Windows (tested with R-4.0.0 and R-3.6.3):
>
>> p <- "F??/B?r"
>> Encoding(p)
> [1] "latin1"
>> Encoding(dirname(p))
> [1] "UTF-8"
>> Encoding(basename(p))
> [1]
2009 Sep 18
4
basename returns "." not in filename (PR#13958)
Full_Name: Jens Oehlschl?gel
Version: 2.9.2
OS: Win32
Submission from: (NULL) (85.181.152.156)
# Obviously an empty basename is allowed (if the filepath is a pure path)
> basename("/")
[1] ""
# but here we get the dot from the path
> basename("./")
[1] "."
> version
_
platform i386-pc-mingw32
2003 Apr 02
1
[Bug 531] Conflicting basename() on Irix
http://bugzilla.mindrot.org/show_bug.cgi?id=531
Summary: Conflicting basename() on Irix
Product: Portable OpenSSH
Version: 3.6p1
Platform: MIPS
OS/Version: IRIX
Status: NEW
Severity: major
Priority: P2
Component: Build system
AssignedTo: openssh-unix-dev at mindrot.org
ReportedBy: pere at
2009 Jan 09
4
Extracting File Basename without Extension
Dear all,
The basename() function returns the extension also:
> myfile <- "path1/path2/myoutput.txt"
> basename(myfile)
[1] "myoutput.txt"
Is there any other function where it just returns
plain base:
"myoutput"
i.e. without 'txt'
- Gundala Viswanath
Jakarta - Indonesia
2003 Mar 31
2
basename() in libgen
IRIX 6.5 has the basename() function in libgen.
SYNOPSIS
cc [flag ...] file ... -lgen [library ...]
#include <libgen.h>
char *basename (char *path);
-- ayamura
2020 Jun 30
1
`basename` and `dirname` change the encoding to "UTF-8"
On 6/29/20 4:39 PM, Johannes Rauh wrote:
> Dear R Developers,
>
> I noticed that `basename` and `dirname` always return "UTF-8" on Windows (tested with R-4.0.0 and R-3.6.3):
>
>> p <- "F??/B?r"
>> Encoding(p)
> [1] "latin1"
>> Encoding(dirname(p))
> [1] "UTF-8"
>> Encoding(basename(p))
> [1] "UTF-8"
2008 May 14
2
basename/dirname produce incorrect results
The incorrect result incurs when the file path contains Chinese character.
It seems that dirname/basename action on unit of byte instead of char, so
the result in the following example is half of what is expected.
> g<-"d:\\$BG!2L4^M-CfJ8(B\\$BG!2L4^M-CfJ8(B.txt"
> dirname(g)
[1] "d:/$BG!2L4^(B"
> basename(g)
[1] "$BG!2L4^M-(B"
--
HUANG Ronggui,
2005 Aug 19
2
File.basename issue
Hi all,
After a recent ruby-talk thread I decided to go back and refactor the
File.basename method in win32-file. Sure enough, after a I added some
more tests I discovered a couple minor bugs.
After reworking it, I still can''t get one test to pass. Specifically,
multiple trailing slashes. Here''s the test that shows the issue:
assert_equal("bar",