similar to: Binding one column of characters into a dataframe factors other numeric columns

Displaying 20 results from an estimated 20000 matches similar to: "Binding one column of characters into a dataframe factors other numeric columns"

2011 Apr 28
1
Subscript out of Bounds
I currently have this code: for(j in 2:n){ for(i in 1:(j-1)){ # Make sure the inputs are for the matrix "m" input1=rownames(m)[i] input2=colnames(m)[j] q=t[(t$Rec1==input1 & t$Rec2==input2),output] if(length(q)==0){ q=t[(t$Rec1==input2 & t$Rec2==input1),output] } m[i,j]=mean(q) m[j,i]=mean(q) m[j,j]=mean(q) }} I already created a
2005 Dec 02
3
extracting rows of a dataframe
Hi look at the following session, in which I have a dataframe, and I want to extract the second row, without the first column. Everything works as expected until the last line, where I set the names of x to NULL, and get a non-desired object (I want c(4,3).). Three questions: (1) why is as.vector(a[2,-1]) not a vector? (2) How come setting names to NULL gives me bad weirdness? (3) Can I
2019 Nov 17
2
Inappropriate class(o)[!inherits(o,"AsIs")] in get_all_vars
SVN?revision?77401?changes ????????x[isM]?<-?lapply(x[isM],?function(o)?`class<-`(o,?class(o)[class(o)?!=?"AsIs"])) to ????????x[isM]?<-?lapply(x[isM],?function(o)?`class<-`(o,?class(o)[!inherits(o,"AsIs")])) in?function?'get_all_vars'?in?src/library/stats/R/models.R?in?R?devel. The?change?is?inappropriate.
2019 Nov 18
2
Inappropriate class(o)[!inherits(o,"AsIs")] in get_all_vars
>>>>> Martin Maechler >>>>> on Mon, 18 Nov 2019 12:15:38 +0100 writes: >>>>> suharto anggono--- via R-devel >>>>> on Sun, 17 Nov 2019 10:34:31 +0000 writes: >> SVN revision 77401 changes >> x[isM] <- lapply(x[isM], function(o) `class<-`(o, class(o)[class(o) != "AsIs"])) >> to
2013 Jun 19
2
knitr without R studio
Hello folks, I`m using knitr on R studio, which make it easy to use, but a coworker of mine would like to run it on "simple" R. So I was wondering if you know what is the equivalent of the button "knit HTML" in RStudio in R. I tried knit2HTML( <html> <head> <title></title> </head> <body style="background-color:white">
2002 May 29
1
warning message for setAs when using class AsIs
This seemed too advanced for r-help and is related to the recent discussion of character vectors in dataframes. Following Brian Ripley's most excellent advice, we are moving to a world in which character vectors in dataframes are always of class AsIs. The cool way of doing this seemed to be the following: > cat(c("x", "y", "z"), file = "test.txt",
2009 Sep 14
2
problems with reshape
Hello * I would like to reshape wide the following dataset: > rl <- read.dta("intermedi/rapporti_lavoro.dta") [c("id_rl","prog","sil_pi","sil_cf","sil_dat_avv")] > dim(rl) [1] 12964 5 > object.size(rl) 1194728 bytes > head(rl) id_rl prog sil_pi sil_cf sil_dat_avv 1 638 1 04567XXXXXX
2010 Jan 14
2
Fixed size permutations
I'm using functions to return a matrix of all permutations of a specified size from a larger list for predictor selection. For each predictor size I use a seperate function like this: bag2 <- function(n) { rl <- c() for (i1 in seq(n)) { for (i2 in seq(n)) { if (length(unique(c(i1,i2)))==1) {next} rl <- cbind(rl,matrix(c(i1,i2))) } }
2020 Oct 30
2
Change to I() in R 4.1
Hi Martin, On 10/26/20 04:52, Martin Maechler wrote: >> >> Hi there, >> Is that change in R-devel intentional? >> >> library(Matrix) >> m <- as(matrix(c(0, 1)), "sparseMatrix") >> >> isS4(m) >> # [1] TRUE >> >> x <- I(m) >> # Warning message: >> # In `class<-`(x,
2020 Mar 29
2
is.vector could handle AsIs class better
Dear R-devel, AsIs class seems to be well handled by `typeof` and `mode` function. Those two functions are being referred when explaining `is.vector` behaviour in manual. Yet `is.vector` does not seem to be handling AsIs class the same way. is.vector(1L) #[1] TRUE is.vector(I(1L)) #[1] FALSE Is there any reason behind this behaviour? Could we have it supported so AsIs class is ignored when
2020 Mar 30
1
is.vector could handle AsIs class better
Thank you Gabriel, Agree, although I think that could be relaxed in this single case and AsIs class could be ignored. Best, Jan On Sun, Mar 29, 2020 at 7:09 PM Gabriel Becker <gabembecker at gmail.com> wrote: > > Jan, > > I believe it's because it has "a non-NULL attribute other than names" as per the documentation. In this case its class of "AsIs". >
2008 Jul 16
2
Group level frequencies
Dear List, I have Multi-level Data i= Indivitual Level g= Group Level var1= First Variable of interest var2= Second Variable of interest and I want to count the frequency of "var1" and "var2" on the group level. I found a way, but there must be a much simpler way. data.ml <- data.frame(i=c(1:8),g=as.factor(c(1,1,1,2,2,3,3,3)),var1=c(3,3,3,4,4,4,4 ,4),
2020 Oct 30
1
[External] Re: Change to I() in R 4.1
On Fri, 30 Oct 2020, Pages, Herve wrote: > > On 10/29/20 23:08, Pages, Herve wrote: > ... >> >> I can think of 2 ways to move forward: >> >> 1. Keep I()'s current implementation but suppress the warning. We'll >> make the necessary adjustments to DataFrame() to repair columns supplied >> as I(<S4>) objects. Note that we would still be in
2002 Feb 08
1
looping through lists...
Hi, all. I have a whole group of lists with things like this: nw.1$cond (a string) nw.1$RL (a vector of 10 values) nw.1$IL (a vector of 10 values) and I have lots of these lists: nw.201 nw.202 nw.203 ... what I'd like to do is be able to get specific values from all these lists (like the mean of $RL) for each indivividual list. I can certainly do this manually
2006 Jul 31
4
question about dataframe ("sensory") in PLS package
Dear all, I am trying to my dataframe for the PLS analysis using the PLS package. However I have some trouble generating the correct dataframe. The main problem is how to use one name to represent several columns in the dataframe. The example dataframe in PLS package is called "sensory". I cannot directly read the data file since it's a binary file. If I use
2014 Nov 13
4
[PATCH 0/4 v3] readline escaping functions
Helper functions for future support of backslash escaped spaces in filenames. There are a few tests too. Changed according to review remarks and fixed few other mistakes. Maros Zatko (4): fish: copy parse_quoted_string and hexdigit from fish.h to rl.c fish: rl.{c,h} - escaping functions for readline fish: basic tests for readline escaping autotools: add fish/test Makefile.am
2020 Oct 23
2
Change to I() in R 4.1
Hi there, Is that change in R-devel intentional? library(Matrix) m <- as(matrix(c(0, 1)), "sparseMatrix") isS4(m) # [1] TRUE x <- I(m) # Warning message: # In `class<-`(x, unique.default(c("AsIs", oldClass(x)))) : # Setting class(x) to multiple strings ("AsIs", "dgCMatrix", ...); result will no longer be an S4 object
2012 Jan 30
1
Problem in Fitting model equation in "nls" function
Dear R users,   I am struggling to fit expo-linear equation to my data using "nls" function. I am always getting error message as i highlighted below in yellow color:     ### Theexpo-linear equation which i am interested to fit my data:       response_variable =  (c/r)*log(1+exp(r*(Day-tt))), where "Day" is time-variable   ## my response variable   rl <-
2009 Nov 02
1
two small wishes (with code sugegstions) for R-core
Dear R developers, It would be great if you could implement the two minor code changes suggested below, which would help processing large objects in R. Jens Oehlschl?gel # Wish no. 1: let [.AsIs return the class AFTER subsetting, not the class of the original object # Wish no. 2: adjust write.csv and write.csv2 for multiple calls in chunked writing # Rationale no. 1: a couple of packages
2002 May 21
1
I() fails on objects of class POSIXct (PR#1587)
Although the documentation is somewhat sketchy, I() can be used to create objects of class AsIs: > I("a") [1] "a" attr(,"class") [1] "AsIs" "character" > I(4) [1] 4 attr(,"class") [1] "AsIs" "numeric" > I(4 + 0i) [1] 4+0i attr(,"class") [1] "AsIs" "complex" > This