Displaying 20 results from an estimated 10000 matches similar to: "RE: [R] as.character methods"
2005 Jan 13
3
as.character methods
Hello,
?as.character says that the as.character function is a generic with
usage: as.character(x, ...). So, I want to create an S4 object with an
as.character method following the above usage, but I get the below error
telling me that ... isn't in the generic for as.character.
> setClass("tmp", "numeric")
> setMethod("as.character", "tmp",
2005 Jan 13
3
as.character methods
Hello,
?as.character says that the as.character function is a generic with
usage: as.character(x, ...). So, I want to create an S4 object with an
as.character method following the above usage, but I get the below error
telling me that ... isn't in the generic for as.character.
> setClass("tmp", "numeric")
> setMethod("as.character", "tmp",
2007 May 25
2
File path expansion
R-Help,
I discovered a "mis-feature" is ghostscript, which is used by the bitmap
function. It seems that specifying file names in the form "~/abc.png"
rather than "/home/directory/abc.png" causes my GS to crash when I open
the bitmap device on my Linux box.
The easiest solution would seem to be to intercept any file names in the
form "~/abc.png" and replace
2005 Jan 27
3
Indexing Lists and Partial Matching
I was unaware until recently that partial matching was used to index
data frames and lists. This is now causing a great deal of problems in
my code as I sometimes index a list without knowing what elements it
contains, expecting a NULL if the column does not exist. However, if
partial matching is used, sometimes R will return an object I do not
want. My question, is there an easy way of getting
2005 Jan 08
1
sub( , perl = TRUE) overflow (PR#7479)
I'd like to report a bug (buffer overflow?) in the function sub(..., perl = TRUE)
I wanted to implement the familiar perl function for removing white spaces before and after a character string:
sub trimwhitespace($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
So in R this would (presumably) become:
trimwhitespace <- function(x) {
x <-
2005 Jul 27
2
Redirecting Messages and Errors to a file
Hello all,
I'm trying to setup a simple construct that will email me all errors,
warnings, and output of a sample R script. My initial thought was to use
sink() and tryCatch around the script such that at the end of the script
any output would be mailed to me, i.e.:
sinkFile <- tempfile()
sink(sinkFile)
tryCatch({
[R script]},
finally = {
sink()
if (length(readLines(sinkFile)))
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
Hi,
I found the following on Windows 2000/NT
R Version 1.9.1 (2004-06-21) (also Version 1.9.0):
The S4 group "Math" doesn't work as documented; i.e., "log", "log10",
"gamma" and "lgamma" are included
in the documentation but don't work. See example code below.
Moreover, what about 'genericForPrimitive' which is used
in
2000 Mar 08
2
possible BUG with as.data.frame() and/or [.data.frame
Here is a possible BUG with as.data.frame() and/or [.data.frame which broke
Michael Lapsleys RODBC-Code.
Can anyone confirm it is a bug or a 'feature' of the prototype?
tablename <- "abc"
a <- as.data.frame(cbind("abc", 1:3))
b <- as.data.frame(cbind(tablename, 1:3))
# ok
> a
V1 V2
1 abc 1
2 abc 2
3 abc 3
# missing column name
> b
tablename
1
2005 Mar 26
2
Is there a diferent way to do this?
Hi,
I started creating a small class but I'm courious about how it is working.
To create a instance of my class "Partri" I write this at Rgui:
x <- new("Partri", name="Gilvan")
and to change the slot "name" of this instance, I write:
setName(x, newname="Justino")
It is not working, because when I type "x" at Rgui, it shows
2006 May 07
2
[LLVMdev] The Next Win32 File System Problem
Fixing one bug uncovers the next one...
To reproduce:
llvm-ar rc ./libgcc.a libgcc/./_muldi3.o <and-lots-more-.o-files...>
The result:
C:\msys\1.0\home\llvm_home\install\bin\llvm-ar.exe: Can't move './libgcc.a-000003' to './libgcc.a-000002': Cannot create a file when that file already exists.
So apparently, we're trying to move one file on top of another.
The
2006 May 07
0
[LLVMdev] The Next Win32 File System Problem
Yep, you found another bug. Unlike Unix, Windows does not allow a file
to be implicitly replaced via renaming. I'll fix it.
Greg Pettyjohn wrote:
> Fixing one bug uncovers the next one...
>
> To reproduce:
> llvm-ar rc ./libgcc.a libgcc/./_muldi3.o <and-lots-more-.o-files...>
>
> The result:
> C:\msys\1.0\home\llvm_home\install\bin\llvm-ar.exe: Can't move
2023 Jul 26
2
Rename Computer on Domain
I can report that the computer renaming worked.
As it turned out, only the cn was incorrect ...
ldbsearch -H ldap://DC1 -UAdministrator 'CN=DT06'
dn: CN=DT06,OU=Desktops,OU=Computers,DC=domain,DC=com
objectClass: computer
cn: DT06
operatingSystem: Windows 10 Pro
displayName: WH23$
sAMAccountName: WH23$
... so a simple LDAP rename worked ...
ldbrename -H ldap://DC1 -UAdministrator
2017 Jun 11
1
translateChar in NewName in bind.c
I see another thing in function 'NewName' in bind.c. In
else if (*CHAR(tag)) ,
'ans' is basically copied from 'tag'. Could the whole thing there be just the following?
ans = tag;
It seems to me that it can also replace
ans = R_BlankString;
in 'else'; so,
else if (*CHAR(tag))
and
else
can be merged to be just
else .
--------------------------------------------
2014 Jan 29
2
Rename computer, but still shows up as old name
Samba Version 4.1.4-SerNet-RedHat-7.el6
Using RSAT via Windows 8.1
--
For a computer that is on the domain, I rename it from the client, then
reboot. This renames the computer as expected. The common name in AD,
however, is not affected. Is there a way to do this? Am I missing a step?
Details: Using RSAT, I see the old computer name, not the new computer
name. If I double click on the entity,
2010 Oct 13
4
Change global env variables from within a function
Hi,
I've looked all over for a solution to this, but haven't had much look
in specifying what I want to do with appropriate search terms. Thus I'm
turning to R-help.
In the process of trying to write a simple function to rename individual
column names in a data frame, I ran into the following problem: When I
rename the columns within my function, I can't seem to get it to
2000 Sep 14
1
dynamically naming columns in a data frame
Hello All!
I have been working with R for the last couple of weeks and I am very
impressed with the capabilities. I am creating hundreds of tables and
need to dynamically name the columns.
Here is a small snippet of my code:
# Turn my clustering data into a data.frame object.
names( clusters ) <- Abbreviate( distMethods[ i ], hclustMethods[ j
] )
df <- data.frame( clusters,
2005 Jan 07
1
Creating unary operators
Is it correct (by its lack of mention in the R-Language Definition
Manual) that it is impossible to create a user-defined unary operator?
Ex: (This doesn't work, but it's an example of what I'm looking for)
> "%PLUSONE%" <- function(x) x + 1
> %PLUSONE% 2
[1] 3
And if the above is impossible, am I limited to only the + - ~ ! unary
operators for overloading?
On
2006 Oct 27
3
Suppress blanks/spaces in character
Hi all
I'm have a character vector and would like to suppress the blanks if there are more than one after the other.
Example:
Character value is: "abc def ghi"
The result should be: "abc def ghi"
I know that it's possible to delete the leading blanks with the command "trim". But how can I delete blanks within a character?
Thank you very much in
2000 Jun 25
1
renaming columns
I frequently get data sets with cryptically-named variables. The datasets
are more useful to me with informative variable names. I know that I can
rename variables using the following command:
dimname(dataset[[2]][index.of.variable.to.be.renamed]<-new.variable.name
If I want to do this inside a function (say something I call RenameCol)
what is the best way to communicate the
2007 Mar 30
2
Replacing slot of S4 class in method of S4 class?
Dear all,
Assume that I have an S4 class "MyClass" with a slot "myname", which
is initialized to: myname="" in method("initialize"):
myclass <- new("MyClass", myname="")
Assume that class "MyClass" has a method "mymethod":
"mymethod.MyClass" <-
function(object, myname=character(0), ...) {