similar to: type casting

Displaying 20 results from an estimated 7000 matches similar to: "type casting"

2012 Oct 21
2
conditional value assignment
Hi, I am trying to assign values to records based conditionally on other records within a dataframe. For example, in the following dataframe the "NA" value in dat$age would be replaced if the age status for that individual and specific year can be found in another record. Ideally this would then also assign the same age status if the individual is recorded in a later year.
2012 Apr 26
2
Subsetting dataframe with missing values
Dear R-community, I am using R (V 2.14.1) on Windows 7. I have a dataset which consists of 19 variables for 91 individuals or rows. Two of my variables are Age (adult/chick, with no NA values) and Sex (0 for females/1 for females, with quite a few NA values). The sex of many adult birds is unknown (entered as NA in dataframe). At some point of my analyses, I happen to need to need to work with
2004 Jun 22
1
Grouped AND stacked bar charts possible in R?
Good day all, My statisticians want an R procedure that will produce grouped stacked barplots. Barplot will stack or group, but not both. The ftable function can produce a table of the exact form they want, but the barplot doesn't show all the divisions we want. For an example, here's the sample from the help file for "ftable:" data(Titanic) ftable(Titanic, row.vars = 1:3)
2012 Oct 22
3
Remove records from a large dataframe
Hi, I am trying to remove a series of records from a large dataframe. The script I have written works fine but takes a long time to run. Can anyone suggest a quicker way to do this? Here is an example of the code I've written. The end result of this bit of code would be a dataframe with any records relating to ID 1 or ID 4 removed: #dataframe id <- c(1,1,1,1,2,2,2,2,2, 3,3,3, 4,4)
2017 Jun 20
3
Help
Dear expert friends, I'm pretty young of this world and my question at your eyes can be petty easy. I'll need to change the name of the levels inside a column of my data-frame levels(ind.davis$Ageclass) <- c("adult", "Juvanile", "sub-adult") names(ind.davis$Ageclass) <- c("Adult", "Juvenile", "Sub-adult") that is what I
2017 Jun 20
0
Help
Leonardo-- R-help can be a very useful resource. Some suggestions to use it well: 1. use an informative subject line, not "help" 2. include a "minimal working example:" a *little* data, the code that, with those data, reproduces your problem, and the error message that resulted. As to your particular question, at this point I can only guess, but for starters it would
2011 Feb 09
3
Need help merging two dataframes
Hi R users, I am trying to extract some attributes (age, sex, area) from dataframe "AB" that has 101,269 observations of 28 variables to dataframe "t2" that has 47 observations of 6 variables. They share a column called "id", which is a factor with 47 levels. I want to end up with a dataframe that has 47 observations of 9 variables (the original 6 variables of t2,
2012 Aug 07
2
Passing arguments to a function within a function ...
Hallo Everybody How do you specify arguments for a function used within another function? Here is my problem: I am reconstructing a calculator for the burden of disease due to air pollution from publications and tools published by the WHO. The calculations make use of published dose-response relationships for particular health end-points. This is then applied to populations with known or
2011 Jun 03
2
Arules: R Crashes when running eclat with tidLists=TRUE
Hello, I'm using the eclat function of the arules package (1.0-6) for the identification of frequent itemsets. I need the tidLists, but if I set in the function tidLists=TRUE R crashes (Windows XP Professional SP3, 32 bit, R version 2.12.1 (2010-12-16), reproducible on two different computers) with two different error messages or non at all. Minimum examples are: library(arules)
2012 May 05
3
metafor
Dear users of metafor, I am working on a meta-analysis using the metafor package. I have a excel csv database that I am working with. I am interested in pooling the effect measures for a particular subgroup (European women) in this csv database. I am conducting both sub-group and meta-regression. In subgroup-analyses, I have stratified the database to create a separate csv file just for European
2011 Oct 10
1
pmml for random forest & rules
Hi, I am having some trouble using R 2.13.1 for generating a pmml object of of class "c('randomForest.formula', 'randomForest')" I see that these methods are available: > methods(pmml) [1] pmml.coxph* pmml.hclust* pmml.itemsets* pmml.kmeans* pmml.ksvm* pmml.lm* pmml.multinom* pmml.nnet* pmml.rpart* [10] pmml.rsf* pmml.rules* pmml.survreg*
2006 Apr 21
5
Simple Question: How to merge SQL results?
Hopefully an easy one, how do I merge two or more SQL query results? Example: result1 = find_by_sql(x) result2 = find_by_sql(y) What is the best way to merge result1 and result2? I want to be able to reference the objects as if they were obtained via one query. Cheers, Dan
2007 Jan 20
2
find_by_sql with named parameterized sql
I tried to use named parameters in my SQL query , using find_by_sql Order.find_by_sql ([select * from orders where amount > ? and quantity > ?", [ @amount, @quantity ] works;.. but Order.find_by_sql ([select * from orders where amount > :amount and quantity > :quantity ", [ :amount => @amt, :quantity => @qty ] is not working a I wrong or should I use a plain select
2010 May 07
1
undefined method 'find_by_sql'
Why would I get an undefined method `find_by_sql'' for #Example: 0x981a4e4> for error when trying to use the find_by_sql method in my model? def init_dictionaries tables = find_by_sql( "SHOW TABLES FROM thesaurus" ) @@tables = tables.collect{ |t| t.Tables_in_thesaurus } end -- You received this message because you are subscribed to the Google Groups "Ruby
2006 Jul 23
3
ANN: scoped_proxy plugin
ScopedProxy uses with_scope and proxy objects to make it easy to find and count different types of records. Example: class Person < ActiveRecord::Base scoped_proxy :minor, :conditions => ''age <= 17'' scoped_proxy :adult, :conditions => ''age >= 18'' scoped_proxy :old, :conditions => ''age >= 70'' scoped_proxy :male,
2010 Aug 01
2
Help -normal distribution
Hi , can any one help in this problem According to some study, the height for Northern European adult males is normally distributed with an average of 181 centimeter and a standard deviation of 7.3 centimeter. Suppose such an adult male is randomly chosen. Let X be height of that person. The next 3 questions correspond to this information. The answer may be rounded up to 3 decimal places of the
2005 Oct 28
4
find_by_sql column types
Hello-- There must be a better way to do this. I have a class method in my model that finds averages and does a few calculations using find_by_sql. The problem I¹m encountering is that all computed columns from MySQL come back as type string. E.g., def self.find_averages(domain_id) if @@domain_average return @@domain_average else @@domain_average =
2008 May 30
9
find_by_sql without a model? how to do this?
Hi, I''d like to do a "find_by_sql" without a model (e.g. <model name>.find_by_sql("...")) as the results I get back are a once off special, and I''m happy to handle them as an array. How do I do this? "ActiveRecord::Base.find_by_sql(...)" does not seem to work? Background - At the moment I''m doing within a model <model_name>,
2006 Jan 26
1
Help constructing a find_by_sql command
Hello all. I am trying to do the equivalent of: @componentlogs = Componentlog.find(:all, :conditions => [ "cl_compname like ?", @criteria ], :offset => offset, :limit => items_per_page, :order => "cl_spr DESC" ) in a find_by_sql statement. I cannot use the build in because the adaptor isn''t quite right (OCI8) When I use it I get the following error
2007 Aug 14
1
find_by_sql vs connection.select_all
I was trying to do SUM based mySQL query simliar to the following: SELECT SUM(updated_on - created_on) AS total from signups If I were to run this command in the mySQL console I would get a result. However, if I were to run it using the following command in Rails: Signup.find_by_sql("SELECT SUM(updated_on - created_on) AS total from signups") The query that is written to the log is: