similar to: print() to file?

Displaying 20 results from an estimated 10000 matches similar to: "print() to file?"

2009 Aug 05
7
why is 0 not an integer?
Why when I assign 0 to an element of an integer vector does the type change to numeric? Here is a particularly perplexing example: > v <- 0:10 > v [1] 0 1 2 3 4 5 6 7 8 9 10 > class(v) [1] "integer" > v[1] <- 0 > class(v) [1] "numeric" #!! > -- View this message in context:
2009 Aug 05
7
why is 0 not an integer?
Why when I assign 0 to an element of an integer vector does the type change to numeric? Here is a particularly perplexing example: > v <- 0:10 > v [1] 0 1 2 3 4 5 6 7 8 9 10 > class(v) [1] "integer" > v[1] <- 0 > class(v) [1] "numeric" #!! > -- View this message in context:
2009 Aug 04
4
array slice notation?
Suppose I have an n-diml array A and I want to extract the first "row" -- ie all elements A[1, ...] Interactively if I know 'n' I can write A[1,,,,,] with (n-1) commas. How do I do the same more generally, eg in a script? (I can think of doing this by converting A to a vector then extracting the approp elements then reshaping it to an array, but I wonder if there isn't a
2009 Jun 23
1
X-window graphics -- preventing window coming to front?
When I do dev.new(), the resulting window comes to the front and grabs the focus. Is there a way to prevent this so I can continue working in other windows while the graphics are being produced? Thanks -- View this message in context: http://www.nabble.com/X-window-graphics----preventing-window-coming-to-front--tp24167763p24167763.html Sent from the R help mailing list archive at Nabble.com.
2009 Jul 01
2
sorting question
I've asked about custom sorting before and it appears that -- in terms of a user-defined order -- it can only be done either by defining a custom class or using various tricks with "order" Just wondering if anyone has a clever way to order "vintages" of the form 2002, 2003H1, 2003H2, 2004, 2005Q1, 2005Q2, etc some have H1 or H2, some have Q1,Q2,Q3,Q4, some are just plain
2010 Feb 01
5
regular expression submatch?
What is the simplest way to extract a matched subexpression? Eg. in perl you can do "hello world" =~ m/hello (.*)/ which would return 1(true) and set $1 to the matched subexpression "world". -- View this message in context: http://n4.nabble.com/regular-expression-submatch-tp1459146p1459146.html Sent from the R help mailing list archive at Nabble.com.
2009 Apr 24
4
omit empty cells in crosstab?
Perhaps this is a common question but I haven't been able to find the answer. I have data with many factors, each taking many values. However, only relatively few combinations appear in the data, ie have nonzero counts, in other words the resulting table is sparse. Say we have 10 factors each with 10 levels. The result of table() would exceed the memory space (on a 32bit machine). Is there
2009 Jan 10
2
hidden_field_tag flattens my array for value
ERB: <%= hidden_field_tag(''users_ids'', @users.collect(&:id))%> OUTPUT: <input id="users_ids" name="users_ids" type="hidden"
2020 Feb 29
2
Preserving the type of structure
Hello, LLVM IR flattens out the structure with one integer element to i32. Is there any way to disable this? I want to preserve the type information of the structure. I tried compiling the program with O0, it maintains the type for most of the instructions but for all. Regards, Sangeeta -------------- next part -------------- An HTML attachment was scrubbed... URL:
2009 Feb 13
3
R Help
Hi, I have a list of numbers (classified as a list) that contains integer(0) empty vectors. How do I convert those integer(0) into NAs? Thanks [[alternative HTML version deleted]]
2004 Jul 30
2
mirroring in both directions with rsync
When operating in daemon mode, will rsync check to see which file is newer and decide which direction to transfer based on that? Example, We have 2 terminal servers, A and B. I want users to be able to work on either server and have their home directories on both stay in sync. If a user logs into server A and changes files, the server would know to transfer the file from A to B. If they log
2016 Apr 26
2
How to print the frequency table (produced by the command "table" to Excel
Hi, How could we print the frequency table (produced by "table") to an Excel file? Is there an easy way to do so? Thanks, Miao > df <- data.frame(x = 1:3, y = 3:1, z = letters[1:3]) > table(df[,c("y","z")]) z y a b c 1 0 0 1 2 0 1 0 3 1 0 0 > test<-table(df[,c("y","z")]) > as.data.frame(test) y z Freq 1 1 a
2016 Apr 26
0
How to print the frequency table (produced by the command "table" to Excel
Hi jpm miao, You can get CSV files that can be imported into Excel like this: library(prettyR) sink("excel_table1.csv") delim.table(table(df[,c("y","z")])) sink() sink("excel_table2.csv") delim.table(as.data.frame(table(df[,c("y","z")])),label="") sink() sink("excel_table3.csv")
2009 Jun 17
4
searching help for partial matches
The situation is that I know there is a function and know approximately what the name is, and want to find the exact name. Is there a way of searching for near-matches (similar to unix apropos). For example, I know there is a function called something like allequal (or allequals or AllEquals or...). But ?allequal, etc, return nothing, only if I remember the name can I get help via ?all.equal.
2012 Jan 05
3
save output of print() to txt file
I am looking for other option to write the output of the print command in R I am using sink() to write the R output to a file. This is similar to what I have: > a=c(1:30) > a [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 > sink("vectorA.txt");print(a);sink() I am looking for othe roptions to save the output of the print()
2009 Jun 30
1
How to wrap my (working) code in a loop or function? (loop/function newbie alert)
Dear R-helpers, I have split a dataframe into a list with five elements, with the following code: > datalist<-split(data,data$UNIT) I would now like to run some code (below) on each element of the list to extract rows from the list elements; then I would like to rbind the extracted rows into a new dataframe containing all of the extracted rows from all of the list elements. I don't
2012 Nov 26
0
[LLVMdev] RFC: A Great Renaming of Things (or: Let's Repaint ALL the Bikesheds!)
Catching up on post-holiday emails. I may have comments on the more general stuff later, but wanted to respond to this bit more quickly. On Nov 22, 2012, at 3:05 AM, Chandler Carruth <chandlerc at google.com> wrote: > On Thu, Nov 22, 2012 at 1:53 AM, NAKAMURA Takumi <geek4civic at gmail.com> wrote: >> s/ExecutionEngine/EE/ (or something like buzzword!) > > I don't
2009 Jul 07
3
vectorizing a function
I'm sure I'm missing something obvious but I'm not seeing how to simply "vectorize" a function of two or more variables. Say I have f <- function(x,y) if (x>0) y else -y Now I have vectors x and y of equal length and I'd like to apply f element-wise. I.e. conceptually z <- f(x,y) where x, y, z are vectors of the same length Some magic involving apply?
2004 Feb 02
2
print comment lines on `sink'ed files?
Hi, I am using many comment lines like this # a comment line in a script. Is there any way to print comment lines when I use sink() function? Or, are there any plans to include as an option to sink() function in the near future? I would not want to use cat() function as it will look messy in the original script file. Thanks! SI __________________________________________________
2002 Sep 10
3
capturing the result of print in a variable?
I'd like to capture the results of a print() command so that I can put the results in a tktext widget. I know I can redirect the output to a file with sink. I'm looking for something like that, but where I can redirect the output into a variable. Is there a way to do that? Mike -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read