Displaying 20 results from an estimated 3000 matches similar to: "referencing headers to extract components of a data frame"
1997 Aug 20
1
R-alpha: R-0.50-a3(+) Method despatching bug ?
It is very wierd... Can some of you confirm the following behavior ?
It is a new bug (feature ?) which was not yet in 0.49 ...
noquote <- function(obj) {
## constructor for a useful "minor" class
if(!inherits(obj,"noquote")) class(obj) <- c(class(obj),"noquote")
obj
}
"[.noquote" <- function (x, subs) structure(unclass(x)[subs], class =
2020 Nov 05
1
Named class vector
The source to the noquote() function looks like this:
noquote <- function(obj, right = FALSE) {
## constructor for a useful "minor" class
if(!inherits(obj,"noquote"))
class(obj) <- c(attr(obj, "class"),
if(right) c(right = "noquote") else "noquote")
obj
}
Notice what happens with right =
1997 Aug 15
1
R-alpha: (minor?) S-R inconsistency: NULL =~= list() -- useful is.ALL function
In S,
NULL
and
list()
are not the same.
In R they are (I think).
---------------------------------------------------
At least,
is.list(NULL) #-> 'F' in S; 'TRUE' in R
Yes: I had an instance where this broke correct S code:
match(c("xlab","ylab"), names(list(...)))
when '...' is empty,
gives an error in R,
but gives
c(NA,NA)
in S.
2011 Jan 24
2
normality and equal variance testing
I currently have a program that automates 2-way ANOVA on a series of endpoints,
but before the ANOVA is carried out I want the code to test the assumptions of
normality and equal variance and report along with each anova result in the
output file. How can I do this?
I have pasted below the code that I currently use.
library(car)
numFiles = x #
2009 Aug 11
1
Passing a list object to lapply
Hello,
I'm having difficulty passing an object name to a lapply function. Can
somebody tell me the trick to make this work?
#Works
T13702 <- TRACKDATA[["13702.xls"]][["data"]]
min(unlist(lapply(list(T13702), function(x) mdy.date(x[1, 2], x[1, 1],
x[1, 3]))))
16553
#Works
d<-2
assign(paste("T",substr(names(TRACKDATA)[d],1,(nchar(names(TRACKDATA)[d]
2008 Jun 15
1
c.noquote() weirdness
I haven't been able to get anywhere tracking this down. It seems that c.noquote() does
something strange with its third (and subsequent) parameters:
R-2.7.0 under NetBSD, R-2.6.0 under Solaris, and R-2.8.0 (unstable) (2008-06-10 r45893)
under WinXP, I get:
> c(noquote('z'), 'y', 'x', '*')
[1] z y x * x *
>
or:
> c(noquote('z'),
2002 Jun 02
2
selections using text strings (result of noquote)
G'day all,
I am trying to use a string as an argument in a selection but things are
not working as I expect, seems the selection is not seeing the expanded
string and I do not know how to make it. Perhaps the noquote class value
that is returned is the problem.
Here is an example.
> selection #this is my string
[1] "attackprogress$Se=='Toona ciliata [19825: JMM35]'"
2011 Mar 30
1
Class noquote to matrix
Hi,
I apologize if the solution is right in front of me, but I can't find anything on how to convert a class of 'noquote' to 'matrix'. I've tried as.matrix and I've tried coercing it by 'class(x)<-matrix', but of course that didn't work. I've been using the function 'symnum' which returns an object of class 'noquote'.
Here is an
2017 Oct 13
1
Quotation marks hinder for loop
Dear mailing list members,
My question is maybe very basic, but I could not find the solution.
I would like to do the following things
1)
colnames(V1)[2] <- par$V2[1]
colnames(V2)[2] <- par$V2[2]
colnames(V3)[2] <- par$V2[3]
...
colnames(V37)[2] <- par$V2[37]
2)
V1 <- V1[,-1]
V2 <- V2[,-1]
V3 <- V3[,-1]
...
V37 <- V37[,-1]
3)
ms <- merge(V1,V2)
ms <- merge(ms,V3)
2009 Apr 07
3
write text file as output without quotes
Hi R,
When I use the below to write the text file
try=data.frame(rep("a",5), rep("b",5))
write.table(try,"z:\\try.txt",row.names=F,col.names=F,sep="\t")
the output contains two columns with quotes! Is there a way to write
without quotes?
I tried
try[,1]=noquote(try[,1])
try[,2]=noquote(try[,2])
Thank you,
Regards,
Ravi Shankar
2009 Jan 05
1
How to extract range of colums in a data frame
Dear all,
I have the following data frame:
> dat
V1 V2 V3 V4 V5 V6 V7 V8 V9
1 1 AAAACACCCACCCCCCCCCCCCCCCCCCCCCCCC 9.0 18 12.00 18.0 15.0 12.0 6.0
2 1 ACGATACGGCGACCACCGAGATCTACACTCTTCC 18.0 8 12.00 18.0 15.0 12.0 18.0
3 1 ACTACTGCTCCCCCCCCACTCCCCCCCCCCCCCC 15.0 8 12.00 12.0 18.0 12.0 12.0
4 1 ACTTATACGGCGACCACCGAGATCTACACTCTTT 15.0
2013 Mar 07
1
Error: no 'dimnames' attribute for array
Dear XpeRts,
I prepared a no qoute Character string by the following command
s<-noquote(paste (b1, collapse=","))
where, b1 is the vector of 24 intergers.
> dput(b1)
c(1L, 2L, 6L, 7L, 12L, 16L, 17L, 20L, 21L, 23L, 25L, 34L, 46L, 48L, 58L, 64L, 65L, 68L, 82L, 97L, 98L, 101L, 113L, 115L)
> dput(s)
2010 Aug 21
1
R-level expansion of Rplot%03d.png
Dear list,
I'm using the brew package to generate a report containing various
plots. I wrote a function that creates a plot in png and pdf formats,
and outputs a suitable text string to insert the file in the final
document using the asciidoc syntax,
<%
tmp <- 1
makePlot = function(p, name=paste("tmp",tmp,sep=""), width=300)
{
2009 Mar 23
2
Looping of read.table and assignment
Dear all,
I am trying to read in and assign data from 50 tables in an automated fashion. I have the following code, which I created with the help of textbooks and the internet, but it only seems to read in the final data file over and over again. For example, when I type:> table_1951 I get the same values in the table as when I type> table_2000 despite the values in the source tables
2007 Nov 30
1
No quote
Hello,
I define a dataframe named "Price" first and there are other dataframes as
well. Then I built an array named "code" containing all the dataframe name.
So If I call code[1], it is "Price".
Basicly, I would like to call the datafram with reference to the
array"code".e,g, If I want to call dataframe
"Prices", I use sth containing code[1]. It
2009 Aug 20
0
Using 'unlist' (incorrectly?!) to collate a series of objects
Dear R Users,
I am attempting to write a new netCDF file (using the ncdf) package, using 120 grids I've created and which are held in R's memory.
I am reaching the point where I try to put the data into the newly created file, but receive the following error:
> put.var.ncdf(evap_file, evap_dims, unlist(noquote(file_list)))
Error in put.var.ncdf(evap_file, evap_dims,
2010 May 16
1
improvement
Hi, if i just want a vector filled with names which has length(index) > 0.
For example if
nombreC <- c("Juan", "Carlos", "Ana", "Mar?a")
nombreL <- c("Juan Campo", "Carlos Gallardo", "Ana Iglesias", "Mar?a
Bacaldi", "Juan Grondona", "Dario Grandineti", "Jaime Acosta",
2002 Sep 10
0
Old-style classes: bug fix & request
Bug fix:
A bug introduced in version 1.6 failed to "initialize" some old-style
(aka "S3") classes, producing possible warning messages if those classes
were used in the signature of a method in the methods package.
The real bug, though, was that old-style inheritance could not be
included, until the setOldClass function was provided. Initializing the
methods package now
2017 Sep 19
0
remove quotes from matrix
Works fine for me. What do you object to in the following?
Calling the above df "d",
> dm <- as.matrix(d)
> dm
Sub_Pathways BMI_beta SAT_beta VAT_beta
1 "Alanine_and_Aspartate" " 0.23820" "-0.02409" " 0.94180"
2 "Alanine_and_Aspartate" "-0.31300" "-1.97510" "-2.22040"
3
2008 Feb 04
1
Concatenation and Evaluation
Hello all,
I've run into what I bet is a silly problem; however, I've been
trying to get around it now for a couple weeks and every time I think
I have the answer it still doesn't work. So I apologize in advance
if this is painfully obvious, but I've run out of ideas and would
really appreciate any input.
My situation is this, I'm importing a number of tab