search for: somecol

Displaying 9 results from an estimated 9 matches for "somecol".

Did you mean: simecol
2017 Nov 06
4
For each entry type in column?
It?s sometimes faster to ask from someone who has already learnt the syntax. In this case one has to do e.g. names(data$somecol) To get the collection and then iteration through it is almost like in Python: for(i in names(data$somecol)) { # do something } > Bert Gunter <bgunter.4567 at gmail.com> kirjoitti 6.11.2017 kello 19.55: > > Time to go through a tutorial or two! -- This forum cannot replace suc...
2017 Nov 06
0
For each entry type in column?
Hello, If you want to loop through the columns of a data.frame you can do for(i in names(df)){ [code] } Another way would be lapply(names(df), function(somecol) class(df[[somecol]])) where class(df[[somecol]]) is just an example, you would use whatever fits your needs. When you say that the column in question holds "levels" do you mean it's a factor? (factors are R's categorical variables.) Hope this helps, Rui Barradas Em 06-11-...
2017 Nov 06
2
For each entry type in column?
...On Nov 6, 2017, at 2:49 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote: > > Hello, > > If you want to loop through the columns of a data.frame you can do > > for(i in names(df)){ > [code] > } > > Another way would be > > lapply(names(df), function(somecol) class(df[[somecol]])) > > where class(df[[somecol]]) is just an example, you would use whatever fits your needs. > > When you say that the column in question holds "levels" do you mean it's a factor? (factors are R's categorical variables.) > > Hope this help...
2017 Nov 06
0
For each entry type in column?
...as at sapo.pt> wrote: > > > > Hello, > > > > If you want to loop through the columns of a data.frame you can do > > > > for(i in names(df)){ > > [code] > > } > > > > Another way would be > > > > lapply(names(df), function(somecol) class(df[[somecol]])) > > > > where class(df[[somecol]]) is just an example, you would use whatever > fits your needs. > > > > When you say that the column in question holds "levels" do you mean it's > a factor? (factors are R's categorical variables...
2006 Apr 01
1
STI with_scope on parent - bug or feature?
Hi, It seems that setting a with_scope on the parent class doesn''t do anything MyClass.with_scope(:find=>{:conditions=> ["somecol = ?", ''val'']}) do @ext_pages, @ext_rows = paginate :my_extended_class, { :per_page => 13 } end # this doesn''t generate WHERE somecol=''val'' In order for scope to work you have to call with_scope on the specialized class you''l...
2017 Nov 06
0
For each entry type in column?
Time to go through a tutorial or two! -- This forum cannot replace such self study. Your query evidences some basic confusion, but ?tapply or the equivalent lapply(split(...)) construct are most likely relevant. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his
2001 Nov 27
2
accessing information in data.frame
After reading a data.frame using, such as a <- read.spss("data.sav") I want to give the column index 'i', or a[i] to a function, which after some calculation, should print out the results to the standard output. I am struggling how to access the data itself, as e.g. sum(a[i]) does not work in this context. In addition I need to know the name of the variable within the
2017 Nov 06
4
For each entry type in column?
How can I do a for loop that does to a data.frame column what: for x in xs: does in Python? Obviously the data.frame column in question holds "levels". What if the data.frame is in matrix form? BR, Matti
2011 Oct 11
2
SLOW split() function
dear R experts: ?apologies for all my speed and memory questions. ?I have a bet with my coauthors that I can make R reasonably efficient through R-appropriate programming techniques. this is not just for kicks, but for work. for benchmarking, my [3 year old] Mac Pro has 2.8GHz Xeons, 16GB of RAM, and R 2.13.1. right now, it seems that 'split()' is why I am losing my bet. ?(split is an