similar to: question: how to select a column from a dataframe in a function

Displaying 20 results from an estimated 900 matches similar to: "question: how to select a column from a dataframe in a function"

2003 Oct 31
1
strange sprintf() behaviour ?
This is quite strange behaviour - at least for R-novice as myself.... Consider this: > testf <- function() { x <-2; sprintf("%s %f", "x =", x); return(x) } > result <- testf() > testf <- function() { x <-2; sprintf("%s %f", "x =", x) } > result <- testf() > testf() [1] "x = 2.000000" Apparently adding return()
2007 Jul 14
1
Very basic question about REXML
Hello Everybody, I have pretty basic question abut REXML. I want to put the String "John doe" in titles array, if attribute name is equal to "93". Please see the code below. I could not find how to do it.. any help would be very appriciated. Here is the XML i am trying to parse <entrydata columnnumber="2" name="93"> <text>John
2005 Oct 05
2
problem accumulating array within a function over loops
Dear R helpers, I am having trouble with an array inside a loop. I wish to accumulate the results of a function in an array within the function, over several loops of a program outside the function. The problem is that the array seems to re-set at every entry to the function. Here is an example, so you can see what I mean.
2004 Dec 22
4
ordering levels
Hello! I would like to know if there is a simple way to reorder levels of a given factor.Let's say that the vector testf<-factor(c("red","red","red","blue","blue","white")) levels(testf) : blue red white should have reordered levels such as levels(testf) : red blue white (this is for presentation purposes) I guess
2011 Jul 27
1
Referencing a column using a function argument
Hi all, I've been having trouble with something that seems like it should be fairly straight forward. Any help at all from more experienced users is appreciated! I'd like to write a function that uses a column name as an argument. However, I run into problems when I try to reference this column within the function. For example, findCutoff <- function(tableName, columnName) {
2007 Apr 22
1
names( d$columnname )
dear R wizards --- would it make sense for names(d$columnname) to be "columnname"? I can preserve the columnname through x=subset(dataset, select="columnname"), of course, but it would seem that x=d$columnname could also do this. No? Sincerely, /iaw
2008 Oct 20
1
[LLVMdev] mixed bc file
I have a question with llvm-gcc and llvm-gfortran. Is it possible that llvm-ld can combine different bc files compiled from C programme and Fortran Programme together? For example: Compile a c program into llvm bc file by the task: # llvm-gcc -emit-llvm test.c -c -o test.bc and then compile a fortran program into llvm bc file by the task: # llvm-gfortran -emit-llvm testf.f -c -o testf.bc And
2009 Jun 25
2
variable driven summary of one column
Hello, how can I get a variable driven summary of one column of my data.frame? Usually I would do > summary(data$columnname) to get a summary of column named "columnname" of my data.frame named "data". In my case the columnname is not static but can be set dynamically. So I save the chosen columname in something like variable <- "columnname" but how can I
2012 Apr 17
4
parallel processing with multiple directories
Hello, I would like to run some code in parallel with each cluster reading/writing to a different working directory. I've tried the following code without success. The error I get is: "Error in setwd(x) : cannot change working directory" library(parallel) dirs <- list("out1","out2","out3") # these directories are located within the current
2010 Jul 26
4
using string variable as order() function argument
Hello, In my script I would like to use a loop, which sorts the dataframe according to different columns, pointed by the string variable. id col1 col2 col3 1 10 0 4 8 2 11 1 2 2 3 12 0 8 3 4 13 0 5 5 Usually the order() function can be used like this: sorted = mytable**[order(column3) , ] which results in properly sorted table: **
2004 Dec 22
2
RE ordering levels
Sorry, sorry.... of course levels(testf)[c(2,1,3)] will do the job My excuses to all Anne PS I will meditate the following saying "la parole est d'argent et le silence est d'or" BONNES FETES A TOUS SEASONAL GREETINGS ---------------------------------------------------- Anne Piotet Tel: +41 79 359 83 32 (mobile) Email: anne.piotet@m-td.com
2006 Jul 03
1
difficult data manipulation question
hi everyone : suppose i have a matrix in which some column names are identical so, for example, TEMP "AAA", "BBB", "CCC", "DDD","AAA", "BBB" 0 2 1 2 0 0 2 3 7 6 0 1 1.5 4 9 9 6 0 1.0 6 10 11 3 3 I didn't even check yet
2011 Sep 07
1
access objects
hi, say I have consecutively numbered objects obj1, obj2, ... in my R workspace. I want to acces one of them inside a function, with the number given as an argument. Where can I find help on how to do that? Somebody must have been trying to do this before... Some keywords to start a search are appreciated as well. Here's an example, I hope it clarifies what I'm trying to do: obj1 <-
2012 Aug 07
2
What is this called? lapply(datum,"[[","ColumnName")
Hello R users I recently learned how to use this command: lapply(datum,"[[","ColumnName") Unfortunately, I don't know how exactly it works, what it's called (in particular the "[[" part], and what other things you can do with it (retrieve multiple columns?). Given datum is a list of dataframes with the same column, but different number of rows,
2014 Jan 23
2
[LLVMdev] How to read v3.3 dbg metadata using v3.4 LLVM
Hi, I have bitcode files built by LLVM v3.3 and need to process them using v3.4 tools. While I don't expect a lot of backward compatibility in LLVM, luckily it seems everything's working fine, except for reading source line information attached to instructions. I use this piece of code [0] to get source line information. For v3.4, instruction.getMetadata returns NULL. I used llvm-dis to
2011 Dec 02
2
order function give back row name
Hello, I have a matrix results with dimension 1x9 double matrix XLB XLE XLF XLI 1 53.3089 55.77923 37.64458 83.08646 I'm trying to order this matrix > print(order(results)) [1] 3 1 2 4 how can the function order return the columnname XLF XLB XLE XLI instead of 3 1 2 4 any idea ? Thank you in advance --
2006 Mar 22
2
has_many, belongs_to
I have one table(profiles) where each row has many rows in another table(carriers). If I write profile.carriers I get a collection containing all carriers that belong to the current profile. My question is: how do I sort the collection profile.carriers? I would like to sort it on one of the columns (found in the table carriers). Can I override some method in the carrier model or somewhere
2008 Oct 21
6
detecting width overflow in serialized column with mysql
So I''ve got an ActiveRecord model pointing to a MySQL db, with an auto-serialized column ("serialize :columnName"). Thing is, MySQL, depending on how it''s configured (like, by default), has a bad habit of just truncating your data if it''s too wide for the column, with no error raised. Yeah, I can probably reconfigure MySQL and/or my AR connection to it. But
2006 Jul 02
4
is "label for" better?
I''ve noticed that it is common practise in forms to use: <label for="tablename","columnname"> ...Some column name</label> Why is the above construct better than just writting it this way? <label> Some column name</label> If there is not compelling reason, I''d prefer to use the second example and save on typing. -- Best Regards,
2014 Jan 24
2
[LLVMdev] How to read v3.3 dbg metadata using v3.4 LLVM
Thanks Eric, but could you give me a little bit more hints or pointers please? I looked into DebugInfo.h, but I'm still not sure how to start. It sounds like I'd have to somehow manually extract metadata nodes from an instruction. Thanks, JS On Wed, Jan 22, 2014 at 10:14 PM, Eric Christopher <echristo at gmail.com>wrote: > This is likely going to be difficult if possible. I