similar to: functions of vectors : loop or vectorization

Displaying 20 results from an estimated 400 matches similar to: "functions of vectors : loop or vectorization"

2017 Jun 06
3
Force argument to have quotes
I am writing a program where non-technical R users will read in a config file and the config file will then parse the arguments found within the config and pass them to respective functions. I'm having trouble (efficiently) writing a piece of code to retain quotation marks around the argument which requires it as input, as found in the example function below, myFuncton1. Below is a minimal,
2017 Jun 06
0
Force argument to have quotes
Harold: As a general rule, if you are using eval(parse(...)) you are doing it poorly in R; cf library("fortunes") fortune(106) Why is something like this not suitable: fun1 <- function(a1,a2,a3 = c("hi","by")) { cat(a3,a1+a2,"\n") } > fun1 (1,2) hi by 3 > fun1(1,2, a3 = "whoopee") whoopee 3 ... or, if you want to include the
2009 Jul 07
4
Test for X=1 fails, test for >0 works, data in text file is 1
Hi, I am apparently not understanding some nuance about either the use of subset or more likely my ability to test for a numerical match using '='. Which is it? Thanks in advance. I've read a data file, reshaped it and then created MyResults by keeping only lines where the value column is greater than 0. So far so good. The data in MyResults looks good to me by eye. The
2009 Jul 21
4
list of lm() results
How can I get the results of lm() into a list so I can loop through the results? e.g. myResults[1] <- lm(...) myResults[2] <- lm(...) myResults[3] <- lm(...) ... myResults[15] <- lm(...) myResults[16] <- lm(...) so far every attempt I've tried doesn't work throwing a "number of items to replace is not a multiple of replacement length" error or simply not
2009 Jul 08
1
What is cast telling me?
Hi, What is cast telling me when it says the following? Aggregation requires fun.aggregate: length used as default What is 'length'? I've taken a small subset of data and wondered what EnTime vs ExTime might look like. cast is kind enough to give me a table but I don't understand the values in the table. They seem to sum up ro be the same as the total dimension of the data
2009 Mar 22
2
Following progress in a lapply() function
Dear all, I am processing a very long and complicated list using lapply through a custom function and I would like to generate some sort of progress report. For instance, print a dot on the screen every time 1000 item have been process. Or even better, reporting the percent of the list that have been process every 10%. However, I can't seem to figure out a way to achieve that. For instance,
2012 Feb 13
2
Puzzling... puzzling... puzzling...
Hi all, I made sure that it's "env$sRes1$nPositionsOptimizedM" that's correct... not the "env$sRes1$nPositionsOptimized"... But it seems both point to the same memory area... This is very dangerous because I have used naming conventions such as: MyLongVariableNameForA MyLongVariableNameForB MyLongVariableNameForC ... ... Then if internally they are actually the
2011 Oct 13
1
pass an element in a list() from R to C
Hi all, I'm new to this "call C from R" so bear with me. I'v been writing some C code and compile it to .dll files that can be called from R. It was successful until today, when I start a new part of this project. So, my R code passes arguments to this C code, and these arguments including some integers and matrices. it looks like this, and it works fine:
2017 Nov 24
1
Multiple sets of proportion tests
Thank you for clarifying this point but my main question was about how to modify my code to do the analysis correctly. The code I mentioned :- MyResults <- apply(Mydata, 2, function(x)prop.test(Mydata,c(200,100)) Results in this error : 'x' and 'n' must have the same length in the prop.test(x,n). How can I modify "x' or "n" arguments so the analysis
2010 Aug 11
1
sem & psych
Dear R users, I am trying to simulate some multitrait-multimethod models using the packages sem and psych but whatever I do to deal with models which do not converge I always get stuck and get error messages such as these: "Error in summary.sem(M1) : coefficient covariances cannot be computed" "Error in solve.default(res$hessian) : System ist f?r den Rechner singul?r: reziproke
2017 Nov 24
2
Multiple sets of proportion tests
Hi all , I have a dataframe of 200 columns and 2 rows. The first row in each column contains the frequency of cases in group I . The second row in each column contains the frequency of cases in group II. The frequency of trails is a fixed value for group I(e.g.200) and it is also another fixed values for group II (e.g. 100). The dataset looks like this :- > Mydata
2017 Nov 24
0
Multiple sets of proportion tests
Hi anonymous, ?prop.test states that it returns a list. And one of the element is 'p.value'. str() on the output of prop.test() reveals that too. So prop.test()$p.value or prop.test()["p.value"] should work. Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR
2008 Jul 25
0
nlminb--lower bound for parameters are dependent on each others
Hello I'm trying to solve two sets of equations (each set has four equations and all of them share common parameters) with nlminb procedure. I minimize one set and use their parameters as initial values of other set, repeating this until their parameters become very close to each other. I have several parameters (say,param1, param2) and their constraints are given as inequality and depend
2007 Aug 24
2
Saving results from Linux command line
Hi All, I'm used to running R on Windows & learning Linux. I know ESS is the way to go in the long run, but I'm trying now to just understand the command line. I can interactively enter commands, see the results on the screen and save input & output to myresults.txt with this approach: $script myresults.txt $R > ...r commands... >q() $exit I can also use the Linux tee
2007 Mar 07
1
Fwd: Package-RODBC-MSACCESS
I have used RODBC to get the database i can view the tables in RGUI-2.4.1 how can i query the records in R> i tried with sqlQuery need some help JJ -- Lecturer J. Joshua Thomas KDU College Penang Campus Research Student, University Sains Malaysia -- Lecturer J. Joshua Thomas KDU College Penang Campus Research Student, University Sains Malaysia [[alternative HTML version deleted]]
2003 Mar 03
5
(no subject)
Dear Everyone, I am a novel user of the R package (less than a week). I am using the package to analyse some microarray data. I have successfully imported the data, and manipulated it, resulting in additional columns of data. However, I now want to extract all this new information from R for use outside the package. Can anyone tell me of any commands that would allow me to accomplish
2009 Jul 22
3
How to use macro variable in a text string
I want to use read.table to input many files, each for a different year. I would like to use the macro variable 't' to refer to the exact file that I would like to input the data using read.table. How could I do this? Thank you! for (t in 1970:2005) { edge <- read.table(file="edge_t.csv", header=T, sep=",") ## I will have many rows of code following the
2003 Apr 28
4
how to present a table in powerpoint?
Hi, I have a nicely printed table of results generated by R's > print(myresult) where myresult is a "data frame". I am trying to put this table into a powerpoint slide for presentation without re-typing and re-formating, i.e., present it as it is in the R window. This saves time when there are a lot of tables to be presented. I tried > sink("myresult.txt") >
2005 Dec 07
1
Dots argument in apply method
Hello everyone, I'm working on a package using S4 classes and methods and I ran into the following "problem" when I tried to create an "apply" method for objects of one of my new classes. I've found a way around the problem but I wonder if I did not paint myself into the corner. I'd like your opinion about that. So I have an object "myObj" of class
2006 Jul 19
1
A couple of problems
Hi Ezra, Thanks for the great work on BackgrounDRb. I have come across a couple of problems. 1. I wanted to define a simple class in the worker file to wrap up and pass back some data to my controller. It seems that if I create the class either inside or outside of my worker class (in the same file) it gets wrapper by a DRb::DRbUknown object and therefore cannot be accessed from my controller.