Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Importing R cosine similarity to UNIX? Post 302767747 by A-V on Thursday 7th of February 2013 11:28:10 AM
Old 02-07-2013
I have two files each of 6 lines each representing the frequency of specific words
now I wanted to calculate the cosine similarity between these files

for R I simply combine both files and extracted the bits from overall matrix that I needed
Code:
test <- as.matrix(read.csv(file="file.csv", sep=",", header=FALSE)) 
result<- cosine(t(test))
result-files <- (result[7:12,1:6])

I know that is not the best solution but it was easier as I am new to both languages

I have tried to get R running in cygwin but didnt manage... so now I am wondering whether it is possible to do cosine similarity calculations in unix... is there any shortcuts on doing so?

I a working on windows Vista

Cheers
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

importing database from unix to winnt

i am a unix-super-beginner (swaddled and weaned on windows) and am trying to import a database from a unix directory into winnt. can someone help me or am i a hopeless case? (4 Replies)
Discussion started by: sadiecutie
4 Replies

2. UNIX for Dummies Questions & Answers

Importing a unix file dump into a PC capable database

My development team has been trying to figure out how to import a unix data dump into SQL Server or convert it into an intermediate file format for several days. The data dump in question looks like this: $RecordID: 1<eof> $Version: 1<eof> Category: 1<eof> Poster: John Doe<eof>... (7 Replies)
Discussion started by: DaltonF
7 Replies

3. UNIX for Advanced & Expert Users

building flat files in unix and importing them from windows

what is a flat file in unix? i have to import a unix flat files from windows based programme. my question is not to export from unix but only to import from windows only. how to build that flat files? how to create export to windows how to import from windows (3 Replies)
Discussion started by: tunirayavarapu
3 Replies

4. Shell Programming and Scripting

awk? create similarity matrix by calculating overlaps between sets comprising of individual parts

Hi everyone I am very new at awk and to me the task I need to get done is very very challenging... Nevertheless, after admiring how fast and elegant issues are being solved here I am sure this is my best chance. I have a 2D data file (input file is a plain tab-delimited text file). The first... (1 Reply)
Discussion started by: stonemonkey
1 Replies

5. Shell Programming and Scripting

Help with merge data based on similarity

Input_file data1 USA 100 ASE data3 UK 20 GWQR data4 Brazil 40 QWE data2 Scotland 60 THWE data5 USA 40 QWERR Reference_file USA 12312 34532 1324 Brazil 23321 231 3421 Scotland 342 34235 UK 231 141 England... (1 Reply)
Discussion started by: patrick87
1 Replies

6. Shell Programming and Scripting

Help with sort list of file based on similarity

Input file (long list of input file): s_1_1_AABCD.txt s_1_1_ABADA.txt s_1_1_DSCBA.txt s_1_1_DSCCA.txt s_1_1_EATTG.txt s_1_1_FADSD.txt s_1_1_TGACC.txt s_1_1_TTAGG.txt s_1_2_AABCD.txt s_1_2_ABADA.txt s_1_2_DSCBA.txt s_1_2_DSCCA.txt s_1_2_EATTG.txt s_1_2_FADSD.txt ... (1 Reply)
Discussion started by: perl_beginner
1 Replies

7. UNIX for Advanced & Expert Users

Vector base Cosine Similarity for two Matrices -- R in UNIX

Dear All, I am facing a problem and I would be Thankful if you can help Hope this is the right place to ask this question I have two matrices of (row=10, col=3) and I want to get the cosine similarity between two lines (vectors) of each file --> the result should be (10,1) of cosine measures I... (10 Replies)
Discussion started by: A-V
10 Replies
COMBINEDIFF(1)															    COMBINEDIFF(1)

NAME
combinediff - create a cumulative unified patch from two incremental patches SYNOPSIS
combinediff [-p n] [-U n] [-d PAT] [-Bbiqwz] [--interpolate | --combine] diff1 diff2 combinediff {--help | --version} DESCRIPTION
combinediff creates a unified diff that expresses the sum of two diffs. The diff files must be listed in the order that they are to be applied. For best results, the diffs must have at least three lines of context. The diffs may be in context format. The output, however, will be in unified format. OPTIONS
-p n When comparing filenames, ignore the first n pathname components from both patches. (This is similar to the -p option to GNU patch(1).) -q Quieter output. Don't emit rationale lines at the beginning of each patch. -U n Attempt to display n lines of context (requires at least n lines of context in both input files). (This is similar to the -U option to GNU diff(1).) -d pattern Don't display any context on files that match the shell wildcard pattern. This option can be given multiple times. Note that the interpretation of the shell wildcard pattern does not count slash characters or periods as special (in other words, no flags are given to fnmatch). This is so that ``*/basename''-type patterns can be given without limiting the number of pathname com- ponents. -i Consider upper- and lower-case to be the same. -w Ignore whitespace changes in patches. -b Ignore changes in the amount of whitespace. -B Ignore changes whose lines are all blank. -z Decompress files with extensions .gz and .bz2. --interpolate Run as ``interdiff''. See combinediff(1) for more information about how the behaviour is altered in this mode. --combine Run as ``combinediff''. This is the default. --help Display a short usage message. --version Display the version number of combinediff. BUGS
The -U option is a bit erratic: it can control the amount of context displayed for files that are modified in both patches, but not for files that only appear in one patch (which appear with the same amount of context in the output as in the input). SEE ALSO
interdiff(1) AUTHOR
Tim Waugh <twaugh@redhat.com>. patchutils 17 Apr 2002 COMBINEDIFF(1)
All times are GMT -4. The time now is 02:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy