Displaying 20 results from an estimated 3000 matches similar to: "How to get the name of the first argument in an assignment function?"
2006 Aug 03
2
get() in sapply() in with()
Dear All,
applying some function within a with() function I wanted to use also
sapply() and get() to form a data.frame, but did not succede.
Below is a simplified example.
It is possible to use sapply() within a with() function, it is also
possible to use get() within a with() function, but when I try to use get
within sapply within with I arrive at "Error in get(x, envir, mode,
inherits) :
2009 Jan 05
1
error message of RODBC...
channel <- odbcConnectExcel("nuova tabella terapia occupazionale mod.xls")
> ## list the spreadsheets
> sqlTables(channel)
TABLE_CAT
TABLE_SCHEM TABLE_NAME
1 c:\\TABELLE DEFINITIVE\\nuova tabella terapia occupazionale mod
<NA> 'emi tot 2006 OAI_60g TO FU1$'
2 c:\\TABELLE DEFINITIVE\\nuova
2005 Aug 10
5
how to write assignment form of function
Dear All,
where can I find information about how to write an assigment form of a
function?
For curiosity I tried to write a different form of the levels()-function,
since the original method for factor deletes all other attributes of a factor.
Of course, the simple method would be to use instead of levels(x) <-
newlevels, attr(x, 'levels') <- newlevels.
I tried the following:
##
2004 Nov 30
6
How to know if a bug was recognised
Hello!
A problem with special characters seemed to me to be a bug. I sent a mail
to R-windows at r-project.org concerning the problem (see below).
How can I find out, if this is considered as a bug or an error of myself?
Which part of FAQs or documentation did I miss to find the answer?
thanks in advance
Heinz T??chler
-------------------- copy of abovementioned mail ----------
to: R-windows
2005 Sep 08
3
change in read.spss, package foreing?
Dear All,
it seems to me that the function read.spss of package foreign changed its
behaviour regarding factors. I noted that in version 0.8-8 variables with
value labels in SPSS were transformed in factors with the labels in
alphabetic order.
In version 0.8-10 they seem to be ordered preserving the order
corresponding to their numerical codes in SPSS.
However I could not find a description of
2005 Sep 08
3
change in read.spss, package foreing?
Dear All,
it seems to me that the function read.spss of package foreign changed its
behaviour regarding factors. I noted that in version 0.8-8 variables with
value labels in SPSS were transformed in factors with the labels in
alphabetic order.
In version 0.8-10 they seem to be ordered preserving the order
corresponding to their numerical codes in SPSS.
However I could not find a description of
2005 Feb 04
5
How to access results of survival analysis
Hello,
it seems that the main results of survival analysis with package survival
are shown only as side effects of the print method.
If I compute e.g. a Kaplan-Meier estimate by
> km.survdur<-survfit(s.survdur)
then I can simply print the results by
> km.survdur
Call: survfit(formula = s.survdur)
n events median 0.95LCL 0.95UCL
100.0 58.0 46.8 41.0 79.3
Is
2009 Sep 28
4
How to assess object names within a function in lapply or l_ply?
Dear All,
to produce output of several columns of a data frame, I tried to use
lapply and also l_ply. In both cases, I would like to print a header
line containing also the name of the respective column in the data frame.
For example, I would like the following
lapply(data.frame(a=1:3, b=2:4), function(x) print(deparse(substitute(x))))
to produce:
[1] "a"
[1] "b"
and
2005 Aug 02
3
how to print a data.frame without row.names
Dear All,
is there a simple way to print a data.frame without its row.names?
example:
datum <- as.Date(c("2004-01-01", "2004-01-06", "2004-04-12"))
content <- c('Neujahr', 'Hl 3 K.', 'Ostern')
df1 <- data.frame(datum, content)
print(df1)
datum content
1 2004-01-01 Neujahr
2 2004-01-06 Hl 3 K.
3 2004-04-12 Ostern
Can I get
2006 May 24
3
How to make attributes persist after indexing?
Dear All!
For descriptive purposes I would like to add attributes to objects. These
attributes should be kept, even if by indexing only part of the object is
used.
I noted that some attributes like levels and class of a factor exist also
after indexing, while others, like comment or label vanish.
Is there a way to make an arbitrary attribute to be kept after indexing?
This would be especially
2005 Apr 02
4
factor to numeric in data.frame
Dear All,
Assume I have a data.frame that contains also factors and I would like to
get another data.frame containing the factors as numeric vectors, to apply
functions like sapply(..., median) on them.
I read the warning concerning as.numeric or unclass, but in my case this
makes sense, because the factor levels are properly ordered.
I can do it, if I write for each single column
2006 May 23
4
How to call a value labels attribute?
Dear All,
after searching on CRAN I got the impression that there is no standard way
in R to label values of a numerical variable.
Since this would be useful for me I intend to create such an attribute, at
the moment for my personal use.
Still I would like to choose a name which does not conflict with names of
commonly used attributes.
Would value.labels or vallabs create conflicts?
The
2009 Apr 08
2
factor, as.factor and levels
Dear All,
to my surprise as.factor does not accept a levels argument. Maybe I
did not read the documentation well enough. See the example below. I
wanted to use ch1 as factor in the newdata argument of survfit, so I
assumed that I could write as.factor(ch1, levels=ch1), since the
order should be kept.
But as.factor(ch1, levels=ch1) results in the error:
Error in as.factor(ch1, levels = ch1)
2005 Mar 29
3
From FAQ 7.21 to a command like apply(sapply(list(f1,f2,f3),is.na),2,sum)
Dear all,
Last December there was a thread regarding the famous FAQ 7.21 "How can I
turn a string into a variable?" and asking what people want to do with
these strings.
My, certainly trivial application would be as follows:
Assume I have a data.frame containing besides others also the columns f1,
f2, ..., fn and I want to create a command like:
apply(sapply(list(f1,f2,f3),is.na),2,sum)
2004 Nov 30
1
Attn Heinz Tuechler: Re: problem with special characters (ä,ö,ü)
[I tried to send this message privately, but the return address
bounced.]
I think this has been fixed in R-patched, but I doubt if the fix has
been tested in Win98. Could you please download a copy from
<http://cran.r-project.org/bin/windows/base/rpatched.html> and confirm
that it has been fixed?
Duncan Murdoch
On Sat, 27 Nov 2004 23:31:23 +0100, Heinz Tuechler <tuechler at gmx.at>
2012 Jun 11
3
[LLVMdev] scoreboard hazard det. and instruction groupings
On Mon, 11 Jun 2012 10:48:18 -0700
Andrew Trick <atrick at apple.com> wrote:
> On Jun 11, 2012, at 9:30 AM, Hal Finkel <hfinkel at anl.gov> wrote:
>
> > I'm considering writing more-detailed itineraries for some PowerPC
> > CPUs that use the 'traditional' instruction grouping scheme. In
> > essence, this means that multiple instructions will stall
2005 Feb 17
5
Again: Variable names in functions
Hello,
still I have difficulties with variable names in functions. I know the
famous example form help for deparse/substitute but I will give a simpler
one to explain my problem.
I know from Reid Huntsinger (Tue, 8 Feb 2005 12:39:32 -0500) that:
"Semantically, R is pass-by-value, so you don't really have the names, just
the values. In implementation, though, R *does* pass names, in part
2005 Feb 08
5
How to get variable names in a function?
Hello,
applying a function to a list of variables I face the following problem:
Let's say I want to compute tables for several variables. I could write a
command for every single table, like
bravo<-c(1,1,2,3,5,5,5,);charly<-c(7,7,4,4,2,1)
table(bravo); table(charly)
> table(bravo); table(charly)
bravo
1 2 3 5
2 1 1 3
charly
1 2 4 7
1 1 2 2
The results are two tables with the
2003 Aug 14
1
gnls - Step halving....
Hi all,
I'm working with a dataset from 10 treatments, each
treatment with 30 subjects, each subject measured 5
times. The plot of the dataset suggests that a
3-parameter logistic could be a reasonable function to
describe the data. When I try to fit the model using
gnls I got the message 'Step halving factor reduced
below minimum in NLS step'. I´m using as the initial
values of the
2010 Dec 31
3
survexp - example produces error
Dear All,
reposting, because I did not find a solution, maybe someone could
check the example below.
It's taken from the help page of survdiff. Executing it, gives the error
"Error in floor(temp) : Non-numeric argument to mathematical function"
best regards,
Heinz
library(survival)
## Example from help page of survdiff
## Expected survival for heart transplant patients based